diff options
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.cpp | 37 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.h | 6 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.cpp | 10 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.cpp | 42 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/resources/deviceoptions | 1 |
6 files changed, 88 insertions, 10 deletions
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index 054e8fee37..c212a6c1fc 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp | |||
@@ -29,18 +29,18 @@ | |||
29 | RBScreen::RBScreen(const RBRenderInfo& info, bool remote, | 29 | RBScreen::RBScreen(const RBRenderInfo& info, bool remote, |
30 | QGraphicsItem *parent) | 30 | QGraphicsItem *parent) |
31 | :QGraphicsItem(parent), backdrop(0), project(project), | 31 | :QGraphicsItem(parent), backdrop(0), project(project), |
32 | albumArt(0) | 32 | albumArt(0), customUI(0) |
33 | { | 33 | { |
34 | 34 | ||
35 | if(remote) | 35 | if(remote) |
36 | { | 36 | { |
37 | width = info.device()->data("remotewidth").toInt(); | 37 | fullWidth = info.device()->data("remotewidth").toInt(); |
38 | height = info.device()->data("remoteheight").toInt(); | 38 | fullHeight = info.device()->data("remoteheight").toInt(); |
39 | } | 39 | } |
40 | else | 40 | else |
41 | { | 41 | { |
42 | width = info.device()->data("screenwidth").toInt(); | 42 | fullWidth = info.device()->data("screenwidth").toInt(); |
43 | height = info.device()->data("screenheight").toInt(); | 43 | fullHeight = info.device()->data("screenheight").toInt(); |
44 | } | 44 | } |
45 | 45 | ||
46 | QString bg = info.settings()->value("background color", "FFFFFF"); | 46 | QString bg = info.settings()->value("background color", "FFFFFF"); |
@@ -63,8 +63,8 @@ RBScreen::RBScreen(const RBRenderInfo& info, bool remote, | |||
63 | /* If a backdrop has been found, use its width and height */ | 63 | /* If a backdrop has been found, use its width and height */ |
64 | if(!backdrop->isNull()) | 64 | if(!backdrop->isNull()) |
65 | { | 65 | { |
66 | width = backdrop->width(); | 66 | fullWidth = backdrop->width(); |
67 | height = backdrop->height(); | 67 | fullHeight = backdrop->height(); |
68 | } | 68 | } |
69 | else | 69 | else |
70 | { | 70 | { |
@@ -74,6 +74,17 @@ RBScreen::RBScreen(const RBRenderInfo& info, bool remote, | |||
74 | } | 74 | } |
75 | 75 | ||
76 | fonts.insert(0, new RBFont("Nothin'")); | 76 | fonts.insert(0, new RBFont("Nothin'")); |
77 | |||
78 | if(parent == 0) | ||
79 | { | ||
80 | width = fullWidth; | ||
81 | height = fullHeight; | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | width = parent->boundingRect().width(); | ||
86 | height = parent->boundingRect().height(); | ||
87 | } | ||
77 | } | 88 | } |
78 | 89 | ||
79 | RBScreen::~RBScreen() | 90 | RBScreen::~RBScreen() |
@@ -108,6 +119,9 @@ QRectF RBScreen::boundingRect() const | |||
108 | void RBScreen::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, | 119 | void RBScreen::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
109 | QWidget *widget) | 120 | QWidget *widget) |
110 | { | 121 | { |
122 | if(parentItem() != 0) | ||
123 | return; | ||
124 | |||
111 | if(backdrop) | 125 | if(backdrop) |
112 | { | 126 | { |
113 | painter->drawPixmap(0, 0, width, height, *backdrop); | 127 | painter->drawPixmap(0, 0, width, height, *backdrop); |
@@ -191,9 +205,18 @@ void RBScreen::makeCustomUI(QString id) | |||
191 | namedViewports.value(id)->at(i)->makeCustomUI(); | 205 | namedViewports.value(id)->at(i)->makeCustomUI(); |
192 | for(int i = 0; i < namedViewports.value(id)->count(); i++) | 206 | for(int i = 0; i < namedViewports.value(id)->count(); i++) |
193 | namedViewports.value(id)->at(i)->show(); | 207 | namedViewports.value(id)->at(i)->show(); |
208 | |||
209 | customUI = namedViewports.value(id)->at(0); | ||
194 | } | 210 | } |
195 | } | 211 | } |
196 | 212 | ||
213 | void RBScreen::breakSBS() | ||
214 | { | ||
215 | width = fullWidth; | ||
216 | height = fullHeight; | ||
217 | setParentItem(0); | ||
218 | } | ||
219 | |||
197 | QColor RBScreen::stringToColor(QString str, QColor fallback) | 220 | QColor RBScreen::stringToColor(QString str, QColor fallback) |
198 | { | 221 | { |
199 | 222 | ||
diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h index b472e8eae4..5bb8ab1602 100644 --- a/utils/themeeditor/graphics/rbscreen.h +++ b/utils/themeeditor/graphics/rbscreen.h | |||
@@ -67,6 +67,8 @@ public: | |||
67 | void setBackdrop(QString filename); | 67 | void setBackdrop(QString filename); |
68 | bool hasBackdrop(){ return backdrop != 0; } | 68 | bool hasBackdrop(){ return backdrop != 0; } |
69 | void makeCustomUI(QString id); | 69 | void makeCustomUI(QString id); |
70 | void setCustomUI(RBViewport* viewport){ customUI = viewport; } | ||
71 | RBViewport* getCustomUI(){ return customUI; } | ||
70 | 72 | ||
71 | static QColor stringToColor(QString str, QColor fallback); | 73 | static QColor stringToColor(QString str, QColor fallback); |
72 | 74 | ||
@@ -84,10 +86,13 @@ public: | |||
84 | } | 86 | } |
85 | } | 87 | } |
86 | 88 | ||
89 | void breakSBS(); | ||
87 | 90 | ||
88 | private: | 91 | private: |
89 | int width; | 92 | int width; |
90 | int height; | 93 | int height; |
94 | int fullWidth; | ||
95 | int fullHeight; | ||
91 | QColor bgColor; | 96 | QColor bgColor; |
92 | QColor fgColor; | 97 | QColor fgColor; |
93 | QPixmap* backdrop; | 98 | QPixmap* backdrop; |
@@ -102,6 +107,7 @@ private: | |||
102 | QList<QString> displayedViewports; | 107 | QList<QString> displayedViewports; |
103 | 108 | ||
104 | RBAlbumArt* albumArt; | 109 | RBAlbumArt* albumArt; |
110 | RBViewport* customUI; | ||
105 | }; | 111 | }; |
106 | 112 | ||
107 | #endif // RBSCREEN_H | 113 | #endif // RBSCREEN_H |
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index b620e1b554..a92825362d 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp | |||
@@ -113,12 +113,22 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
113 | if(h < 0) | 113 | if(h < 0) |
114 | h = info.screen()->getHeight() + h - y; | 114 | h = info.screen()->getHeight() + h - y; |
115 | 115 | ||
116 | /* Adjusting to screen coordinates if necessary */ | ||
117 | if(screen->parentItem() != 0) | ||
118 | { | ||
119 | x -= screen->parentItem()->pos().x(); | ||
120 | y -= screen->parentItem()->pos().y(); | ||
121 | } | ||
122 | |||
123 | |||
116 | setPos(x, y); | 124 | setPos(x, y); |
117 | size = QRectF(0, 0, w, h); | 125 | size = QRectF(0, 0, w, h); |
118 | } | 126 | } |
119 | 127 | ||
120 | debug = info.device()->data("showviewports").toBool(); | 128 | debug = info.device()->data("showviewports").toBool(); |
121 | lineHeight = font->lineHeight(); | 129 | lineHeight = font->lineHeight(); |
130 | if(customUI) | ||
131 | screen->setCustomUI(this); | ||
122 | } | 132 | } |
123 | 133 | ||
124 | RBViewport::~RBViewport() | 134 | RBViewport::~RBViewport() |
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index ccae865290..47b24174b7 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp | |||
@@ -290,7 +290,9 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | |||
290 | settings.insert("themebase", base.canonicalPath()); | 290 | settings.insert("themebase", base.canonicalPath()); |
291 | } | 291 | } |
292 | 292 | ||
293 | /* Finding imagebase and determining remote/wps status */ | ||
293 | bool remote = false; | 294 | bool remote = false; |
295 | bool wps = false; | ||
294 | if(file) | 296 | if(file) |
295 | { | 297 | { |
296 | QString skinFile = *file; | 298 | QString skinFile = *file; |
@@ -304,14 +306,50 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | |||
304 | QString extension = decomp.last(); | 306 | QString extension = decomp.last(); |
305 | if(extension[0] == 'r') | 307 | if(extension[0] == 'r') |
306 | remote = true; | 308 | remote = true; |
309 | if(extension.right(3) == "wps") | ||
310 | wps = true; | ||
311 | } | ||
312 | |||
313 | /* Rendering SBS, if necessary */ | ||
314 | RBScreen* sbsScreen = 0; | ||
315 | if(wps && device->data("rendersbs").toBool()) | ||
316 | { | ||
317 | QString sbsFile = settings.value(remote ? "rsbs" : "sbs", ""); | ||
318 | sbsFile.replace("/.rockbox" , settings.value("themebase","")); | ||
319 | |||
320 | if(QFile::exists(sbsFile)) | ||
321 | { | ||
322 | QFile sbs(sbsFile); | ||
323 | sbs.open(QFile::ReadOnly | QFile::Text); | ||
324 | ParseTreeModel sbsModel(QString(sbs.readAll()).toAscii()); | ||
325 | |||
326 | if(sbsModel.root != 0) | ||
327 | { | ||
328 | RBRenderInfo sbsInfo(&sbsModel, project, &settings, device, | ||
329 | sbsScreen); | ||
330 | |||
331 | sbsScreen = new RBScreen(sbsInfo, remote); | ||
332 | scene->addItem(sbsScreen); | ||
333 | |||
334 | sbsInfo = RBRenderInfo(&sbsModel, project, &settings, device, | ||
335 | sbsScreen); | ||
336 | sbsModel.root->render(sbsInfo); | ||
337 | } | ||
338 | |||
339 | } | ||
307 | } | 340 | } |
308 | 341 | ||
309 | RBScreen* screen = 0; | 342 | RBScreen* screen = 0; |
310 | RBRenderInfo info(this, project, &settings, device, screen); | 343 | RBRenderInfo info(this, project, &settings, device, screen); |
311 | 344 | ||
312 | /* Adding the screen */ | 345 | /* Adding the screen */ |
313 | screen = new RBScreen(info, remote); | 346 | if(sbsScreen) |
314 | scene->addItem(screen); | 347 | screen = new RBScreen(info, remote, sbsScreen->getCustomUI()); |
348 | else | ||
349 | screen = new RBScreen(info, remote); | ||
350 | |||
351 | if(!sbsScreen) | ||
352 | scene->addItem(screen); | ||
315 | 353 | ||
316 | info = RBRenderInfo(this, project, &settings, device, screen); | 354 | info = RBRenderInfo(this, project, &settings, device, screen); |
317 | 355 | ||
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp index f1ee3b27ca..ae83f1aadf 100644 --- a/utils/themeeditor/models/parsetreenode.cpp +++ b/utils/themeeditor/models/parsetreenode.cpp | |||
@@ -629,7 +629,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport) | |||
629 | { | 629 | { |
630 | case 'd': | 630 | case 'd': |
631 | /* %wd */ | 631 | /* %wd */ |
632 | /* Disable SBS rendering */ | 632 | info.screen()->breakSBS(); |
633 | return true; | 633 | return true; |
634 | 634 | ||
635 | case 'e': | 635 | case 'e': |
diff --git a/utils/themeeditor/resources/deviceoptions b/utils/themeeditor/resources/deviceoptions index 10a1a89d75..d7dddb4c13 100644 --- a/utils/themeeditor/resources/deviceoptions +++ b/utils/themeeditor/resources/deviceoptions | |||
@@ -36,6 +36,7 @@ screenheight ; Screen Height ; spin(0,800) ; 200 | |||
36 | remotewidth ; Remote Width ; spin(0,800) ; 100 | 36 | remotewidth ; Remote Width ; spin(0,800) ; 100 |
37 | remoteheight ; Remote Height ; spin(0,800); 50 | 37 | remoteheight ; Remote Height ; spin(0,800); 50 |
38 | showviewports ; Show Viewports ; check ; false | 38 | showviewports ; Show Viewports ; check ; false |
39 | rendersbs ; Render SBS If Available ; check ; true | ||
39 | 40 | ||
40 | [ID3 Info] | 41 | [ID3 Info] |
41 | ia ; Artist ; text ; Current Artist | 42 | ia ; Artist ; text ; Current Artist |