summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbviewport.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-21 20:11:58 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-21 20:11:58 +0000
commite1d8a3dc63391098f9381a3cb33d73e69b46c006 (patch)
tree0f503320d4fda330a003fe88ae7482537037db85 /utils/themeeditor/graphics/rbviewport.cpp
parentbd380b399323d15a1572cdc017e0f95b1b9db151 (diff)
downloadrockbox-e1d8a3dc63391098f9381a3cb33d73e69b46c006.zip
rockbox-e1d8a3dc63391098f9381a3cb33d73e69b46c006.tar.gz
rockbox-e1d8a3dc63391098f9381a3cb33d73e69b46c006.tar.bz2
rockbox-e1d8a3dc63391098f9381a3cb33d73e69b46c006.tar.xz
Theme Editor: Reworked information passing among render functions, now loads all viewports and shows Custom UI viewport in blue
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27026 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/graphics/rbviewport.cpp')
-rw-r--r--utils/themeeditor/graphics/rbviewport.cpp60
1 files changed, 40 insertions, 20 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp
index 1f1f02c..9045016 100644
--- a/utils/themeeditor/graphics/rbviewport.cpp
+++ b/utils/themeeditor/graphics/rbviewport.cpp
@@ -50,38 +50,57 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info)
}
else
{
- int x, y, w, h;
- /* Parsing one of the other types of viewport */
+ int param;
+ QString ident;
+ int x,y,w,h;
+ /* Rendering one of the other types of viewport */
switch(node->tag->name[1])
{
case '\0':
- /* A normal viewport definition */
- x = node->params[0].data.numeric;
- y = node->params[1].data.numeric;
-
- if(node->params[2].type == skin_tag_parameter::DEFAULT)
- w = info.screen()->getWidth() - x;
- else
- w = node->params[2].data.numeric;
-
- if(node->params[3].type == skin_tag_parameter::DEFAULT)
- h = info.screen()->getHeight() - y;
- else
- h = node->params[3].data.numeric;
-
- size = QRectF(x, y, w, h);
+ customUI = false;
displayed = true;
+ param = 0;
break;
case 'l':
- /* Preloaded viewport */
+ /* A preloaded viewport definition */
+ ident = node->params[0].data.text;
+ customUI = false;
+ displayed = false;
+ info.screen()->loadViewport(ident, this);
+ param = 1;
break;
case 'i':
/* Custom UI Viewport */
+ customUI = true;
+ param = 1;
+ if(node->params[0].type == skin_tag_parameter::DEFAULT)
+ {
+ displayed = true;
+ }
+ else
+ {
+ displayed = false;
+ info.screen()->loadViewport(ident, this);
+ }
break;
-
}
+ /* Now we grab the info common to all viewports */
+ x = node->params[param++].data.numeric;
+ y = node->params[param++].data.numeric;
+
+ if(node->params[param].type == skin_tag_parameter::DEFAULT)
+ w = info.screen()->getWidth() - x;
+ else
+ w = node->params[param].data.numeric;
+
+ if(node->params[++param].type == skin_tag_parameter::DEFAULT)
+ h = info.screen()->getHeight() - y;
+ else
+ h = node->params[param].data.numeric;
+
+ size = QRectF(x, y, w, h);
}
}
@@ -104,7 +123,8 @@ QRectF RBViewport::boundingRect() const
void RBViewport::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
{
+ QColor color = customUI ? Qt::blue : Qt::red;
if(displayed)
- painter->fillRect(size, Qt::red);
+ painter->fillRect(size, color);
}