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
This commit is contained in:
Robert Bieber 2010-06-26 05:51:07 +00:00
parent c32728c91c
commit 5300c7014d
8 changed files with 39 additions and 14 deletions

View file

@ -26,17 +26,21 @@
#include <QPainter> #include <QPainter>
#include <QFile> #include <QFile>
RBScreen::RBScreen(const RBRenderInfo& info, QGraphicsItem *parent) : RBScreen::RBScreen(const RBRenderInfo& info, bool remote,
QGraphicsItem(parent), backdrop(0), project(project) QGraphicsItem *parent)
:QGraphicsItem(parent), backdrop(0), project(project)
{ {
/* if(remote)
width = info.settings()->value("#screenwidth", "300").toInt(); {
height = info.settings()->value("#screenheight", "200").toInt(); width = info.device()->data("remotewidth").toInt();
*/ height = info.device()->data("remoteheight").toInt();
}
width = info.device()->data("screenwidth").toInt(); else
height = info.device()->data("screenheight").toInt(); {
width = info.device()->data("screenwidth").toInt();
height = info.device()->data("screenheight").toInt();
}
QString bg = info.settings()->value("background color", "FFFFFF"); QString bg = info.settings()->value("background color", "FFFFFF");
bgColor = stringToColor(bg, Qt::white); bgColor = stringToColor(bg, Qt::white);

View file

@ -35,7 +35,8 @@ class RBScreen : public QGraphicsItem
{ {
public: public:
RBScreen(const RBRenderInfo& info, QGraphicsItem *parent = 0); RBScreen(const RBRenderInfo& info, bool remote = false,
QGraphicsItem *parent = 0);
virtual ~RBScreen(); virtual ~RBScreen();
QPainterPath shape() const; QPainterPath shape() const;

View file

@ -105,7 +105,7 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info)
setPos(x, y); setPos(x, y);
size = QRectF(0, 0, w, h); 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->setBrush(Qt::NoBrush);
painter->setPen(customUI ? Qt::blue : Qt::red); painter->setPen(customUI ? Qt::blue : Qt::red);
painter->drawRect(size); if(debug)
painter->drawRect(size);
} }
void RBViewport::newLine() void RBViewport::newLine()

View file

@ -56,6 +56,7 @@ private:
QColor foreground; QColor foreground;
QColor background; QColor background;
bool debug;
bool customUI; bool customUI;
QPoint textOffset; QPoint textOffset;
int lineHeight; int lineHeight;

View file

@ -288,6 +288,8 @@ void SkinDocument::save()
titleText = decompose.last(); titleText = decompose.last();
emit titleChanged(titleText); emit titleChanged(titleText);
scene();
} }
void SkinDocument::saveAs() void SkinDocument::saveAs()
@ -320,6 +322,8 @@ void SkinDocument::saveAs()
titleText = decompose[decompose.count() - 1]; titleText = decompose[decompose.count() - 1];
emit titleChanged(titleText); emit titleChanged(titleText);
scene();
} }
QString SkinDocument::findSetting(QString key, QString fallback) QString SkinDocument::findSetting(QString key, QString fallback)

View file

@ -295,6 +295,7 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project,
settings.insert("themebase", base.canonicalPath()); settings.insert("themebase", base.canonicalPath());
} }
bool remote = false;
if(file) if(file)
{ {
QString skinFile = *file; QString skinFile = *file;
@ -303,13 +304,18 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project,
skinFile.chop(skinFile.length() - skinFile.lastIndexOf(".")); skinFile.chop(skinFile.length() - skinFile.lastIndexOf("."));
settings.insert("imagepath", settings.value("themebase","") + "/wps/" + settings.insert("imagepath", settings.value("themebase","") + "/wps/" +
skinFile); skinFile);
decomp = file->split(".");
QString extension = decomp.last();
if(extension[0] == 'r')
remote = true;
} }
RBScreen* screen = 0; RBScreen* screen = 0;
RBRenderInfo info(this, project, &settings, device, screen); RBRenderInfo info(this, project, &settings, device, screen);
/* Adding the screen */ /* Adding the screen */
screen = new RBScreen(info); screen = new RBScreen(info, remote);
scene->addItem(screen); scene->addItem(screen);
info = RBRenderInfo(this, project, &settings, device, screen); info = RBRenderInfo(this, project, &settings, device, screen);

View file

@ -524,6 +524,13 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
} }
else if(element->type == TAG) 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 filename;
QString id; QString id;
int x, y, tiles, tile; int x, y, tiles, tile;

View file

@ -27,11 +27,12 @@
# performing much of any error checking on it: screwing up the syntax may very # performing much of any error checking on it: screwing up the syntax may very
# well segfault the application on startup # well segfault the application on startup
[Screen Sizes] [Rendering Info]
screenwidth ; Screen Width ; spin(0,800) ; 300 screenwidth ; Screen Width ; spin(0,800) ; 300
screenheight ; Screen Height ; spin(0,800) ; 200 screenheight ; Screen Height ; spin(0,800) ; 200
remotewidth ; Remote Width ; spin(0,800) ; 100 remotewidth ; Remote Width ; spin(0,800) ; 100
remoteheight ; Remote Height ; spin(0,800); 50 remoteheight ; Remote Height ; spin(0,800); 50
showviewports ; Show Viewports ; check ; true
[ID3 Info] [ID3 Info]
ia ; Artist ; text ; Current Artist ia ; Artist ; text ; Current Artist