From 35150b6dcb18089ba76a660e6b73caf1dad86579 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Wed, 30 Jun 2010 21:28:11 +0000 Subject: [PATCH] Theme Editor: Implemented status bar enable/disable git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27200 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/graphics/rbscreen.cpp | 6 +++++- utils/themeeditor/graphics/rbscreen.h | 5 +++++ utils/themeeditor/graphics/rbviewport.cpp | 6 +++++- utils/themeeditor/graphics/rbviewport.h | 5 +++++ utils/themeeditor/models/parsetreenode.cpp | 19 ++++++++++++++++++ utils/themeeditor/resources.qrc | 1 + .../resources/render/statusbar.png | Bin 0 -> 242 bytes utils/themeeditor/themeeditor.pro | 4 +++- 8 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 utils/themeeditor/resources/render/statusbar.png diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index 924a37406e..cb69afd906 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp @@ -29,7 +29,8 @@ RBScreen::RBScreen(const RBRenderInfo& info, bool remote, QGraphicsItem *parent) :QGraphicsItem(parent), backdrop(0), project(project), - albumArt(0) + albumArt(0), defaultStatusBar(true), + statusBarTexture(":/render/statusbar.png") { if(remote) @@ -116,6 +117,9 @@ void RBScreen::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, { painter->fillRect(0, 0, width, height, bgColor); } + + if(defaultStatusBar) + painter->fillRect(QRectF(0, 0, width, 8), statusBarTexture); } void RBScreen::loadViewport(QString name, RBViewport *view) diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h index 358a49e4a7..58788d463b 100644 --- a/utils/themeeditor/graphics/rbscreen.h +++ b/utils/themeeditor/graphics/rbscreen.h @@ -83,6 +83,8 @@ public: } } + void disableStatusBar(){ defaultStatusBar = false; } + void enableStatusBar(){ defaultStatusBar = true; } private: int width; @@ -102,6 +104,9 @@ private: RBAlbumArt* albumArt; + bool defaultStatusBar; + QPixmap statusBarTexture; + }; #endif // RBSCREEN_H diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index 22b2ada158..4b85a30661 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp @@ -33,7 +33,8 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) : QGraphicsItem(info.screen()), font(info.screen()->getFont(0)), foreground(info.screen()->foreground()), background(info.screen()->background()), textOffset(0,0), - screen(info.screen()), textAlign(Left) + screen(info.screen()), textAlign(Left), showStatusBar(false), + statusBarTexture(":/render/statusbar.png") { if(!node->tag) { @@ -140,6 +141,9 @@ void RBViewport::paint(QPainter *painter, painter->setPen(customUI ? Qt::blue : Qt::red); if(debug) painter->drawRect(size); + + if(showStatusBar) + painter->fillRect(QRectF(0, 0, size.width(), 8), statusBarTexture); } void RBViewport::newLine() diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h index 1d65eb8d56..2aff315873 100644 --- a/utils/themeeditor/graphics/rbviewport.h +++ b/utils/themeeditor/graphics/rbviewport.h @@ -57,6 +57,8 @@ public: void write(QString text); void alignText(Alignment align){ textAlign = align; } + void enableStatusBar(){ showStatusBar = true; } + private: void alignLeft(); @@ -79,6 +81,9 @@ private: QList centerText; QList rightText; Alignment textAlign; + + bool showStatusBar; + QPixmap statusBarTexture; }; #endif // RBVIEWPORT_H diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp index 3b334a6f99..300d5195de 100644 --- a/utils/themeeditor/models/parsetreenode.cpp +++ b/utils/themeeditor/models/parsetreenode.cpp @@ -611,6 +611,25 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport) return false; + case 'w': + switch(element->tag->name[1]) + { + case 'd': + info.screen()->disableStatusBar(); + return true; + + case 'e': + info.screen()->enableStatusBar(); + return true; + + case 'i': + info.screen()->disableStatusBar(); + viewport->enableStatusBar(); + return true; + } + + return false; + case 'x': switch(element->tag->name[1]) { diff --git a/utils/themeeditor/resources.qrc b/utils/themeeditor/resources.qrc index a1c545bbb1..ad892d7853 100644 --- a/utils/themeeditor/resources.qrc +++ b/utils/themeeditor/resources.qrc @@ -13,5 +13,6 @@ resources/render/scenebg.png resources/render/albumart.png + resources/render/statusbar.png diff --git a/utils/themeeditor/resources/render/statusbar.png b/utils/themeeditor/resources/render/statusbar.png new file mode 100644 index 0000000000000000000000000000000000000000..06307b7d283aeb167938156dcaab455a6b509352 GIT binary patch literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1SGw4HSYi^#^NA%Cx&(BWL^R}Y)RhkE$yFKd<_Z$EXTE9_~v|+pZ1}^ z`%k-W=iaNAG!zeP+id(}LXAh(wE5wa7!Szl|I1y?{Kl?-A|sp6&FNAzuX-OB^USSE aDv1L+Mm-}bjp-WDU