diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/themeeditor/graphics/rbrenderinfo.cpp | 7 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbrenderinfo.h | 5 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscene.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscene.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.cpp | 26 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.h | 5 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.cpp | 16 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.cpp | 36 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.cpp | 15 |
10 files changed, 71 insertions, 45 deletions
diff --git a/utils/themeeditor/graphics/rbrenderinfo.cpp b/utils/themeeditor/graphics/rbrenderinfo.cpp index e39a4cea43..bcccc4c887 100644 --- a/utils/themeeditor/graphics/rbrenderinfo.cpp +++ b/utils/themeeditor/graphics/rbrenderinfo.cpp | |||
@@ -23,12 +23,11 @@ | |||
23 | 23 | ||
24 | RBRenderInfo::RBRenderInfo(ParseTreeModel* model, ProjectModel* project, | 24 | RBRenderInfo::RBRenderInfo(ParseTreeModel* model, ProjectModel* project, |
25 | SkinDocument* doc, QMap<QString, QString>* settings, | 25 | SkinDocument* doc, QMap<QString, QString>* settings, |
26 | DeviceState* device, RBScreen* screen, | 26 | DeviceState* device, RBScreen* screen) |
27 | RBScreen* sbsScreen) | ||
28 | :mProject(project), mDoc(doc), | 27 | :mProject(project), mDoc(doc), |
29 | mSettings(settings), | 28 | mSettings(settings), |
30 | mDevice(device), mScreen(screen), | 29 | mDevice(device), mScreen(screen), |
31 | mSbsScreen(sbsScreen), mModel(model) | 30 | mModel(model) |
32 | { | 31 | { |
33 | } | 32 | } |
34 | 33 | ||
@@ -44,7 +43,6 @@ RBRenderInfo::RBRenderInfo(const RBRenderInfo &other) | |||
44 | mDevice = other.mDevice; | 43 | mDevice = other.mDevice; |
45 | mDoc = other.mDoc; | 44 | mDoc = other.mDoc; |
46 | mScreen = other.mScreen; | 45 | mScreen = other.mScreen; |
47 | mSbsScreen = other.mSbsScreen; | ||
48 | mModel = other.mModel; | 46 | mModel = other.mModel; |
49 | } | 47 | } |
50 | 48 | ||
@@ -55,7 +53,6 @@ const RBRenderInfo& RBRenderInfo::operator=(const RBRenderInfo& other) | |||
55 | mDevice = other.mDevice; | 53 | mDevice = other.mDevice; |
56 | mDoc = other.mDoc; | 54 | mDoc = other.mDoc; |
57 | mScreen = other.mScreen; | 55 | mScreen = other.mScreen; |
58 | mSbsScreen = other.mSbsScreen; | ||
59 | mModel = other.mModel; | 56 | mModel = other.mModel; |
60 | 57 | ||
61 | return *this; | 58 | return *this; |
diff --git a/utils/themeeditor/graphics/rbrenderinfo.h b/utils/themeeditor/graphics/rbrenderinfo.h index 17b87dbb6b..e24603315a 100644 --- a/utils/themeeditor/graphics/rbrenderinfo.h +++ b/utils/themeeditor/graphics/rbrenderinfo.h | |||
@@ -35,8 +35,7 @@ class RBRenderInfo | |||
35 | public: | 35 | public: |
36 | RBRenderInfo(ParseTreeModel* model, ProjectModel* project, | 36 | RBRenderInfo(ParseTreeModel* model, ProjectModel* project, |
37 | SkinDocument* doc, QMap<QString, QString>* settings, | 37 | SkinDocument* doc, QMap<QString, QString>* settings, |
38 | DeviceState* device, RBScreen* screen, | 38 | DeviceState* device, RBScreen* screen); |
39 | RBScreen* sbsScreen = 0); | ||
40 | RBRenderInfo(); | 39 | RBRenderInfo(); |
41 | RBRenderInfo(const RBRenderInfo& other); | 40 | RBRenderInfo(const RBRenderInfo& other); |
42 | virtual ~RBRenderInfo(); | 41 | virtual ~RBRenderInfo(); |
@@ -48,7 +47,6 @@ public: | |||
48 | SkinDocument* document() const{ return mDoc; } | 47 | SkinDocument* document() const{ return mDoc; } |
49 | QMap<QString, QString>* settings() const{ return mSettings; } | 48 | QMap<QString, QString>* settings() const{ return mSettings; } |
50 | RBScreen* screen() const{ return mScreen; } | 49 | RBScreen* screen() const{ return mScreen; } |
51 | RBScreen* sbsScreen() const{ return mSbsScreen; } | ||
52 | ParseTreeModel* model() const{ return mModel; } | 50 | ParseTreeModel* model() const{ return mModel; } |
53 | 51 | ||
54 | private: | 52 | private: |
@@ -57,7 +55,6 @@ private: | |||
57 | QMap<QString, QString>* mSettings; | 55 | QMap<QString, QString>* mSettings; |
58 | DeviceState* mDevice; | 56 | DeviceState* mDevice; |
59 | RBScreen* mScreen; | 57 | RBScreen* mScreen; |
60 | RBScreen* mSbsScreen; | ||
61 | ParseTreeModel* mModel; | 58 | ParseTreeModel* mModel; |
62 | }; | 59 | }; |
63 | 60 | ||
diff --git a/utils/themeeditor/graphics/rbscene.cpp b/utils/themeeditor/graphics/rbscene.cpp index 836abee489..206f68f184 100644 --- a/utils/themeeditor/graphics/rbscene.cpp +++ b/utils/themeeditor/graphics/rbscene.cpp | |||
@@ -20,6 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include <QGraphicsSceneMouseEvent> | 22 | #include <QGraphicsSceneMouseEvent> |
23 | #include <QGraphicsItem> | ||
23 | 24 | ||
24 | #include <QDebug> | 25 | #include <QDebug> |
25 | 26 | ||
@@ -33,4 +34,3 @@ RBScene::RBScene(QObject* parent) | |||
33 | RBScene::~RBScene() | 34 | RBScene::~RBScene() |
34 | { | 35 | { |
35 | } | 36 | } |
36 | |||
diff --git a/utils/themeeditor/graphics/rbscene.h b/utils/themeeditor/graphics/rbscene.h index 2c4e0ee193..4cb0dfc2a4 100644 --- a/utils/themeeditor/graphics/rbscene.h +++ b/utils/themeeditor/graphics/rbscene.h | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | #include <QGraphicsScene> | 25 | #include <QGraphicsScene> |
26 | 26 | ||
27 | class RBScreen; | ||
28 | |||
27 | class RBScene : public QGraphicsScene | 29 | class RBScene : public QGraphicsScene |
28 | { | 30 | { |
29 | Q_OBJECT | 31 | Q_OBJECT |
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index 1b1adc8be4..2b63a6bdfe 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp | |||
@@ -32,7 +32,7 @@ | |||
32 | RBScreen::RBScreen(const RBRenderInfo& info, bool remote, | 32 | RBScreen::RBScreen(const RBRenderInfo& info, bool remote, |
33 | QGraphicsItem *parent) | 33 | QGraphicsItem *parent) |
34 | :QGraphicsItem(parent), backdrop(0), project(project), | 34 | :QGraphicsItem(parent), backdrop(0), project(project), |
35 | albumArt(0), customUI(0) | 35 | albumArt(0), customUI(0), defaultView(0) |
36 | { | 36 | { |
37 | 37 | ||
38 | setAcceptHoverEvents(true); | 38 | setAcceptHoverEvents(true); |
@@ -221,11 +221,29 @@ void RBScreen::makeCustomUI(QString id) | |||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | void RBScreen::endSbsRender() | ||
225 | { | ||
226 | sbsChildren = children(); | ||
227 | |||
228 | QList<int> keys = fonts.keys(); | ||
229 | for(QList<int>::iterator i = keys.begin(); i != keys.end(); i++) | ||
230 | { | ||
231 | if(*i > 2) | ||
232 | fonts.remove(*i); | ||
233 | } | ||
234 | |||
235 | images.clear(); | ||
236 | namedViewports.clear(); | ||
237 | displayedViewports.clear(); | ||
238 | } | ||
239 | |||
224 | void RBScreen::breakSBS() | 240 | void RBScreen::breakSBS() |
225 | { | 241 | { |
226 | width = fullWidth; | 242 | for(QList<QGraphicsItem*>::iterator i = sbsChildren.begin() |
227 | height = fullHeight; | 243 | ; i != sbsChildren.end(); i++) |
228 | setParentItem(0); | 244 | (*i)->hide(); |
245 | if(defaultView) | ||
246 | defaultView->makeFullScreen(); | ||
229 | } | 247 | } |
230 | 248 | ||
231 | QColor RBScreen::stringToColor(QString str, QColor fallback) | 249 | QColor RBScreen::stringToColor(QString str, QColor fallback) |
diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h index c9f6ae2dbc..c9ae2cf350 100644 --- a/utils/themeeditor/graphics/rbscreen.h +++ b/utils/themeeditor/graphics/rbscreen.h | |||
@@ -86,6 +86,8 @@ public: | |||
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void setDefault(RBViewport* view){ defaultView = view; } | ||
90 | void endSbsRender(); | ||
89 | void breakSBS(); | 91 | void breakSBS(); |
90 | 92 | ||
91 | protected: | 93 | protected: |
@@ -111,6 +113,9 @@ private: | |||
111 | 113 | ||
112 | RBAlbumArt* albumArt; | 114 | RBAlbumArt* albumArt; |
113 | RBViewport* customUI; | 115 | RBViewport* customUI; |
116 | RBViewport* defaultView; | ||
117 | |||
118 | QList<QGraphicsItem*> sbsChildren; | ||
114 | }; | 119 | }; |
115 | 120 | ||
116 | #endif // RBSCREEN_H | 121 | #endif // RBSCREEN_H |
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index 2c6fb9d7c3..a986127987 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp | |||
@@ -56,6 +56,16 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info, | |||
56 | customUI = false; | 56 | customUI = false; |
57 | font = screen->getFont(1); | 57 | font = screen->getFont(1); |
58 | 58 | ||
59 | screen->setDefault(this); | ||
60 | |||
61 | if(screen->getCustomUI()) | ||
62 | { | ||
63 | RBViewport* cui = screen->getCustomUI(); | ||
64 | size = cui->boundingRect(); | ||
65 | setPos(cui->pos()); | ||
66 | |||
67 | } | ||
68 | |||
59 | /* Making sure the default viewport can't be graphically manipulated */ | 69 | /* Making sure the default viewport can't be graphically manipulated */ |
60 | setFlag(ItemIsSelectable, false); | 70 | setFlag(ItemIsSelectable, false); |
61 | setFlag(ItemIsMovable, false); | 71 | setFlag(ItemIsMovable, false); |
@@ -299,6 +309,12 @@ void RBViewport::showPlaylist(const RBRenderInfo &info, int start, | |||
299 | } | 309 | } |
300 | } | 310 | } |
301 | 311 | ||
312 | void RBViewport::makeFullScreen() | ||
313 | { | ||
314 | size = screen->boundingRect(); | ||
315 | setPos(screen->pos()); | ||
316 | } | ||
317 | |||
302 | void RBViewport::saveGeometry() | 318 | void RBViewport::saveGeometry() |
303 | { | 319 | { |
304 | QRectF bounds = boundingRect(); | 320 | QRectF bounds = boundingRect(); |
diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h index 9bbceb4065..8544ad3c1f 100644 --- a/utils/themeeditor/graphics/rbviewport.h +++ b/utils/themeeditor/graphics/rbviewport.h | |||
@@ -81,6 +81,8 @@ public: | |||
81 | void showPlaylist(const RBRenderInfo& info, int start, skin_element* id3, | 81 | void showPlaylist(const RBRenderInfo& info, int start, skin_element* id3, |
82 | skin_element* noId3); | 82 | skin_element* noId3); |
83 | 83 | ||
84 | void makeFullScreen(); | ||
85 | |||
84 | protected: | 86 | protected: |
85 | void saveGeometry(); | 87 | void saveGeometry(); |
86 | 88 | ||
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index fbedf10d45..a7f46acd5f 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp | |||
@@ -316,7 +316,7 @@ RBScene* ParseTreeModel::render(ProjectModel* project, | |||
316 | } | 316 | } |
317 | 317 | ||
318 | /* Rendering SBS, if necessary */ | 318 | /* Rendering SBS, if necessary */ |
319 | RBScreen* sbsScreen = 0; | 319 | RBScreen* screen = 0; |
320 | if(wps && device->data("rendersbs").toBool()) | 320 | if(wps && device->data("rendersbs").toBool()) |
321 | { | 321 | { |
322 | QString sbsFile = settings.value(remote ? "rsbs" : "sbs", ""); | 322 | QString sbsFile = settings.value(remote ? "rsbs" : "sbs", ""); |
@@ -334,49 +334,37 @@ RBScene* ParseTreeModel::render(ProjectModel* project, | |||
334 | if(sbsModel->root != 0) | 334 | if(sbsModel->root != 0) |
335 | { | 335 | { |
336 | RBRenderInfo sbsInfo(sbsModel, project, doc, &settings, device, | 336 | RBRenderInfo sbsInfo(sbsModel, project, doc, &settings, device, |
337 | sbsScreen); | 337 | screen); |
338 | 338 | ||
339 | sbsScreen = new RBScreen(sbsInfo, remote); | 339 | screen = new RBScreen(sbsInfo, remote); |
340 | scene->addItem(sbsScreen); | 340 | scene->addItem(screen); |
341 | 341 | ||
342 | sbsInfo = RBRenderInfo(sbsModel, project, doc, &settings, | 342 | sbsInfo = RBRenderInfo(sbsModel, project, doc, &settings, |
343 | device, sbsScreen); | 343 | device, screen); |
344 | sbsModel->root->render(sbsInfo); | 344 | sbsModel->root->render(sbsInfo); |
345 | screen->endSbsRender(); | ||
345 | 346 | ||
346 | setChildrenUnselectable(sbsScreen); | 347 | setChildrenUnselectable(screen); |
347 | } | 348 | } |
348 | } | 349 | } |
349 | } | 350 | } |
350 | 351 | ||
351 | RBScreen* screen = 0; | 352 | RBRenderInfo info(this, project, doc, &settings, device, screen); |
352 | RBRenderInfo info(this, project, doc, &settings, device, screen, sbsScreen); | ||
353 | 353 | ||
354 | /* Adding the screen */ | 354 | /* Adding the screen */ |
355 | if(sbsScreen) | 355 | if(!screen) |
356 | screen = new RBScreen(info, remote, sbsScreen->getCustomUI()); | 356 | { |
357 | else | ||
358 | screen = new RBScreen(info, remote); | 357 | screen = new RBScreen(info, remote); |
359 | |||
360 | if(!sbsScreen) | ||
361 | scene->addItem(screen); | 358 | scene->addItem(screen); |
359 | } | ||
362 | 360 | ||
363 | info = RBRenderInfo(this, project, doc, &settings, device, screen, | 361 | info = RBRenderInfo(this, project, doc, &settings, device, screen); |
364 | sbsScreen); | ||
365 | 362 | ||
366 | 363 | ||
367 | /* Rendering the tree */ | 364 | /* Rendering the tree */ |
368 | if(root) | 365 | if(root) |
369 | root->render(info); | 366 | root->render(info); |
370 | 367 | ||
371 | // /* Making sure the Custom UI Viewport can't be selected */ | ||
372 | // if(sbsScreen) | ||
373 | // { | ||
374 | // sbsScreen->getCustomUI()->setFlag(QGraphicsItem::ItemIsSelectable, | ||
375 | // false); | ||
376 | // sbsScreen->getCustomUI()->setFlag(QGraphicsItem::ItemIsMovable, | ||
377 | // false); | ||
378 | // } | ||
379 | // | ||
380 | return scene; | 368 | return scene; |
381 | } | 369 | } |
382 | 370 | ||
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp index ac2556b17f..9cc73ce1c7 100644 --- a/utils/themeeditor/models/parsetreenode.cpp +++ b/utils/themeeditor/models/parsetreenode.cpp | |||
@@ -31,6 +31,9 @@ | |||
31 | 31 | ||
32 | #include <iostream> | 32 | #include <iostream> |
33 | #include <cmath> | 33 | #include <cmath> |
34 | #include <cassert> | ||
35 | |||
36 | #include <QDebug> | ||
34 | 37 | ||
35 | int ParseTreeNode::openConditionals = 0; | 38 | int ParseTreeNode::openConditionals = 0; |
36 | bool ParseTreeNode::breakFlag = false; | 39 | bool ParseTreeNode::breakFlag = false; |
@@ -571,9 +574,12 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport, | |||
571 | else if(element->type == CONDITIONAL) | 574 | else if(element->type == CONDITIONAL) |
572 | { | 575 | { |
573 | int child = evalTag(info, true, element->children_count).toInt(); | 576 | int child = evalTag(info, true, element->children_count).toInt(); |
574 | if(child < children.count()) | 577 | int max = children.count() - element->params_count; |
578 | if(child < max) | ||
579 | { | ||
575 | children[element->params_count + child] | 580 | children[element->params_count + child] |
576 | ->render(info, viewport, true); | 581 | ->render(info, viewport, true); |
582 | } | ||
577 | } | 583 | } |
578 | else if(element->type == LINE_ALTERNATOR) | 584 | else if(element->type == LINE_ALTERNATOR) |
579 | { | 585 | { |
@@ -856,8 +862,6 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport) | |||
856 | int height = element->params[3].data.number; | 862 | int height = element->params[3].data.number; |
857 | QString action(element->params[4].data.text); | 863 | QString action(element->params[4].data.text); |
858 | RBTouchArea* temp = new RBTouchArea(width, height, action, info); | 864 | RBTouchArea* temp = new RBTouchArea(width, height, action, info); |
859 | x += viewport->x(); | ||
860 | y += viewport->y(); | ||
861 | temp->setPos(x, y); | 865 | temp->setPos(x, y); |
862 | return true; | 866 | return true; |
863 | } | 867 | } |
@@ -914,10 +918,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport) | |||
914 | case '\0': | 918 | case '\0': |
915 | /* %X */ | 919 | /* %X */ |
916 | filename = QString(element->params[0].data.text); | 920 | filename = QString(element->params[0].data.text); |
917 | if(info.sbsScreen() && info.screen()->parentItem()) | 921 | info.screen()->setBackdrop(filename); |
918 | info.sbsScreen()->setBackdrop(filename); | ||
919 | else | ||
920 | info.screen()->setBackdrop(filename); | ||
921 | return true; | 922 | return true; |
922 | } | 923 | } |
923 | 924 | ||