Theme Editor: Added Show Viewports option to device configuration panel, implemented...
authorbieber <bieber@a1c6a512-1295-4272-9138-f99709370657>
Sat, 26 Jun 2010 05:51:07 +0000 (26 05:51 +0000)
committerbieber <bieber@a1c6a512-1295-4272-9138-f99709370657>
Sat, 26 Jun 2010 05:51:07 +0000 (26 05:51 +0000)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27136 a1c6a512-1295-4272-9138-f99709370657

utils/themeeditor/graphics/rbscreen.cpp
utils/themeeditor/graphics/rbscreen.h
utils/themeeditor/graphics/rbviewport.cpp
utils/themeeditor/graphics/rbviewport.h
utils/themeeditor/gui/skindocument.cpp
utils/themeeditor/models/parsetreemodel.cpp
utils/themeeditor/models/parsetreenode.cpp
utils/themeeditor/resources/deviceoptions

index da6d20b..b93d3c8 100644 (file)
 #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);
index 8b5f2f4..25f7c07 100644 (file)
@@ -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;
index 03a7604..8fa05a2 100644 (file)
@@ -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()
index 1ee85f2..c6f0c63 100644 (file)
@@ -56,6 +56,7 @@ private:
     QColor foreground;
     QColor background;
 
+    bool debug;
     bool customUI;
     QPoint textOffset;
     int lineHeight;
index 4f48d34..6863ff5 100644 (file)
@@ -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)
index ff8a27c..4f6fd45 100644 (file)
@@ -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);
index 5e298be..7b35568 100644 (file)
@@ -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;
index ddd5ed0..855c8ba 100644 (file)
 # 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