diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-08-12 05:30:31 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-08-12 05:30:31 +0000 |
commit | 56023426130d4b5fb932abc421dd8b6778d817c0 (patch) | |
tree | a1cea91722a3b9d994337c754c8ddf4899f7cc76 | |
parent | 209020ceb1403ff2d3d50c3a9cc82e9d35b885f5 (diff) | |
download | rockbox-56023426130d4b5fb932abc421dd8b6778d817c0.tar.gz rockbox-56023426130d4b5fb932abc421dd8b6778d817c0.zip |
Theme Editor: Added a warning console to the renderer, but haven't made any rendering classes use it yet
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27775 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/themeeditor/graphics/rbscene.cpp | 28 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscene.h | 26 | ||||
-rw-r--r-- | utils/themeeditor/gui/rbconsole.cpp | 41 | ||||
-rw-r--r-- | utils/themeeditor/gui/rbconsole.h | 43 | ||||
-rw-r--r-- | utils/themeeditor/gui/rbconsole.ui | 69 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/themeeditor.pro | 9 |
7 files changed, 212 insertions, 6 deletions
diff --git a/utils/themeeditor/graphics/rbscene.cpp b/utils/themeeditor/graphics/rbscene.cpp index 206f68f184..c80cb2357d 100644 --- a/utils/themeeditor/graphics/rbscene.cpp +++ b/utils/themeeditor/graphics/rbscene.cpp | |||
@@ -21,16 +21,38 @@ | |||
21 | 21 | ||
22 | #include <QGraphicsSceneMouseEvent> | 22 | #include <QGraphicsSceneMouseEvent> |
23 | #include <QGraphicsItem> | 23 | #include <QGraphicsItem> |
24 | 24 | #include <QGraphicsProxyWidget> | |
25 | #include <QDebug> | ||
26 | 25 | ||
27 | #include "rbscene.h" | 26 | #include "rbscene.h" |
27 | #include "rbconsole.h" | ||
28 | 28 | ||
29 | RBScene::RBScene(QObject* parent) | 29 | RBScene::RBScene(QObject* parent) |
30 | : QGraphicsScene(parent) | 30 | : QGraphicsScene(parent), consoleProxy(0), console(0) |
31 | { | 31 | { |
32 | } | 32 | } |
33 | 33 | ||
34 | RBScene::~RBScene() | 34 | RBScene::~RBScene() |
35 | { | 35 | { |
36 | if(console) | ||
37 | console->deleteLater(); | ||
38 | |||
39 | if(consoleProxy) | ||
40 | consoleProxy->deleteLater(); | ||
41 | } | ||
42 | |||
43 | void RBScene::clear() | ||
44 | { | ||
45 | QGraphicsScene::clear(); | ||
46 | |||
47 | console = new RBConsole(); | ||
48 | consoleProxy = addWidget(console); | ||
49 | consoleProxy->setZValue(1000); | ||
50 | consoleProxy->resize(screen.width(), screen.height()); | ||
51 | consoleProxy->hide(); | ||
52 | } | ||
53 | |||
54 | void RBScene::addWarning(QString warning) | ||
55 | { | ||
56 | console->addWarning(warning); | ||
57 | console->show(); | ||
36 | } | 58 | } |
diff --git a/utils/themeeditor/graphics/rbscene.h b/utils/themeeditor/graphics/rbscene.h index 4cb0dfc2a4..33c641dcb0 100644 --- a/utils/themeeditor/graphics/rbscene.h +++ b/utils/themeeditor/graphics/rbscene.h | |||
@@ -23,8 +23,10 @@ | |||
23 | #define RBSCENE_H | 23 | #define RBSCENE_H |
24 | 24 | ||
25 | #include <QGraphicsScene> | 25 | #include <QGraphicsScene> |
26 | #include <QGraphicsProxyWidget> | ||
26 | 27 | ||
27 | class RBScreen; | 28 | class RBScreen; |
29 | class RBConsole; | ||
28 | 30 | ||
29 | class RBScene : public QGraphicsScene | 31 | class RBScene : public QGraphicsScene |
30 | { | 32 | { |
@@ -36,8 +38,32 @@ public: | |||
36 | 38 | ||
37 | void moveMouse(QString position){ emit mouseMoved(position); } | 39 | void moveMouse(QString position){ emit mouseMoved(position); } |
38 | 40 | ||
41 | void setScreenSize(qreal w, qreal h) | ||
42 | { | ||
43 | screen = QRectF(0, 0, w, h); | ||
44 | if(consoleProxy) | ||
45 | consoleProxy->resize(screen.width(), screen.height()); | ||
46 | } | ||
47 | |||
48 | void setScreenSize(QRectF screen){ | ||
49 | this->screen = screen; | ||
50 | if(consoleProxy) | ||
51 | consoleProxy->resize(screen.width(), screen.height()); | ||
52 | } | ||
53 | |||
54 | void addWarning(QString warning); | ||
55 | |||
56 | public slots: | ||
57 | void clear(); | ||
58 | |||
39 | signals: | 59 | signals: |
40 | void mouseMoved(QString position); | 60 | void mouseMoved(QString position); |
61 | |||
62 | private: | ||
63 | QGraphicsProxyWidget* consoleProxy; | ||
64 | RBConsole* console; | ||
65 | |||
66 | QRectF screen; | ||
41 | }; | 67 | }; |
42 | 68 | ||
43 | #endif // RBSCENE_H | 69 | #endif // RBSCENE_H |
diff --git a/utils/themeeditor/gui/rbconsole.cpp b/utils/themeeditor/gui/rbconsole.cpp new file mode 100644 index 0000000000..51af64a812 --- /dev/null +++ b/utils/themeeditor/gui/rbconsole.cpp | |||
@@ -0,0 +1,41 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Robert Bieber | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "rbconsole.h" | ||
23 | #include "ui_rbconsole.h" | ||
24 | |||
25 | RBConsole::RBConsole(QWidget *parent) : | ||
26 | QWidget(parent), | ||
27 | ui(new Ui::RBConsole) | ||
28 | { | ||
29 | ui->setupUi(this); | ||
30 | } | ||
31 | |||
32 | RBConsole::~RBConsole() | ||
33 | { | ||
34 | delete ui; | ||
35 | } | ||
36 | |||
37 | void RBConsole::addWarning(QString warning) | ||
38 | { | ||
39 | ui->output->appendHtml("<span style = \"color:orange\">" + warning | ||
40 | + "</span>"); | ||
41 | } | ||
diff --git a/utils/themeeditor/gui/rbconsole.h b/utils/themeeditor/gui/rbconsole.h new file mode 100644 index 0000000000..b6f38cc56e --- /dev/null +++ b/utils/themeeditor/gui/rbconsole.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Robert Bieber | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef RBCONSOLE_H | ||
23 | #define RBCONSOLE_H | ||
24 | |||
25 | #include <QWidget> | ||
26 | |||
27 | namespace Ui { | ||
28 | class RBConsole; | ||
29 | } | ||
30 | |||
31 | class RBConsole : public QWidget { | ||
32 | Q_OBJECT | ||
33 | public: | ||
34 | RBConsole(QWidget *parent = 0); | ||
35 | ~RBConsole(); | ||
36 | |||
37 | void addWarning(QString warning); | ||
38 | |||
39 | private: | ||
40 | Ui::RBConsole *ui; | ||
41 | }; | ||
42 | |||
43 | #endif // RBCONSOLE_H | ||
diff --git a/utils/themeeditor/gui/rbconsole.ui b/utils/themeeditor/gui/rbconsole.ui new file mode 100644 index 0000000000..c3f9ff179d --- /dev/null +++ b/utils/themeeditor/gui/rbconsole.ui | |||
@@ -0,0 +1,69 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ui version="4.0"> | ||
3 | <class>RBConsole</class> | ||
4 | <widget class="QWidget" name="RBConsole"> | ||
5 | <property name="geometry"> | ||
6 | <rect> | ||
7 | <x>0</x> | ||
8 | <y>0</y> | ||
9 | <width>300</width> | ||
10 | <height>200</height> | ||
11 | </rect> | ||
12 | </property> | ||
13 | <property name="windowTitle"> | ||
14 | <string>Form</string> | ||
15 | </property> | ||
16 | <layout class="QVBoxLayout" name="verticalLayout"> | ||
17 | <item> | ||
18 | <widget class="QPlainTextEdit" name="output"> | ||
19 | <property name="readOnly"> | ||
20 | <bool>true</bool> | ||
21 | </property> | ||
22 | </widget> | ||
23 | </item> | ||
24 | <item> | ||
25 | <layout class="QHBoxLayout" name="horizontalLayout"> | ||
26 | <item> | ||
27 | <spacer name="horizontalSpacer"> | ||
28 | <property name="orientation"> | ||
29 | <enum>Qt::Horizontal</enum> | ||
30 | </property> | ||
31 | <property name="sizeHint" stdset="0"> | ||
32 | <size> | ||
33 | <width>40</width> | ||
34 | <height>20</height> | ||
35 | </size> | ||
36 | </property> | ||
37 | </spacer> | ||
38 | </item> | ||
39 | <item> | ||
40 | <widget class="QPushButton" name="okayButton"> | ||
41 | <property name="text"> | ||
42 | <string>Okay</string> | ||
43 | </property> | ||
44 | </widget> | ||
45 | </item> | ||
46 | </layout> | ||
47 | </item> | ||
48 | </layout> | ||
49 | </widget> | ||
50 | <resources/> | ||
51 | <connections> | ||
52 | <connection> | ||
53 | <sender>okayButton</sender> | ||
54 | <signal>clicked()</signal> | ||
55 | <receiver>RBConsole</receiver> | ||
56 | <slot>close()</slot> | ||
57 | <hints> | ||
58 | <hint type="sourcelabel"> | ||
59 | <x>247</x> | ||
60 | <y>176</y> | ||
61 | </hint> | ||
62 | <hint type="destinationlabel"> | ||
63 | <x>149</x> | ||
64 | <y>99</y> | ||
65 | </hint> | ||
66 | </hints> | ||
67 | </connection> | ||
68 | </connections> | ||
69 | </ui> | ||
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index a7f46acd5f..e456797a4d 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp | |||
@@ -358,6 +358,8 @@ RBScene* ParseTreeModel::render(ProjectModel* project, | |||
358 | scene->addItem(screen); | 358 | scene->addItem(screen); |
359 | } | 359 | } |
360 | 360 | ||
361 | scene->setScreenSize(screen->boundingRect()); | ||
362 | |||
361 | info = RBRenderInfo(this, project, doc, &settings, device, screen); | 363 | info = RBRenderInfo(this, project, doc, &settings, device, screen); |
362 | 364 | ||
363 | 365 | ||
diff --git a/utils/themeeditor/themeeditor.pro b/utils/themeeditor/themeeditor.pro index 0cecd2d96b..b8d1dd3523 100644 --- a/utils/themeeditor/themeeditor.pro +++ b/utils/themeeditor/themeeditor.pro | |||
@@ -108,7 +108,8 @@ HEADERS += models/parsetreemodel.h \ | |||
108 | gui/targetdownloader.h \ | 108 | gui/targetdownloader.h \ |
109 | gui/syntaxcompleter.h \ | 109 | gui/syntaxcompleter.h \ |
110 | graphics/rbmovable.h \ | 110 | graphics/rbmovable.h \ |
111 | graphics/rbscene.h | 111 | graphics/rbscene.h \ |
112 | gui/rbconsole.h | ||
112 | SOURCES += main.cpp \ | 113 | SOURCES += main.cpp \ |
113 | models/parsetreemodel.cpp \ | 114 | models/parsetreemodel.cpp \ |
114 | models/parsetreenode.cpp \ | 115 | models/parsetreenode.cpp \ |
@@ -151,7 +152,8 @@ SOURCES += main.cpp \ | |||
151 | gui/targetdownloader.cpp \ | 152 | gui/targetdownloader.cpp \ |
152 | gui/syntaxcompleter.cpp \ | 153 | gui/syntaxcompleter.cpp \ |
153 | graphics/rbmovable.cpp \ | 154 | graphics/rbmovable.cpp \ |
154 | graphics/rbscene.cpp | 155 | graphics/rbscene.cpp \ |
156 | gui/rbconsole.cpp | ||
155 | OTHER_FILES += README \ | 157 | OTHER_FILES += README \ |
156 | resources/windowicon.png \ | 158 | resources/windowicon.png \ |
157 | resources/appicon.xcf \ | 159 | resources/appicon.xcf \ |
@@ -196,7 +198,8 @@ FORMS += gui/editorwindow.ui \ | |||
196 | qtfindreplacedialog/findreplaceform.ui \ | 198 | qtfindreplacedialog/findreplaceform.ui \ |
197 | qtfindreplacedialog/findreplacedialog.ui \ | 199 | qtfindreplacedialog/findreplacedialog.ui \ |
198 | gui/projectexporter.ui \ | 200 | gui/projectexporter.ui \ |
199 | gui/targetdownloader.ui | 201 | gui/targetdownloader.ui \ |
202 | gui/rbconsole.ui | ||
200 | RESOURCES += resources.qrc | 203 | RESOURCES += resources.qrc |
201 | win32:RC_FILE = themeeditor.rc | 204 | win32:RC_FILE = themeeditor.rc |
202 | macx { | 205 | macx { |