summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-26 05:51:07 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-26 05:51:07 +0000
commit5300c7014d602c57fcae7f6619f5138d83ba33c0 (patch)
tree2fff7d8ac48dfc7c3395c57c31efdc7b90707d61
parentc32728c91c2579688d3e7ffc4afbea1acf2385e0 (diff)
downloadrockbox-5300c7014d602c57fcae7f6619f5138d83ba33c0.tar.gz
rockbox-5300c7014d602c57fcae7f6619f5138d83ba33c0.zip
Theme Editor: Added Show Viewports option to device configuration panel, implemented simple rendering of info tags from device configuration
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27136 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/graphics/rbscreen.cpp22
-rw-r--r--utils/themeeditor/graphics/rbscreen.h3
-rw-r--r--utils/themeeditor/graphics/rbviewport.cpp5
-rw-r--r--utils/themeeditor/graphics/rbviewport.h1
-rw-r--r--utils/themeeditor/gui/skindocument.cpp4
-rw-r--r--utils/themeeditor/models/parsetreemodel.cpp8
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp7
-rw-r--r--utils/themeeditor/resources/deviceoptions3
8 files changed, 39 insertions, 14 deletions
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp
index da6d20bbe8..b93d3c88ad 100644
--- a/utils/themeeditor/graphics/rbscreen.cpp
+++ b/utils/themeeditor/graphics/rbscreen.cpp
@@ -26,17 +26,21 @@
26#include <QPainter> 26#include <QPainter>
27#include <QFile> 27#include <QFile>
28 28
29RBScreen::RBScreen(const RBRenderInfo& info, QGraphicsItem *parent) : 29RBScreen::RBScreen(const RBRenderInfo& info, bool remote,
30 QGraphicsItem(parent), backdrop(0), project(project) 30 QGraphicsItem *parent)
31 :QGraphicsItem(parent), backdrop(0), project(project)
31{ 32{
32 33
33 /* 34 if(remote)
34 width = info.settings()->value("#screenwidth", "300").toInt(); 35 {
35 height = info.settings()->value("#screenheight", "200").toInt(); 36 width = info.device()->data("remotewidth").toInt();
36*/ 37 height = info.device()->data("remoteheight").toInt();
37 38 }
38 width = info.device()->data("screenwidth").toInt(); 39 else
39 height = info.device()->data("screenheight").toInt(); 40 {
41 width = info.device()->data("screenwidth").toInt();
42 height = info.device()->data("screenheight").toInt();
43 }
40 44
41 QString bg = info.settings()->value("background color", "FFFFFF"); 45 QString bg = info.settings()->value("background color", "FFFFFF");
42 bgColor = stringToColor(bg, Qt::white); 46 bgColor = stringToColor(bg, Qt::white);
diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h
index 8b5f2f4a16..25f7c07bd9 100644
--- a/utils/themeeditor/graphics/rbscreen.h
+++ b/utils/themeeditor/graphics/rbscreen.h
@@ -35,7 +35,8 @@ class RBScreen : public QGraphicsItem
35{ 35{
36 36
37public: 37public:
38 RBScreen(const RBRenderInfo& info, QGraphicsItem *parent = 0); 38 RBScreen(const RBRenderInfo& info, bool remote = false,
39 QGraphicsItem *parent = 0);
39 virtual ~RBScreen(); 40 virtual ~RBScreen();
40 41
41 QPainterPath shape() const; 42 QPainterPath shape() const;
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp
index 03a7604804..8fa05a2fc7 100644
--- a/utils/themeeditor/graphics/rbviewport.cpp
+++ b/utils/themeeditor/graphics/rbviewport.cpp
@@ -105,7 +105,7 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info)
105 105
106 setPos(x, y); 106 setPos(x, y);
107 size = QRectF(0, 0, w, h); 107 size = QRectF(0, 0, w, h);
108 108 debug = info.device()->data("showviewports").toBool();
109 } 109 }
110} 110}
111 111
@@ -135,7 +135,8 @@ void RBViewport::paint(QPainter *painter,
135 135
136 painter->setBrush(Qt::NoBrush); 136 painter->setBrush(Qt::NoBrush);
137 painter->setPen(customUI ? Qt::blue : Qt::red); 137 painter->setPen(customUI ? Qt::blue : Qt::red);
138 painter->drawRect(size); 138 if(debug)
139 painter->drawRect(size);
139} 140}
140 141
141void RBViewport::newLine() 142void RBViewport::newLine()
diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h
index 1ee85f2fcd..c6f0c636c2 100644
--- a/utils/themeeditor/graphics/rbviewport.h
+++ b/utils/themeeditor/graphics/rbviewport.h
@@ -56,6 +56,7 @@ private:
56 QColor foreground; 56 QColor foreground;
57 QColor background; 57 QColor background;
58 58
59 bool debug;
59 bool customUI; 60 bool customUI;
60 QPoint textOffset; 61 QPoint textOffset;
61 int lineHeight; 62 int lineHeight;
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp
index 4f48d341fe..6863ff5a9d 100644
--- a/utils/themeeditor/gui/skindocument.cpp
+++ b/utils/themeeditor/gui/skindocument.cpp
@@ -288,6 +288,8 @@ void SkinDocument::save()
288 titleText = decompose.last(); 288 titleText = decompose.last();
289 emit titleChanged(titleText); 289 emit titleChanged(titleText);
290 290
291 scene();
292
291} 293}
292 294
293void SkinDocument::saveAs() 295void SkinDocument::saveAs()
@@ -320,6 +322,8 @@ void SkinDocument::saveAs()
320 titleText = decompose[decompose.count() - 1]; 322 titleText = decompose[decompose.count() - 1];
321 emit titleChanged(titleText); 323 emit titleChanged(titleText);
322 324
325 scene();
326
323} 327}
324 328
325QString SkinDocument::findSetting(QString key, QString fallback) 329QString SkinDocument::findSetting(QString key, QString fallback)
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp
index ff8a27c660..4f6fd451e6 100644
--- a/utils/themeeditor/models/parsetreemodel.cpp
+++ b/utils/themeeditor/models/parsetreemodel.cpp
@@ -295,6 +295,7 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project,
295 settings.insert("themebase", base.canonicalPath()); 295 settings.insert("themebase", base.canonicalPath());
296 } 296 }
297 297
298 bool remote = false;
298 if(file) 299 if(file)
299 { 300 {
300 QString skinFile = *file; 301 QString skinFile = *file;
@@ -303,13 +304,18 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project,
303 skinFile.chop(skinFile.length() - skinFile.lastIndexOf(".")); 304 skinFile.chop(skinFile.length() - skinFile.lastIndexOf("."));
304 settings.insert("imagepath", settings.value("themebase","") + "/wps/" + 305 settings.insert("imagepath", settings.value("themebase","") + "/wps/" +
305 skinFile); 306 skinFile);
307
308 decomp = file->split(".");
309 QString extension = decomp.last();
310 if(extension[0] == 'r')
311 remote = true;
306 } 312 }
307 313
308 RBScreen* screen = 0; 314 RBScreen* screen = 0;
309 RBRenderInfo info(this, project, &settings, device, screen); 315 RBRenderInfo info(this, project, &settings, device, screen);
310 316
311 /* Adding the screen */ 317 /* Adding the screen */
312 screen = new RBScreen(info); 318 screen = new RBScreen(info, remote);
313 scene->addItem(screen); 319 scene->addItem(screen);
314 320
315 info = RBRenderInfo(this, project, &settings, device, screen); 321 info = RBRenderInfo(this, project, &settings, device, screen);
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index 5e298be255..7b355687bb 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -524,6 +524,13 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
524 } 524 }
525 else if(element->type == TAG) 525 else if(element->type == TAG)
526 { 526 {
527
528 if(info.device()->data(QString(element->tag->name)).isValid())
529 viewport->write(info.device()->
530 data(QString(element->tag->name)).toString());
531
532 /* These are for special cases */
533
527 QString filename; 534 QString filename;
528 QString id; 535 QString id;
529 int x, y, tiles, tile; 536 int x, y, tiles, tile;
diff --git a/utils/themeeditor/resources/deviceoptions b/utils/themeeditor/resources/deviceoptions
index ddd5ed017f..855c8baaeb 100644
--- a/utils/themeeditor/resources/deviceoptions
+++ b/utils/themeeditor/resources/deviceoptions
@@ -27,11 +27,12 @@
27# performing much of any error checking on it: screwing up the syntax may very 27# performing much of any error checking on it: screwing up the syntax may very
28# well segfault the application on startup 28# well segfault the application on startup
29 29
30[Screen Sizes] 30[Rendering Info]
31screenwidth ; Screen Width ; spin(0,800) ; 300 31screenwidth ; Screen Width ; spin(0,800) ; 300
32screenheight ; Screen Height ; spin(0,800) ; 200 32screenheight ; Screen Height ; spin(0,800) ; 200
33remotewidth ; Remote Width ; spin(0,800) ; 100 33remotewidth ; Remote Width ; spin(0,800) ; 100
34remoteheight ; Remote Height ; spin(0,800); 50 34remoteheight ; Remote Height ; spin(0,800); 50
35showviewports ; Show Viewports ; check ; true
35 36
36[ID3 Info] 37[ID3 Info]
37ia ; Artist ; text ; Current Artist 38ia ; Artist ; text ; Current Artist