|
@@ -2,8 +2,6 @@
|
|
|
|
|
|
|
|
#include "CProject.h"
|
|
#include "CProject.h"
|
|
|
|
|
|
|
|
-#include "../FileSystem/utils.h"
|
|
|
|
|
-
|
|
|
|
|
using namespace WallpaperEngine::Core;
|
|
using namespace WallpaperEngine::Core;
|
|
|
|
|
|
|
|
CProject::CProject (std::string title, std::string type, CScene *scene) :
|
|
CProject::CProject (std::string title, std::string type, CScene *scene) :
|
|
@@ -21,6 +19,7 @@ CProject* CProject::fromFile (const irr::io::path& filename)
|
|
|
json::const_iterator title = content.find ("title");
|
|
json::const_iterator title = content.find ("title");
|
|
|
json::const_iterator type = content.find ("type");
|
|
json::const_iterator type = content.find ("type");
|
|
|
json::const_iterator file = content.find ("file");
|
|
json::const_iterator file = content.find ("file");
|
|
|
|
|
+ json::const_iterator general = content.find ("general");
|
|
|
|
|
|
|
|
if (title == content.end ())
|
|
if (title == content.end ())
|
|
|
{
|
|
{
|
|
@@ -37,11 +36,31 @@ CProject* CProject::fromFile (const irr::io::path& filename)
|
|
|
throw std::runtime_error ("Project's main file missing");
|
|
throw std::runtime_error ("Project's main file missing");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return new CProject (
|
|
|
|
|
- *title,
|
|
|
|
|
- *type,
|
|
|
|
|
- CScene::fromFile ((*file).get <std::string> ().c_str ())
|
|
|
|
|
|
|
+ CProject* project = new CProject (
|
|
|
|
|
+ *title,
|
|
|
|
|
+ *type,
|
|
|
|
|
+ CScene::fromFile ((*file).get <std::string> ().c_str ())
|
|
|
);
|
|
);
|
|
|
|
|
+
|
|
|
|
|
+ if (general != content.end ())
|
|
|
|
|
+ {
|
|
|
|
|
+ json::const_iterator properties = (*general).find ("properties");
|
|
|
|
|
+
|
|
|
|
|
+ if (properties != (*general).end ())
|
|
|
|
|
+ {
|
|
|
|
|
+ json::const_iterator cur = (*properties).begin ();
|
|
|
|
|
+ json::const_iterator end = (*properties).end ();
|
|
|
|
|
+
|
|
|
|
|
+ for (; cur != end; cur ++)
|
|
|
|
|
+ {
|
|
|
|
|
+ project->insertProperty (
|
|
|
|
|
+ Projects::CProperty::fromJSON (*cur, cur.key ())
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return project;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
CScene* CProject::getScene ()
|
|
CScene* CProject::getScene ()
|
|
@@ -57,4 +76,14 @@ std::string CProject::getTitle ()
|
|
|
std::string CProject::getType ()
|
|
std::string CProject::getType ()
|
|
|
{
|
|
{
|
|
|
return this->m_type;
|
|
return this->m_type;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+std::vector<Projects::CProperty*>* CProject::getProperties ()
|
|
|
|
|
+{
|
|
|
|
|
+ return &this->m_properties;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void CProject::insertProperty (Projects::CProperty* property)
|
|
|
|
|
+{
|
|
|
|
|
+ this->m_properties.push_back (property);
|
|
|
}
|
|
}
|