diff options
Diffstat (limited to 'utils/themeeditor/gui')
-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 |
6 files changed, 69 insertions, 11 deletions
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 |