diff options
Diffstat (limited to 'utils/themeeditor')
-rw-r--r-- | utils/themeeditor/graphics/rbrenderinfo.cpp | 7 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbrenderinfo.h | 6 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.cpp | 6 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.h | 4 | ||||
-rw-r--r-- | utils/themeeditor/gui/configdocument.h | 1 | ||||
-rw-r--r-- | utils/themeeditor/gui/devicestate.cpp | 41 | ||||
-rw-r--r-- | utils/themeeditor/gui/devicestate.h | 1 | ||||
-rw-r--r-- | utils/themeeditor/gui/editorwindow.cpp | 12 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.cpp | 16 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.h | 9 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.cpp | 6 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.h | 5 |
12 files changed, 94 insertions, 20 deletions
diff --git a/utils/themeeditor/graphics/rbrenderinfo.cpp b/utils/themeeditor/graphics/rbrenderinfo.cpp index ca9f2b632d..289d730600 100644 --- a/utils/themeeditor/graphics/rbrenderinfo.cpp +++ b/utils/themeeditor/graphics/rbrenderinfo.cpp | |||
@@ -22,9 +22,10 @@ | |||
22 | #include "rbrenderinfo.h" | 22 | #include "rbrenderinfo.h" |
23 | 23 | ||
24 | RBRenderInfo::RBRenderInfo(ParseTreeModel* model, ProjectModel* project, | 24 | RBRenderInfo::RBRenderInfo(ParseTreeModel* model, ProjectModel* project, |
25 | QMap<QString, QString>* settings, RBScreen* screen) | 25 | QMap<QString, QString>* settings, |
26 | DeviceState* device, RBScreen* screen) | ||
26 | :mProject(project), mSettings(settings), | 27 | :mProject(project), mSettings(settings), |
27 | mScreen(screen), mModel(model) | 28 | mDevice(device), mScreen(screen), mModel(model) |
28 | { | 29 | { |
29 | } | 30 | } |
30 | 31 | ||
@@ -32,6 +33,7 @@ RBRenderInfo::RBRenderInfo(const RBRenderInfo &other) | |||
32 | { | 33 | { |
33 | mProject = other.mProject; | 34 | mProject = other.mProject; |
34 | mSettings = other.mSettings; | 35 | mSettings = other.mSettings; |
36 | mDevice = other.mDevice; | ||
35 | mScreen = other.mScreen; | 37 | mScreen = other.mScreen; |
36 | mModel = other.mModel; | 38 | mModel = other.mModel; |
37 | } | 39 | } |
@@ -40,6 +42,7 @@ const RBRenderInfo& RBRenderInfo::operator=(const RBRenderInfo& other) | |||
40 | { | 42 | { |
41 | mProject = other.mProject; | 43 | mProject = other.mProject; |
42 | mSettings = other.mSettings; | 44 | mSettings = other.mSettings; |
45 | mDevice = other.mDevice; | ||
43 | mScreen = other.mScreen; | 46 | mScreen = other.mScreen; |
44 | mModel = other.mModel; | 47 | mModel = other.mModel; |
45 | 48 | ||
diff --git a/utils/themeeditor/graphics/rbrenderinfo.h b/utils/themeeditor/graphics/rbrenderinfo.h index c80cb00a9d..c65c4deafa 100644 --- a/utils/themeeditor/graphics/rbrenderinfo.h +++ b/utils/themeeditor/graphics/rbrenderinfo.h | |||
@@ -27,18 +27,21 @@ | |||
27 | class RBScreen; | 27 | class RBScreen; |
28 | class ProjectModel; | 28 | class ProjectModel; |
29 | class ParseTreeModel; | 29 | class ParseTreeModel; |
30 | class DeviceState; | ||
30 | 31 | ||
31 | class RBRenderInfo | 32 | class RBRenderInfo |
32 | { | 33 | { |
33 | public: | 34 | public: |
34 | RBRenderInfo(ParseTreeModel* model, ProjectModel* project, | 35 | RBRenderInfo(ParseTreeModel* model, ProjectModel* project, |
35 | QMap<QString, QString>* settings, RBScreen* screen); | 36 | QMap<QString, QString>* settings, DeviceState* device, |
37 | RBScreen* screen); | ||
36 | RBRenderInfo(const RBRenderInfo& other); | 38 | RBRenderInfo(const RBRenderInfo& other); |
37 | virtual ~RBRenderInfo(); | 39 | virtual ~RBRenderInfo(); |
38 | 40 | ||
39 | const RBRenderInfo& operator=(const RBRenderInfo& other); | 41 | const RBRenderInfo& operator=(const RBRenderInfo& other); |
40 | 42 | ||
41 | ProjectModel* project() const{ return mProject; } | 43 | ProjectModel* project() const{ return mProject; } |
44 | DeviceState* device() const{ return mDevice; } | ||
42 | QMap<QString, QString>* settings() const{ return mSettings; } | 45 | QMap<QString, QString>* settings() const{ return mSettings; } |
43 | RBScreen* screen() const{ return mScreen; } | 46 | RBScreen* screen() const{ return mScreen; } |
44 | ParseTreeModel* model() const{ return mModel; } | 47 | ParseTreeModel* model() const{ return mModel; } |
@@ -46,6 +49,7 @@ public: | |||
46 | private: | 49 | private: |
47 | ProjectModel* mProject; | 50 | ProjectModel* mProject; |
48 | QMap<QString, QString>* mSettings; | 51 | QMap<QString, QString>* mSettings; |
52 | DeviceState* mDevice; | ||
49 | RBScreen* mScreen; | 53 | RBScreen* mScreen; |
50 | ParseTreeModel* mModel; | 54 | ParseTreeModel* mModel; |
51 | }; | 55 | }; |
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index d6a9aa6240..da6d20bbe8 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include "rbscreen.h" | 22 | #include "rbscreen.h" |
23 | #include "rbviewport.h" | 23 | #include "rbviewport.h" |
24 | #include "devicestate.h" | ||
24 | 25 | ||
25 | #include <QPainter> | 26 | #include <QPainter> |
26 | #include <QFile> | 27 | #include <QFile> |
@@ -29,8 +30,13 @@ RBScreen::RBScreen(const RBRenderInfo& info, QGraphicsItem *parent) : | |||
29 | QGraphicsItem(parent), backdrop(0), project(project) | 30 | QGraphicsItem(parent), backdrop(0), project(project) |
30 | { | 31 | { |
31 | 32 | ||
33 | /* | ||
32 | width = info.settings()->value("#screenwidth", "300").toInt(); | 34 | width = info.settings()->value("#screenwidth", "300").toInt(); |
33 | height = info.settings()->value("#screenheight", "200").toInt(); | 35 | height = info.settings()->value("#screenheight", "200").toInt(); |
36 | */ | ||
37 | |||
38 | width = info.device()->data("screenwidth").toInt(); | ||
39 | height = info.device()->data("screenheight").toInt(); | ||
34 | 40 | ||
35 | QString bg = info.settings()->value("background color", "FFFFFF"); | 41 | QString bg = info.settings()->value("background color", "FFFFFF"); |
36 | bgColor = stringToColor(bg, Qt::white); | 42 | bgColor = stringToColor(bg, Qt::white); |
diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h index 5726c5c256..1ee85f2fcd 100644 --- a/utils/themeeditor/graphics/rbviewport.h +++ b/utils/themeeditor/graphics/rbviewport.h | |||
@@ -52,9 +52,9 @@ public: | |||
52 | private: | 52 | private: |
53 | 53 | ||
54 | QRectF size; | 54 | QRectF size; |
55 | QColor background; | ||
56 | QColor foreground; | ||
57 | RBFont* font; | 55 | RBFont* font; |
56 | QColor foreground; | ||
57 | QColor background; | ||
58 | 58 | ||
59 | bool customUI; | 59 | bool customUI; |
60 | QPoint textOffset; | 60 | QPoint textOffset; |
diff --git a/utils/themeeditor/gui/configdocument.h b/utils/themeeditor/gui/configdocument.h index 0057ac15c4..e91c5cc357 100644 --- a/utils/themeeditor/gui/configdocument.h +++ b/utils/themeeditor/gui/configdocument.h | |||
@@ -75,7 +75,6 @@ private slots: | |||
75 | void addClicked(); | 75 | void addClicked(); |
76 | void textChanged(); | 76 | void textChanged(); |
77 | 77 | ||
78 | |||
79 | private: | 78 | private: |
80 | Ui::ConfigDocument *ui; | 79 | Ui::ConfigDocument *ui; |
81 | QList<QHBoxLayout*> containers; | 80 | QList<QHBoxLayout*> containers; |
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp index 3933926a48..80efd4d4d1 100644 --- a/utils/themeeditor/gui/devicestate.cpp +++ b/utils/themeeditor/gui/devicestate.cpp | |||
@@ -234,6 +234,47 @@ QVariant DeviceState::data(QString tag) | |||
234 | return QVariant(); | 234 | return QVariant(); |
235 | } | 235 | } |
236 | 236 | ||
237 | void DeviceState::setData(QString tag, QVariant data) | ||
238 | { | ||
239 | QPair<InputType, QWidget*> found = | ||
240 | inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0)); | ||
241 | |||
242 | if(found.second == 0) | ||
243 | return; | ||
244 | |||
245 | switch(found.first) | ||
246 | { | ||
247 | case Text: | ||
248 | dynamic_cast<QLineEdit*>(found.second)->setText(data.toString()); | ||
249 | break; | ||
250 | |||
251 | case Slide: | ||
252 | dynamic_cast<QSlider*>(found.second)->setValue(data.toInt()); | ||
253 | break; | ||
254 | |||
255 | case Spin: | ||
256 | dynamic_cast<QSpinBox*>(found.second)->setValue(data.toInt()); | ||
257 | break; | ||
258 | |||
259 | case DSpin: | ||
260 | dynamic_cast<QDoubleSpinBox*>(found.second)->setValue(data.toDouble()); | ||
261 | break; | ||
262 | |||
263 | case Combo: | ||
264 | dynamic_cast<QComboBox*> | ||
265 | (found.second)-> | ||
266 | setCurrentIndex(dynamic_cast<QComboBox*> | ||
267 | (found.second)->findText(data.toString())); | ||
268 | break; | ||
269 | |||
270 | case Check: | ||
271 | dynamic_cast<QCheckBox*>(found.second)->setChecked(data.toBool()); | ||
272 | break; | ||
273 | } | ||
274 | |||
275 | emit settingsChanged(); | ||
276 | } | ||
277 | |||
237 | void DeviceState::input() | 278 | void DeviceState::input() |
238 | { | 279 | { |
239 | emit settingsChanged(); | 280 | emit settingsChanged(); |
diff --git a/utils/themeeditor/gui/devicestate.h b/utils/themeeditor/gui/devicestate.h index c680e2c1ea..cae3cef7e1 100644 --- a/utils/themeeditor/gui/devicestate.h +++ b/utils/themeeditor/gui/devicestate.h | |||
@@ -47,6 +47,7 @@ public: | |||
47 | virtual ~DeviceState(); | 47 | virtual ~DeviceState(); |
48 | 48 | ||
49 | QVariant data(QString tag); | 49 | QVariant data(QString tag); |
50 | void setData(QString tag, QVariant data); | ||
50 | 51 | ||
51 | signals: | 52 | signals: |
52 | void settingsChanged(); | 53 | void settingsChanged(); |
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index 94e744e957..b778a1fba4 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp | |||
@@ -66,7 +66,8 @@ void EditorWindow::loadTabFromSkinFile(QString fileName) | |||
66 | } | 66 | } |
67 | 67 | ||
68 | /* Adding a new document*/ | 68 | /* Adding a new document*/ |
69 | SkinDocument* doc = new SkinDocument(parseStatus, fileName, project); | 69 | SkinDocument* doc = new SkinDocument(parseStatus, fileName, project, |
70 | deviceConfig); | ||
70 | addTab(doc); | 71 | addTab(doc); |
71 | ui->editorTabs->setCurrentWidget(doc); | 72 | ui->editorTabs->setCurrentWidget(doc); |
72 | 73 | ||
@@ -219,7 +220,7 @@ void EditorWindow::addTab(TabContent *doc) | |||
219 | 220 | ||
220 | void EditorWindow::newTab() | 221 | void EditorWindow::newTab() |
221 | { | 222 | { |
222 | SkinDocument* doc = new SkinDocument(parseStatus, project); | 223 | SkinDocument* doc = new SkinDocument(parseStatus, project, deviceConfig); |
223 | addTab(doc); | 224 | addTab(doc); |
224 | ui->editorTabs->setCurrentWidget(doc); | 225 | ui->editorTabs->setCurrentWidget(doc); |
225 | } | 226 | } |
@@ -345,6 +346,13 @@ void EditorWindow::openProject() | |||
345 | project = new ProjectModel(fileName, this); | 346 | project = new ProjectModel(fileName, this); |
346 | ui->projectTree->setModel(project); | 347 | ui->projectTree->setModel(project); |
347 | 348 | ||
349 | if(project->getSetting("#screenwidth") != "") | ||
350 | deviceConfig->setData("screenwidth", | ||
351 | project->getSetting("#screenwidth")); | ||
352 | if(project->getSetting("#screenheight") != "") | ||
353 | deviceConfig->setData("screenheight", | ||
354 | project->getSetting("#screenheight")); | ||
355 | |||
348 | QObject::connect(ui->projectTree, SIGNAL(activated(QModelIndex)), | 356 | QObject::connect(ui->projectTree, SIGNAL(activated(QModelIndex)), |
349 | project, SLOT(activated(QModelIndex))); | 357 | project, SLOT(activated(QModelIndex))); |
350 | 358 | ||
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp index 8c98255cca..4f48d341fe 100644 --- a/utils/themeeditor/gui/skindocument.cpp +++ b/utils/themeeditor/gui/skindocument.cpp | |||
@@ -30,9 +30,9 @@ | |||
30 | #include <iostream> | 30 | #include <iostream> |
31 | 31 | ||
32 | SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, | 32 | SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, |
33 | QWidget *parent) | 33 | DeviceState* device, QWidget *parent) |
34 | :TabContent(parent), statusLabel(statusLabel), | 34 | :TabContent(parent), statusLabel(statusLabel), |
35 | project(project) | 35 | project(project), device(device) |
36 | { | 36 | { |
37 | setupUI(); | 37 | setupUI(); |
38 | 38 | ||
@@ -44,9 +44,11 @@ SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, | |||
44 | } | 44 | } |
45 | 45 | ||
46 | SkinDocument::SkinDocument(QLabel* statusLabel, QString file, | 46 | SkinDocument::SkinDocument(QLabel* statusLabel, QString file, |
47 | ProjectModel* project, QWidget *parent) | 47 | ProjectModel* project, DeviceState* device, |
48 | QWidget *parent) | ||
48 | :TabContent(parent), fileName(file), | 49 | :TabContent(parent), fileName(file), |
49 | statusLabel(statusLabel), project(project) | 50 | statusLabel(statusLabel), project(project), |
51 | device(device) | ||
50 | { | 52 | { |
51 | setupUI(); | 53 | setupUI(); |
52 | blockUpdate = false; | 54 | blockUpdate = false; |
@@ -145,6 +147,10 @@ void SkinDocument::setupUI() | |||
145 | QObject::connect(editor, SIGNAL(cursorPositionChanged()), | 147 | QObject::connect(editor, SIGNAL(cursorPositionChanged()), |
146 | this, SLOT(cursorChanged())); | 148 | this, SLOT(cursorChanged())); |
147 | 149 | ||
150 | /* Connecting to device setting changes */ | ||
151 | QObject::connect(device, SIGNAL(settingsChanged()), | ||
152 | this, SLOT(deviceChanged())); | ||
153 | |||
148 | settingsChanged(); | 154 | settingsChanged(); |
149 | } | 155 | } |
150 | 156 | ||
@@ -257,7 +263,7 @@ void SkinDocument::codeChanged() | |||
257 | else | 263 | else |
258 | emit titleChanged(titleText); | 264 | emit titleChanged(titleText); |
259 | 265 | ||
260 | model->render(project, &fileName); | 266 | model->render(project, device, &fileName); |
261 | 267 | ||
262 | cursorChanged(); | 268 | cursorChanged(); |
263 | 269 | ||
diff --git a/utils/themeeditor/gui/skindocument.h b/utils/themeeditor/gui/skindocument.h index f6ceb73e92..c6b36873f8 100644 --- a/utils/themeeditor/gui/skindocument.h +++ b/utils/themeeditor/gui/skindocument.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "codeeditor.h" | 33 | #include "codeeditor.h" |
34 | #include "tabcontent.h" | 34 | #include "tabcontent.h" |
35 | #include "projectmodel.h" | 35 | #include "projectmodel.h" |
36 | #include "devicestate.h" | ||
36 | 37 | ||
37 | class SkinDocument : public TabContent | 38 | class SkinDocument : public TabContent |
38 | { | 39 | { |
@@ -49,9 +50,9 @@ public: | |||
49 | } | 50 | } |
50 | 51 | ||
51 | SkinDocument(QLabel* statusLabel, ProjectModel* project = 0, | 52 | SkinDocument(QLabel* statusLabel, ProjectModel* project = 0, |
52 | QWidget *parent = 0); | 53 | DeviceState* device = 0, QWidget *parent = 0); |
53 | SkinDocument(QLabel* statusLabel, QString file, ProjectModel* project = 0, | 54 | SkinDocument(QLabel* statusLabel, QString file, ProjectModel* project = 0, |
54 | QWidget* parent = 0); | 55 | DeviceState* device = 0, QWidget* parent = 0); |
55 | virtual ~SkinDocument(); | 56 | virtual ~SkinDocument(); |
56 | 57 | ||
57 | void connectPrefs(PreferencesDialog* prefs); | 58 | void connectPrefs(PreferencesDialog* prefs); |
@@ -70,7 +71,7 @@ public: | |||
70 | 71 | ||
71 | TabType type() const{ return Skin; } | 72 | TabType type() const{ return Skin; } |
72 | 73 | ||
73 | QGraphicsScene* scene(){ return model->render(project, &fileName); } | 74 | QGraphicsScene* scene(){ return model->render(project, device, &fileName); } |
74 | 75 | ||
75 | signals: | 76 | signals: |
76 | 77 | ||
@@ -80,6 +81,7 @@ public slots: | |||
80 | 81 | ||
81 | private slots: | 82 | private slots: |
82 | void codeChanged(); | 83 | void codeChanged(); |
84 | void deviceChanged(){ scene(); } | ||
83 | 85 | ||
84 | private: | 86 | private: |
85 | void setupUI(); | 87 | void setupUI(); |
@@ -101,6 +103,7 @@ private: | |||
101 | bool blockUpdate; | 103 | bool blockUpdate; |
102 | 104 | ||
103 | ProjectModel* project; | 105 | ProjectModel* project; |
106 | DeviceState* device; | ||
104 | }; | 107 | }; |
105 | 108 | ||
106 | #endif // SKINDOCUMENT_H | 109 | #endif // SKINDOCUMENT_H |
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index 830a6463bb..ff8a27c660 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp | |||
@@ -275,7 +275,7 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value, | |||
275 | } | 275 | } |
276 | 276 | ||
277 | QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | 277 | QGraphicsScene* ParseTreeModel::render(ProjectModel* project, |
278 | const QString* file) | 278 | DeviceState* device, const QString* file) |
279 | { | 279 | { |
280 | scene->clear(); | 280 | scene->clear(); |
281 | 281 | ||
@@ -306,13 +306,13 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | |||
306 | } | 306 | } |
307 | 307 | ||
308 | RBScreen* screen = 0; | 308 | RBScreen* screen = 0; |
309 | RBRenderInfo info(this, project, &settings, screen); | 309 | RBRenderInfo info(this, project, &settings, device, screen); |
310 | 310 | ||
311 | /* Adding the screen */ | 311 | /* Adding the screen */ |
312 | screen = new RBScreen(info); | 312 | screen = new RBScreen(info); |
313 | scene->addItem(screen); | 313 | scene->addItem(screen); |
314 | 314 | ||
315 | info = RBRenderInfo(this, project, &settings, screen); | 315 | info = RBRenderInfo(this, project, &settings, device, screen); |
316 | 316 | ||
317 | 317 | ||
318 | /* Rendering the tree */ | 318 | /* Rendering the tree */ |
diff --git a/utils/themeeditor/models/parsetreemodel.h b/utils/themeeditor/models/parsetreemodel.h index df64403bf5..463f6ca82d 100644 --- a/utils/themeeditor/models/parsetreemodel.h +++ b/utils/themeeditor/models/parsetreemodel.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "skin_parser.h" | 22 | #include "skin_parser.h" |
23 | #include "skin_debug.h" | 23 | #include "skin_debug.h" |
24 | #include "projectmodel.h" | 24 | #include "projectmodel.h" |
25 | #include "devicestate.h" | ||
25 | 26 | ||
26 | #ifndef PARSETREEMODEL_H | 27 | #ifndef PARSETREEMODEL_H |
27 | #define PARSETREEMODEL_H | 28 | #define PARSETREEMODEL_H |
@@ -31,6 +32,7 @@ | |||
31 | #include <QGraphicsScene> | 32 | #include <QGraphicsScene> |
32 | 33 | ||
33 | #include "parsetreenode.h" | 34 | #include "parsetreenode.h" |
35 | #include "devicestate.h" | ||
34 | 36 | ||
35 | class ParseTreeModel : public QAbstractItemModel | 37 | class ParseTreeModel : public QAbstractItemModel |
36 | { | 38 | { |
@@ -60,7 +62,8 @@ public: | |||
60 | Qt::ItemFlags flags(const QModelIndex &index) const; | 62 | Qt::ItemFlags flags(const QModelIndex &index) const; |
61 | bool setData(const QModelIndex &index, const QVariant &value, int role); | 63 | bool setData(const QModelIndex &index, const QVariant &value, int role); |
62 | 64 | ||
63 | QGraphicsScene* render(ProjectModel* project, const QString* file = 0); | 65 | QGraphicsScene* render(ProjectModel* project, DeviceState* device, |
66 | const QString* file = 0); | ||
64 | 67 | ||
65 | static QString safeSetting(ProjectModel* project, QString key, | 68 | static QString safeSetting(ProjectModel* project, QString key, |
66 | QString fallback) | 69 | QString fallback) |