summaryrefslogtreecommitdiff
path: root/utils
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 /utils
parentc32728c91c2579688d3e7ffc4afbea1acf2385e0 (diff)
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
Diffstat (limited to 'utils')
-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 @@
#include <QPainter>
#include <QFile>
-RBScreen::RBScreen(const RBRenderInfo& info, QGraphicsItem *parent) :
- QGraphicsItem(parent), backdrop(0), project(project)
+RBScreen::RBScreen(const RBRenderInfo& info, bool remote,
+ QGraphicsItem *parent)
+ :QGraphicsItem(parent), backdrop(0), project(project)
{
- /*
- width = info.settings()->value("#screenwidth", "300").toInt();
- height = info.settings()->value("#screenheight", "200").toInt();
-*/
-
- width = info.device()->data("screenwidth").toInt();
- height = info.device()->data("screenheight").toInt();
+ if(remote)
+ {
+ width = info.device()->data("remotewidth").toInt();
+ height = info.device()->data("remoteheight").toInt();
+ }
+ else
+ {
+ width = info.device()->data("screenwidth").toInt();
+ height = info.device()->data("screenheight").toInt();
+ }
QString bg = info.settings()->value("background color", "FFFFFF");
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
{
public:
- RBScreen(const RBRenderInfo& info, QGraphicsItem *parent = 0);
+ RBScreen(const RBRenderInfo& info, bool remote = false,
+ QGraphicsItem *parent = 0);
virtual ~RBScreen();
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)
setPos(x, y);
size = QRectF(0, 0, w, h);
-
+ debug = info.device()->data("showviewports").toBool();
}
}
@@ -135,7 +135,8 @@ void RBViewport::paint(QPainter *painter,
painter->setBrush(Qt::NoBrush);
painter->setPen(customUI ? Qt::blue : Qt::red);
- painter->drawRect(size);
+ if(debug)
+ painter->drawRect(size);
}
void 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:
QColor foreground;
QColor background;
+ bool debug;
bool customUI;
QPoint textOffset;
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()
titleText = decompose.last();
emit titleChanged(titleText);
+ scene();
+
}
void SkinDocument::saveAs()
@@ -320,6 +322,8 @@ void SkinDocument::saveAs()
titleText = decompose[decompose.count() - 1];
emit titleChanged(titleText);
+ scene();
+
}
QString 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,
settings.insert("themebase", base.canonicalPath());
}
+ bool remote = false;
if(file)
{
QString skinFile = *file;
@@ -303,13 +304,18 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project,
skinFile.chop(skinFile.length() - skinFile.lastIndexOf("."));
settings.insert("imagepath", settings.value("themebase","") + "/wps/" +
skinFile);
+
+ decomp = file->split(".");
+ QString extension = decomp.last();
+ if(extension[0] == 'r')
+ remote = true;
}
RBScreen* screen = 0;
RBRenderInfo info(this, project, &settings, device, screen);
/* Adding the screen */
- screen = new RBScreen(info);
+ screen = new RBScreen(info, remote);
scene->addItem(screen);
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)
}
else if(element->type == TAG)
{
+
+ if(info.device()->data(QString(element->tag->name)).isValid())
+ viewport->write(info.device()->
+ data(QString(element->tag->name)).toString());
+
+ /* These are for special cases */
+
QString filename;
QString id;
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 @@
# performing much of any error checking on it: screwing up the syntax may very
# well segfault the application on startup
-[Screen Sizes]
+[Rendering Info]
screenwidth ; Screen Width ; spin(0,800) ; 300
screenheight ; Screen Height ; spin(0,800) ; 200
remotewidth ; Remote Width ; spin(0,800) ; 100
remoteheight ; Remote Height ; spin(0,800); 50
+showviewports ; Show Viewports ; check ; true
[ID3 Info]
ia ; Artist ; text ; Current Artist