diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-21 20:11:58 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-21 20:11:58 +0000 |
commit | e1d8a3dc63391098f9381a3cb33d73e69b46c006 (patch) | |
tree | 0f503320d4fda330a003fe88ae7482537037db85 /utils/themeeditor/graphics/rbviewport.cpp | |
parent | bd380b399323d15a1572cdc017e0f95b1b9db151 (diff) | |
download | rockbox-e1d8a3dc63391098f9381a3cb33d73e69b46c006.tar.gz rockbox-e1d8a3dc63391098f9381a3cb33d73e69b46c006.zip |
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.cpp | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index 1f1f02ce55..9045016533 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) | |||
50 | } | 50 | } |
51 | else | 51 | else |
52 | { | 52 | { |
53 | int x, y, w, h; | 53 | int param; |
54 | /* Parsing one of the other types of viewport */ | 54 | QString ident; |
55 | int x,y,w,h; | ||
56 | /* Rendering one of the other types of viewport */ | ||
55 | switch(node->tag->name[1]) | 57 | switch(node->tag->name[1]) |
56 | { | 58 | { |
57 | case '\0': | 59 | case '\0': |
58 | /* A normal viewport definition */ | 60 | customUI = false; |
59 | x = node->params[0].data.numeric; | ||
60 | y = node->params[1].data.numeric; | ||
61 | |||
62 | if(node->params[2].type == skin_tag_parameter::DEFAULT) | ||
63 | w = info.screen()->getWidth() - x; | ||
64 | else | ||
65 | w = node->params[2].data.numeric; | ||
66 | |||
67 | if(node->params[3].type == skin_tag_parameter::DEFAULT) | ||
68 | h = info.screen()->getHeight() - y; | ||
69 | else | ||
70 | h = node->params[3].data.numeric; | ||
71 | |||
72 | size = QRectF(x, y, w, h); | ||
73 | displayed = true; | 61 | displayed = true; |
62 | param = 0; | ||
74 | break; | 63 | break; |
75 | 64 | ||
76 | case 'l': | 65 | case 'l': |
77 | /* Preloaded viewport */ | 66 | /* A preloaded viewport definition */ |
67 | ident = node->params[0].data.text; | ||
68 | customUI = false; | ||
69 | displayed = false; | ||
70 | info.screen()->loadViewport(ident, this); | ||
71 | param = 1; | ||
78 | break; | 72 | break; |
79 | 73 | ||
80 | case 'i': | 74 | case 'i': |
81 | /* Custom UI Viewport */ | 75 | /* Custom UI Viewport */ |
76 | customUI = true; | ||
77 | param = 1; | ||
78 | if(node->params[0].type == skin_tag_parameter::DEFAULT) | ||
79 | { | ||
80 | displayed = true; | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | displayed = false; | ||
85 | info.screen()->loadViewport(ident, this); | ||
86 | } | ||
82 | break; | 87 | break; |
83 | |||
84 | } | 88 | } |
89 | /* Now we grab the info common to all viewports */ | ||
90 | x = node->params[param++].data.numeric; | ||
91 | y = node->params[param++].data.numeric; | ||
92 | |||
93 | if(node->params[param].type == skin_tag_parameter::DEFAULT) | ||
94 | w = info.screen()->getWidth() - x; | ||
95 | else | ||
96 | w = node->params[param].data.numeric; | ||
97 | |||
98 | if(node->params[++param].type == skin_tag_parameter::DEFAULT) | ||
99 | h = info.screen()->getHeight() - y; | ||
100 | else | ||
101 | h = node->params[param].data.numeric; | ||
102 | |||
103 | size = QRectF(x, y, w, h); | ||
85 | } | 104 | } |
86 | } | 105 | } |
87 | 106 | ||
@@ -104,7 +123,8 @@ QRectF RBViewport::boundingRect() const | |||
104 | void RBViewport::paint(QPainter *painter, | 123 | void RBViewport::paint(QPainter *painter, |
105 | const QStyleOptionGraphicsItem *option, QWidget *widget) | 124 | const QStyleOptionGraphicsItem *option, QWidget *widget) |
106 | { | 125 | { |
126 | QColor color = customUI ? Qt::blue : Qt::red; | ||
107 | if(displayed) | 127 | if(displayed) |
108 | painter->fillRect(size, Qt::red); | 128 | painter->fillRect(size, color); |
109 | } | 129 | } |
110 | 130 | ||