summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbprogressbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/graphics/rbprogressbar.cpp')
-rw-r--r--utils/themeeditor/graphics/rbprogressbar.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/utils/themeeditor/graphics/rbprogressbar.cpp b/utils/themeeditor/graphics/rbprogressbar.cpp
index 76cfe5601b..15515f8a18 100644
--- a/utils/themeeditor/graphics/rbprogressbar.cpp
+++ b/utils/themeeditor/graphics/rbprogressbar.cpp
@@ -21,14 +21,17 @@
21 21
22#include <QPainter> 22#include <QPainter>
23 23
24#include "parsetreenode.h"
24#include "rbprogressbar.h" 25#include "rbprogressbar.h"
25#include "projectmodel.h" 26#include "projectmodel.h"
26 27
27RBProgressBar::RBProgressBar(RBViewport *parent, const RBRenderInfo &info, 28RBProgressBar::RBProgressBar(RBViewport *parent, const RBRenderInfo &info,
28 int paramCount, skin_tag_parameter *params, 29 ParseTreeNode* node, bool pv)
29 bool pv) 30 :RBMovable(parent), node(node)
30 :RBMovable(parent)
31{ 31{
32 int paramCount = node->getElement()->params_count;
33 skin_tag_parameter* params = node->getElement()->params;
34
32 /* First we set everything to defaults */ 35 /* First we set everything to defaults */
33 bitmap = 0; 36 bitmap = 0;
34 color = parent->getFGColor(); 37 color = parent->getFGColor();
@@ -70,7 +73,7 @@ RBProgressBar::RBProgressBar(RBViewport *parent, const RBRenderInfo &info,
70 bitmap = 0; 73 bitmap = 0;
71 } 74 }
72 } 75 }
73 76 size = QRectF(0, 0, w, h);
74 77
75 /* Finally, we scale the width according to the amount played */ 78 /* Finally, we scale the width according to the amount played */
76 int percent; 79 int percent;
@@ -89,7 +92,7 @@ RBProgressBar::RBProgressBar(RBViewport *parent, const RBRenderInfo &info,
89 92
90 w = w * percent / 100; 93 w = w * percent / 100;
91 94
92 size = QRectF(0, 0, w, h); 95 renderSize = QRectF(0, 0, w, h);
93 setPos(x, y); 96 setPos(x, y);
94 parent->addTextOffset(h); 97 parent->addTextOffset(h);
95} 98}
@@ -111,11 +114,11 @@ void RBProgressBar::paint(QPainter *painter,
111{ 114{
112 if(bitmap && !bitmap->isNull()) 115 if(bitmap && !bitmap->isNull())
113 { 116 {
114 painter->drawPixmap(size, *bitmap, size); 117 painter->drawPixmap(renderSize, *bitmap, renderSize);
115 } 118 }
116 else 119 else
117 { 120 {
118 painter->fillRect(size, color); 121 painter->fillRect(renderSize, color);
119 } 122 }
120 123
121 RBMovable::paint(painter, option, widget); 124 RBMovable::paint(painter, option, widget);
@@ -123,5 +126,14 @@ void RBProgressBar::paint(QPainter *painter,
123 126
124void RBProgressBar::saveGeometry() 127void RBProgressBar::saveGeometry()
125{ 128{
129 QPointF origin = pos();
130 QRectF bounds = boundingRect();
131
132 node->modParam(static_cast<int>(origin.x()), 0);
133 node->modParam(static_cast<int>(origin.y()), 1);
134 node->modParam(static_cast<int>(bounds.width()), 2);
135 node->modParam(static_cast<int>(bounds.height()), 3);
126 136
137 if(!bitmap)
138 node->modParam(QVariant(), 4);
127} 139}