summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbviewport.cpp
diff options
context:
space:
mode:
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 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
104void RBViewport::paint(QPainter *painter, 123void 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