forked from len0rd/rockbox
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:
parent
c32728c91c
commit
5300c7014d
8 changed files with 39 additions and 14 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -56,6 +56,7 @@ private:
|
|||
QColor foreground;
|
||||
QColor background;
|
||||
|
||||
bool debug;
|
||||
bool customUI;
|
||||
QPoint textOffset;
|
||||
int lineHeight;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue