summaryrefslogtreecommitdiff
path: root/utils/themeeditor/models
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/models')
-rw-r--r--utils/themeeditor/models/parsetreemodel.cpp8
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp32
-rw-r--r--utils/themeeditor/models/parsetreenode.h6
3 files changed, 43 insertions, 3 deletions
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp
index 762443f..41cecc4 100644
--- a/utils/themeeditor/models/parsetreemodel.cpp
+++ b/utils/themeeditor/models/parsetreemodel.cpp
@@ -23,6 +23,7 @@
#include "parsetreemodel.h"
#include "symbols.h"
#include "rbscreen.h"
+#include "rbrenderinfo.h"
#include <cstdlib>
@@ -280,5 +281,12 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project)
RBScreen* screen = new RBScreen(project);
scene->addItem(screen);
+ RBRenderInfo info(this, project, screen);
+
+ /* Rendering the tree */
+ if(root)
+ root->render(info);
+
+
return scene;
}
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index 397031a..97beca4 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -98,6 +98,12 @@ ParseTreeNode::ParseTreeNode(skin_tag_parameter *data, ParseTreeNode *parent)
}
+ParseTreeNode::~ParseTreeNode()
+{
+ for(int i = 0; i < children.count(); i++)
+ delete children[i];
+}
+
QString ParseTreeNode::genCode() const
{
QString buffer = "";
@@ -467,8 +473,28 @@ ParseTreeNode* ParseTreeNode::getParent() const
return parent;
}
-ParseTreeNode::~ParseTreeNode()
+void ParseTreeNode::render(const RBRenderInfo& info)
{
- for(int i = 0; i < children.count(); i++)
- delete children[i];
+ /* Parameters don't get rendered */
+ if(!element && param)
+ return;
+
+ /* If we're at the root, we need to render each viewport */
+ if(!element && !param)
+ {
+ for(int i = 0; i < children.count(); i++)
+ {
+ children[i]->render(info);
+ }
+
+ return;
+ }
+
+ switch(element->type)
+ {
+ case VIEWPORT:
+ rendered = new RBViewport(element, info);
+ break;
+ }
}
+
diff --git a/utils/themeeditor/models/parsetreenode.h b/utils/themeeditor/models/parsetreenode.h
index 7a0807b..bfbd596 100644
--- a/utils/themeeditor/models/parsetreenode.h
+++ b/utils/themeeditor/models/parsetreenode.h
@@ -23,6 +23,9 @@
#define PARSETREENODE_H
#include "skin_parser.h"
+#include "rbviewport.h"
+#include "rbscreen.h"
+#include "rbrenderinfo.h"
#include <QString>
#include <QVariant>
@@ -56,6 +59,8 @@ public:
return 0;
}
+ void render(const RBRenderInfo& info);
+
private:
ParseTreeNode* parent;
struct skin_element* element;
@@ -63,6 +68,7 @@ private:
QList<ParseTreeNode*> children;
static int openConditionals;
+ QGraphicsItem* rendered;
};