summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor/models
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-22 07:55:50 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-22 07:55:50 +0000
commitac9287bdb5b94d575b5130ccdc2fe25c45ca395e (patch)
tree0830e573cf74150966e3705c2ad8e08fbc1c21c2 /utils/themeeditor/models
parent08d09e678f942fef9e9efc9a88e62f0b4e7bb0a4 (diff)
downloadrockbox-ac9287bdb5b94d575b5130ccdc2fe25c45ca395e.tar.gz
rockbox-ac9287bdb5b94d575b5130ccdc2fe25c45ca395e.zip
Theme Editor: Began in implementing tag rendering, %X tag now recognized
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27043 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/models')
-rw-r--r--utils/themeeditor/models/parsetreemodel.cpp12
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp37
-rw-r--r--utils/themeeditor/models/parsetreenode.h1
3 files changed, 50 insertions, 0 deletions
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp
index 4e94bfa0bf..830a6463bb 100644
--- a/utils/themeeditor/models/parsetreemodel.cpp
+++ b/utils/themeeditor/models/parsetreemodel.cpp
@@ -32,6 +32,8 @@
#include <QMap>
#include <QDir>
+#include <iostream>
+
ParseTreeModel::ParseTreeModel(const char* document, QObject* parent):
QAbstractItemModel(parent)
{
@@ -293,6 +295,16 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project,
settings.insert("themebase", base.canonicalPath());
}
+ if(file)
+ {
+ QString skinFile = *file;
+ QStringList decomp = skinFile.split("/");
+ skinFile = decomp[decomp.count() - 1];
+ skinFile.chop(skinFile.length() - skinFile.lastIndexOf("."));
+ settings.insert("imagepath", settings.value("themebase","") + "/wps/" +
+ skinFile);
+ }
+
RBScreen* screen = 0;
RBRenderInfo info(this, project, &settings, screen);
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index a74dd2350b..ed518a47db 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -475,6 +475,7 @@ ParseTreeNode* ParseTreeNode::getParent() const
return parent;
}
+/* This version is called for the root node and for viewports */
void ParseTreeNode::render(const RBRenderInfo& info)
{
/* Parameters don't get rendered */
@@ -500,5 +501,41 @@ void ParseTreeNode::render(const RBRenderInfo& info)
}
rendered = new RBViewport(element, info);
+
+ for(int i = element->params_count; i < children.count(); i++)
+ children[i]->render(info, dynamic_cast<RBViewport*>(rendered));
}
+/* This version is called for logical lines and such */
+void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
+{
+ if(element->type == LINE)
+ {
+ for(int i = 0; i < children.count(); i++)
+ children[i]->render(info, viewport);
+ viewport->newline();
+ }
+ else if(element->type == TAG)
+ {
+ QString filename;
+
+ /* Two switch statements to narrow down the tag name */
+ switch(element->tag->name[0])
+ {
+
+ case 'X':
+
+ switch(element->tag->name[1])
+ {
+ case '\0':
+ /* %X tag */
+ filename = QString(element->params[0].data.text);
+ info.screen()->setBackdrop(filename);
+ break;
+ }
+
+ break;
+
+ }
+ }
+}
diff --git a/utils/themeeditor/models/parsetreenode.h b/utils/themeeditor/models/parsetreenode.h
index bfbd5968d3..127cd78e1e 100644
--- a/utils/themeeditor/models/parsetreenode.h
+++ b/utils/themeeditor/models/parsetreenode.h
@@ -60,6 +60,7 @@ public:
}
void render(const RBRenderInfo& info);
+ void render(const RBRenderInfo &info, RBViewport* viewport);
private:
ParseTreeNode* parent;