diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-08-05 00:43:33 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-08-05 00:43:33 +0000 |
commit | 054a85fdca651844f969f44755b8531ab2e962d7 (patch) | |
tree | d424970a137d4bbdd57102961a46653e67589820 | |
parent | 467451878726a3755eb3b2b472a3b33299cb9245 (diff) | |
download | rockbox-054a85fdca651844f969f44755b8531ab2e962d7.tar.gz rockbox-054a85fdca651844f969f44755b8531ab2e962d7.zip |
Theme Editor: Added code generate/undo functionality to SkinViewer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27704 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/gui/editorwindow.cpp | 13 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.cpp | 18 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.h | 10 | ||||
-rw-r--r-- | utils/themeeditor/gui/skinviewer.cpp | 33 | ||||
-rw-r--r-- | utils/themeeditor/gui/skinviewer.h | 8 | ||||
-rw-r--r-- | utils/themeeditor/gui/skinviewer.ui | 28 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.cpp | 18 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.h | 4 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.cpp | 35 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.h | 10 | ||||
-rw-r--r-- | utils/themeeditor/resources.qrc | 1 | ||||
-rw-r--r-- | utils/themeeditor/resources/COPYING | 10 | ||||
-rw-r--r-- | utils/themeeditor/resources/applications-system.png | bin | 0 -> 1488 bytes | |||
-rw-r--r-- | utils/themeeditor/themeeditor.pro | 3 |
15 files changed, 154 insertions, 39 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index 33749fdb7f..274edd67fd 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp | |||
@@ -311,8 +311,6 @@ void RBViewport::saveGeometry() | |||
311 | node->modParam(static_cast<int>(origin.y()), baseParam + 1); | 311 | node->modParam(static_cast<int>(origin.y()), baseParam + 1); |
312 | node->modParam(static_cast<int>(bounds.width()), baseParam + 2); | 312 | node->modParam(static_cast<int>(bounds.width()), baseParam + 2); |
313 | node->modParam(static_cast<int>(bounds.height()), baseParam + 3); | 313 | node->modParam(static_cast<int>(bounds.height()), baseParam + 3); |
314 | |||
315 | doc->genCode(); | ||
316 | } | 314 | } |
317 | 315 | ||
318 | void RBViewport::alignLeft() | 316 | void RBViewport::alignLeft() |
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index 48ee76d11c..64443a1fd1 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp | |||
@@ -428,7 +428,7 @@ void EditorWindow::shiftTab(int index) | |||
428 | ui->actionCopy->setEnabled(false); | 428 | ui->actionCopy->setEnabled(false); |
429 | ui->actionPaste->setEnabled(false); | 429 | ui->actionPaste->setEnabled(false); |
430 | ui->actionFind_Replace->setEnabled(false); | 430 | ui->actionFind_Replace->setEnabled(false); |
431 | viewer->setScene(0); | 431 | viewer->connectSkin(0); |
432 | } | 432 | } |
433 | else if(widget->type() == TabContent::Config) | 433 | else if(widget->type() == TabContent::Config) |
434 | { | 434 | { |
@@ -441,7 +441,7 @@ void EditorWindow::shiftTab(int index) | |||
441 | ui->actionCopy->setEnabled(false); | 441 | ui->actionCopy->setEnabled(false); |
442 | ui->actionPaste->setEnabled(false); | 442 | ui->actionPaste->setEnabled(false); |
443 | ui->actionFind_Replace->setEnabled(false); | 443 | ui->actionFind_Replace->setEnabled(false); |
444 | viewer->setScene(0); | 444 | viewer->connectSkin(0); |
445 | } | 445 | } |
446 | else if(widget->type() == TabContent::Skin) | 446 | else if(widget->type() == TabContent::Skin) |
447 | { | 447 | { |
@@ -465,7 +465,8 @@ void EditorWindow::shiftTab(int index) | |||
465 | sizeColumns(); | 465 | sizeColumns(); |
466 | 466 | ||
467 | /* Syncing the preview */ | 467 | /* Syncing the preview */ |
468 | viewer->setScene(doc->scene()); | 468 | viewer->connectSkin(doc); |
469 | |||
469 | 470 | ||
470 | } | 471 | } |
471 | 472 | ||
@@ -513,7 +514,7 @@ void EditorWindow::closeProject() | |||
513 | dynamic_cast<SkinDocument*>(doc)->setProject(project); | 514 | dynamic_cast<SkinDocument*>(doc)->setProject(project); |
514 | if(i == ui->editorTabs->currentIndex()) | 515 | if(i == ui->editorTabs->currentIndex()) |
515 | { | 516 | { |
516 | viewer->setScene(dynamic_cast<SkinDocument*>(doc)->scene()); | 517 | viewer->connectSkin(dynamic_cast<SkinDocument*>(doc)); |
517 | } | 518 | } |
518 | } | 519 | } |
519 | } | 520 | } |
@@ -630,7 +631,7 @@ void EditorWindow::configFileChanged(QString configFile) | |||
630 | dynamic_cast<SkinDocument*>(doc)->setProject(project); | 631 | dynamic_cast<SkinDocument*>(doc)->setProject(project); |
631 | if(i == ui->editorTabs->currentIndex()) | 632 | if(i == ui->editorTabs->currentIndex()) |
632 | { | 633 | { |
633 | viewer->setScene(dynamic_cast<SkinDocument*>(doc)->scene()); | 634 | viewer->connectSkin(dynamic_cast<SkinDocument*>(doc)); |
634 | } | 635 | } |
635 | } | 636 | } |
636 | } | 637 | } |
@@ -858,7 +859,7 @@ void EditorWindow::loadProjectFile(QString fileName) | |||
858 | dynamic_cast<SkinDocument*>(doc)->setProject(project); | 859 | dynamic_cast<SkinDocument*>(doc)->setProject(project); |
859 | if(i == ui->editorTabs->currentIndex()) | 860 | if(i == ui->editorTabs->currentIndex()) |
860 | { | 861 | { |
861 | viewer->setScene(dynamic_cast<SkinDocument*>(doc)->scene()); | 862 | viewer->connectSkin(dynamic_cast<SkinDocument*>(doc)); |
862 | } | 863 | } |
863 | } | 864 | } |
864 | } | 865 | } |
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp index bd52685c6b..1ee6b6e7ee 100644 --- a/utils/themeeditor/gui/skindocument.cpp +++ b/utils/themeeditor/gui/skindocument.cpp | |||
@@ -36,7 +36,8 @@ const int SkinDocument::updateInterval = 500; | |||
36 | SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, | 36 | SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, |
37 | DeviceState* device, QWidget *parent) | 37 | DeviceState* device, QWidget *parent) |
38 | :TabContent(parent), statusLabel(statusLabel), | 38 | :TabContent(parent), statusLabel(statusLabel), |
39 | project(project), device(device) | 39 | project(project), device(device), |
40 | treeInSync(true) | ||
40 | { | 41 | { |
41 | setupUI(); | 42 | setupUI(); |
42 | 43 | ||
@@ -53,7 +54,7 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QString file, | |||
53 | QWidget *parent) | 54 | QWidget *parent) |
54 | :TabContent(parent), fileName(file), | 55 | :TabContent(parent), fileName(file), |
55 | statusLabel(statusLabel), project(project), | 56 | statusLabel(statusLabel), project(project), |
56 | device(device) | 57 | device(device), treeInSync(true) |
57 | { | 58 | { |
58 | setupUI(); | 59 | setupUI(); |
59 | blockUpdate = false; | 60 | blockUpdate = false; |
@@ -163,6 +164,9 @@ void SkinDocument::setupUI() | |||
163 | /* Setting up the model */ | 164 | /* Setting up the model */ |
164 | model = new ParseTreeModel(""); | 165 | model = new ParseTreeModel(""); |
165 | 166 | ||
167 | QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), | ||
168 | this, SLOT(modelChanged())); | ||
169 | |||
166 | /* Connecting the editor's signal */ | 170 | /* Connecting the editor's signal */ |
167 | QObject::connect(editor, SIGNAL(textChanged()), | 171 | QObject::connect(editor, SIGNAL(textChanged()), |
168 | this, SLOT(codeChanged())); | 172 | this, SLOT(codeChanged())); |
@@ -260,6 +264,10 @@ void SkinDocument::codeChanged() | |||
260 | editor->clearErrors(); | 264 | editor->clearErrors(); |
261 | parseStatus = model->changeTree(editor->document()-> | 265 | parseStatus = model->changeTree(editor->document()-> |
262 | toPlainText().toAscii()); | 266 | toPlainText().toAscii()); |
267 | |||
268 | treeInSync = true; | ||
269 | emit antiSync(false); | ||
270 | |||
263 | if(skin_error_line() > 0) | 271 | if(skin_error_line() > 0) |
264 | parseStatus = tr("Errors in document"); | 272 | parseStatus = tr("Errors in document"); |
265 | statusLabel->setText(parseStatus); | 273 | statusLabel->setText(parseStatus); |
@@ -313,6 +321,12 @@ void SkinDocument::codeChanged() | |||
313 | 321 | ||
314 | } | 322 | } |
315 | 323 | ||
324 | void SkinDocument::modelChanged() | ||
325 | { | ||
326 | treeInSync = false; | ||
327 | emit antiSync(true); | ||
328 | } | ||
329 | |||
316 | void SkinDocument::save() | 330 | void SkinDocument::save() |
317 | { | 331 | { |
318 | QFile fout(fileName); | 332 | QFile fout(fileName); |
diff --git a/utils/themeeditor/gui/skindocument.h b/utils/themeeditor/gui/skindocument.h index 10c9e3ff11..5e72e29a8d 100644 --- a/utils/themeeditor/gui/skindocument.h +++ b/utils/themeeditor/gui/skindocument.h | |||
@@ -66,7 +66,6 @@ public: | |||
66 | QString title() const{ return titleText; } | 66 | QString title() const{ return titleText; } |
67 | QString getStatus(){ return parseStatus; } | 67 | QString getStatus(){ return parseStatus; } |
68 | CodeEditor* getEditor(){ return editor; } | 68 | CodeEditor* getEditor(){ return editor; } |
69 | void genCode(){ editor->document()->setPlainText(model->genCode()); } | ||
70 | void setProject(ProjectModel* project){ this->project = project; } | 69 | void setProject(ProjectModel* project){ this->project = project; } |
71 | 70 | ||
72 | void save(); | 71 | void save(); |
@@ -84,14 +83,21 @@ public: | |||
84 | void showFind(){ findReplace->show(); } | 83 | void showFind(){ findReplace->show(); } |
85 | void hideFind(){ findReplace->hide(); } | 84 | void hideFind(){ findReplace->hide(); } |
86 | 85 | ||
86 | bool isSynced(){ return treeInSync; } | ||
87 | |||
88 | |||
87 | signals: | 89 | signals: |
90 | void antiSync(bool outOfSync); | ||
88 | 91 | ||
89 | public slots: | 92 | public slots: |
90 | void settingsChanged(); | 93 | void settingsChanged(); |
91 | void cursorChanged(); | 94 | void cursorChanged(); |
95 | void parseCode(){ codeChanged(); } | ||
96 | void genCode(){ editor->document()->setPlainText(model->genCode()); } | ||
92 | 97 | ||
93 | private slots: | 98 | private slots: |
94 | void codeChanged(); | 99 | void codeChanged(); |
100 | void modelChanged(); | ||
95 | void deviceChanged(){ scene(); } | 101 | void deviceChanged(){ scene(); } |
96 | 102 | ||
97 | private: | 103 | private: |
@@ -122,6 +128,8 @@ private: | |||
122 | QTime lastUpdate; | 128 | QTime lastUpdate; |
123 | static const int updateInterval; | 129 | static const int updateInterval; |
124 | QTimer checkUpdate; | 130 | QTimer checkUpdate; |
131 | |||
132 | bool treeInSync; | ||
125 | }; | 133 | }; |
126 | 134 | ||
127 | #endif // SKINDOCUMENT_H | 135 | #endif // SKINDOCUMENT_H |
diff --git a/utils/themeeditor/gui/skinviewer.cpp b/utils/themeeditor/gui/skinviewer.cpp index 1d5c84c519..f1f3af9c8c 100644 --- a/utils/themeeditor/gui/skinviewer.cpp +++ b/utils/themeeditor/gui/skinviewer.cpp | |||
@@ -54,9 +54,38 @@ void SkinViewer::changeEvent(QEvent *e) | |||
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | void SkinViewer::setScene(QGraphicsScene *scene) | 57 | void SkinViewer::connectSkin(SkinDocument *skin) |
58 | { | 58 | { |
59 | ui->viewer->setScene(scene); | 59 | if(skin) |
60 | { | ||
61 | ui->viewer->setScene(skin->scene()); | ||
62 | QObject::connect(skin, SIGNAL(antiSync(bool)), | ||
63 | ui->codeGenButton, SLOT(setEnabled(bool))); | ||
64 | QObject::connect(skin, SIGNAL(antiSync(bool)), | ||
65 | ui->codeUndoButton, SLOT(setEnabled(bool))); | ||
66 | |||
67 | QObject::connect(ui->codeGenButton, SIGNAL(pressed()), | ||
68 | skin, SLOT(genCode())); | ||
69 | QObject::connect(ui->codeUndoButton, SIGNAL(pressed()), | ||
70 | skin, SLOT(parseCode())); | ||
71 | |||
72 | doc = skin; | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | ui->viewer->setScene(0); | ||
77 | |||
78 | doc = 0; | ||
79 | } | ||
80 | |||
81 | bool antiSync; | ||
82 | if(skin && !skin->isSynced()) | ||
83 | antiSync = true; | ||
84 | else | ||
85 | antiSync = false; | ||
86 | |||
87 | ui->codeGenButton->setEnabled(antiSync); | ||
88 | ui->codeUndoButton->setEnabled(antiSync); | ||
60 | } | 89 | } |
61 | 90 | ||
62 | void SkinViewer::zoomIn() | 91 | void SkinViewer::zoomIn() |
diff --git a/utils/themeeditor/gui/skinviewer.h b/utils/themeeditor/gui/skinviewer.h index 64ad219aae..c1b978c414 100644 --- a/utils/themeeditor/gui/skinviewer.h +++ b/utils/themeeditor/gui/skinviewer.h | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <QWidget> | 25 | #include <QWidget> |
26 | #include <QGraphicsScene> | 26 | #include <QGraphicsScene> |
27 | 27 | ||
28 | #include "skindocument.h" | ||
29 | |||
28 | namespace Ui { | 30 | namespace Ui { |
29 | class SkinViewer; | 31 | class SkinViewer; |
30 | } | 32 | } |
@@ -35,18 +37,22 @@ public: | |||
35 | SkinViewer(QWidget *parent = 0); | 37 | SkinViewer(QWidget *parent = 0); |
36 | ~SkinViewer(); | 38 | ~SkinViewer(); |
37 | 39 | ||
38 | void setScene(QGraphicsScene* scene); | 40 | void connectSkin(SkinDocument* skin); |
39 | 41 | ||
40 | public slots: | 42 | public slots: |
41 | void zoomIn(); | 43 | void zoomIn(); |
42 | void zoomOut(); | 44 | void zoomOut(); |
43 | void zoomEven(); | 45 | void zoomEven(); |
44 | 46 | ||
47 | private slots: | ||
48 | |||
45 | protected: | 49 | protected: |
46 | void changeEvent(QEvent *e); | 50 | void changeEvent(QEvent *e); |
47 | 51 | ||
48 | private: | 52 | private: |
49 | Ui::SkinViewer *ui; | 53 | Ui::SkinViewer *ui; |
54 | |||
55 | SkinDocument* doc; | ||
50 | }; | 56 | }; |
51 | 57 | ||
52 | #endif // SKINVIEWER_H | 58 | #endif // SKINVIEWER_H |
diff --git a/utils/themeeditor/gui/skinviewer.ui b/utils/themeeditor/gui/skinviewer.ui index 333eeefba5..dc4a786a33 100644 --- a/utils/themeeditor/gui/skinviewer.ui +++ b/utils/themeeditor/gui/skinviewer.ui | |||
@@ -27,6 +27,34 @@ | |||
27 | <item> | 27 | <item> |
28 | <layout class="QHBoxLayout" name="horizontalLayout"> | 28 | <layout class="QHBoxLayout" name="horizontalLayout"> |
29 | <item> | 29 | <item> |
30 | <widget class="QToolButton" name="codeGenButton"> | ||
31 | <property name="enabled"> | ||
32 | <bool>false</bool> | ||
33 | </property> | ||
34 | <property name="text"> | ||
35 | <string/> | ||
36 | </property> | ||
37 | <property name="icon"> | ||
38 | <iconset resource="../resources.qrc"> | ||
39 | <normaloff>:/resources/resources/applications-system.png</normaloff>:/resources/resources/applications-system.png</iconset> | ||
40 | </property> | ||
41 | </widget> | ||
42 | </item> | ||
43 | <item> | ||
44 | <widget class="QToolButton" name="codeUndoButton"> | ||
45 | <property name="enabled"> | ||
46 | <bool>false</bool> | ||
47 | </property> | ||
48 | <property name="text"> | ||
49 | <string/> | ||
50 | </property> | ||
51 | <property name="icon"> | ||
52 | <iconset resource="../resources.qrc"> | ||
53 | <normaloff>:/resources/resources/edit-undo.png</normaloff>:/resources/resources/edit-undo.png</iconset> | ||
54 | </property> | ||
55 | </widget> | ||
56 | </item> | ||
57 | <item> | ||
30 | <spacer name="horizontalSpacer"> | 58 | <spacer name="horizontalSpacer"> |
31 | <property name="orientation"> | 59 | <property name="orientation"> |
32 | <enum>Qt::Horizontal</enum> | 60 | <enum>Qt::Horizontal</enum> |
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index a7f04ffbf2..01d60c8775 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp | |||
@@ -40,7 +40,7 @@ ParseTreeModel::ParseTreeModel(const char* document, QObject* parent): | |||
40 | this->tree = skin_parse(document); | 40 | this->tree = skin_parse(document); |
41 | 41 | ||
42 | if(tree) | 42 | if(tree) |
43 | this->root = new ParseTreeNode(tree); | 43 | this->root = new ParseTreeNode(tree, this); |
44 | else | 44 | else |
45 | this->root = 0; | 45 | this->root = 0; |
46 | 46 | ||
@@ -77,7 +77,7 @@ QString ParseTreeModel::changeTree(const char *document) | |||
77 | return error; | 77 | return error; |
78 | } | 78 | } |
79 | 79 | ||
80 | ParseTreeNode* temp = new ParseTreeNode(test); | 80 | ParseTreeNode* temp = new ParseTreeNode(test, this); |
81 | 81 | ||
82 | if(root) | 82 | if(root) |
83 | { | 83 | { |
@@ -364,3 +364,17 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | |||
364 | 364 | ||
365 | return scene; | 365 | return scene; |
366 | } | 366 | } |
367 | |||
368 | void ParseTreeModel::paramChanged(ParseTreeNode *param) | ||
369 | { | ||
370 | QModelIndex index = indexFromPointer(param); | ||
371 | emit dataChanged(index, index); | ||
372 | } | ||
373 | |||
374 | QModelIndex ParseTreeModel::indexFromPointer(ParseTreeNode *p) | ||
375 | { | ||
376 | /* Recursively finding an index for an arbitrary pointer within the tree */ | ||
377 | if(!p->getParent()) | ||
378 | return QModelIndex(); | ||
379 | return index(p->getRow(), 0, indexFromPointer(p->getParent())); | ||
380 | } | ||
diff --git a/utils/themeeditor/models/parsetreemodel.h b/utils/themeeditor/models/parsetreemodel.h index ec0a420a84..3c20a8ed3a 100644 --- a/utils/themeeditor/models/parsetreemodel.h +++ b/utils/themeeditor/models/parsetreemodel.h | |||
@@ -53,6 +53,8 @@ public: | |||
53 | QString genCode(); | 53 | QString genCode(); |
54 | /* Changes the parse tree to a new document */ | 54 | /* Changes the parse tree to a new document */ |
55 | QString changeTree(const char* document); | 55 | QString changeTree(const char* document); |
56 | |||
57 | /* Model implementation stuff */ | ||
56 | QModelIndex index(int row, int column, const QModelIndex& parent) const; | 58 | QModelIndex index(int row, int column, const QModelIndex& parent) const; |
57 | QModelIndex parent(const QModelIndex &child) const; | 59 | QModelIndex parent(const QModelIndex &child) const; |
58 | int rowCount(const QModelIndex &parent) const; | 60 | int rowCount(const QModelIndex &parent) const; |
@@ -74,6 +76,8 @@ public: | |||
74 | return fallback; | 76 | return fallback; |
75 | } | 77 | } |
76 | 78 | ||
79 | void paramChanged(ParseTreeNode* param); | ||
80 | QModelIndex indexFromPointer(ParseTreeNode* p); | ||
77 | 81 | ||
78 | private: | 82 | private: |
79 | ParseTreeNode* root; | 83 | ParseTreeNode* root; |
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp index 8d1fcc7d1a..1dedd4a689 100644 --- a/utils/themeeditor/models/parsetreenode.cpp +++ b/utils/themeeditor/models/parsetreenode.cpp | |||
@@ -36,19 +36,21 @@ int ParseTreeNode::openConditionals = 0; | |||
36 | bool ParseTreeNode::breakFlag = false; | 36 | bool ParseTreeNode::breakFlag = false; |
37 | 37 | ||
38 | /* Root element constructor */ | 38 | /* Root element constructor */ |
39 | ParseTreeNode::ParseTreeNode(struct skin_element* data) | 39 | ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeModel* model) |
40 | : parent(0), element(0), param(0), children() | 40 | : parent(0), element(0), param(0), children(), model(model) |
41 | { | 41 | { |
42 | while(data) | 42 | while(data) |
43 | { | 43 | { |
44 | children.append(new ParseTreeNode(data, this)); | 44 | children.append(new ParseTreeNode(data, this, model)); |
45 | data = data->next; | 45 | data = data->next; |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | /* Normal element constructor */ | 49 | /* Normal element constructor */ |
50 | ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeNode* parent) | 50 | ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeNode* parent, |
51 | : parent(parent), element(data), param(0), children() | 51 | ParseTreeModel* model) |
52 | : parent(parent), element(data), param(0), | ||
53 | children(), model(model) | ||
52 | { | 54 | { |
53 | switch(element->type) | 55 | switch(element->type) |
54 | { | 56 | { |
@@ -58,29 +60,30 @@ ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeNode* parent) | |||
58 | { | 60 | { |
59 | if(element->params[i].type == skin_tag_parameter::CODE) | 61 | if(element->params[i].type == skin_tag_parameter::CODE) |
60 | children.append(new ParseTreeNode(element->params[i].data.code, | 62 | children.append(new ParseTreeNode(element->params[i].data.code, |
61 | this)); | 63 | this, model)); |
62 | else | 64 | else |
63 | children.append(new ParseTreeNode(&element->params[i], this)); | 65 | children.append(new ParseTreeNode(&element->params[i], this, |
66 | model)); | ||
64 | } | 67 | } |
65 | break; | 68 | break; |
66 | 69 | ||
67 | case CONDITIONAL: | 70 | case CONDITIONAL: |
68 | for(int i = 0; i < element->params_count; i++) | 71 | for(int i = 0; i < element->params_count; i++) |
69 | children.append(new ParseTreeNode(&data->params[i], this)); | 72 | children.append(new ParseTreeNode(&data->params[i], this, model)); |
70 | for(int i = 0; i < element->children_count; i++) | 73 | for(int i = 0; i < element->children_count; i++) |
71 | children.append(new ParseTreeNode(data->children[i], this)); | 74 | children.append(new ParseTreeNode(data->children[i], this, model)); |
72 | break; | 75 | break; |
73 | 76 | ||
74 | case LINE_ALTERNATOR: | 77 | case LINE_ALTERNATOR: |
75 | for(int i = 0; i < element->children_count; i++) | 78 | for(int i = 0; i < element->children_count; i++) |
76 | { | 79 | { |
77 | children.append(new ParseTreeNode(data->children[i], this)); | 80 | children.append(new ParseTreeNode(data->children[i], this, model)); |
78 | } | 81 | } |
79 | break; | 82 | break; |
80 | 83 | ||
81 | case VIEWPORT: | 84 | case VIEWPORT: |
82 | for(int i = 0; i < element->params_count; i++) | 85 | for(int i = 0; i < element->params_count; i++) |
83 | children.append(new ParseTreeNode(&data->params[i], this)); | 86 | children.append(new ParseTreeNode(&data->params[i], this, model)); |
84 | /* Deliberate fall-through here */ | 87 | /* Deliberate fall-through here */ |
85 | 88 | ||
86 | case LINE: | 89 | case LINE: |
@@ -89,7 +92,7 @@ case VIEWPORT: | |||
89 | for(struct skin_element* current = data->children[i]; current; | 92 | for(struct skin_element* current = data->children[i]; current; |
90 | current = current->next) | 93 | current = current->next) |
91 | { | 94 | { |
92 | children.append(new ParseTreeNode(current, this)); | 95 | children.append(new ParseTreeNode(current, this, model)); |
93 | } | 96 | } |
94 | } | 97 | } |
95 | break; | 98 | break; |
@@ -100,8 +103,10 @@ case VIEWPORT: | |||
100 | } | 103 | } |
101 | 104 | ||
102 | /* Parameter constructor */ | 105 | /* Parameter constructor */ |
103 | ParseTreeNode::ParseTreeNode(skin_tag_parameter *data, ParseTreeNode *parent) | 106 | ParseTreeNode::ParseTreeNode(skin_tag_parameter *data, ParseTreeNode *parent, |
104 | : parent(parent), element(0), param(data), children() | 107 | ParseTreeModel *model) |
108 | : parent(parent), element(0), param(data), | ||
109 | children(), model(model) | ||
105 | { | 110 | { |
106 | 111 | ||
107 | } | 112 | } |
@@ -1085,5 +1090,7 @@ void ParseTreeNode::modParam(QVariant value, int index) | |||
1085 | param->data.number = value.toInt(); | 1090 | param->data.number = value.toInt(); |
1086 | } | 1091 | } |
1087 | 1092 | ||
1093 | model->paramChanged(this); | ||
1094 | |||
1088 | } | 1095 | } |
1089 | } | 1096 | } |
diff --git a/utils/themeeditor/models/parsetreenode.h b/utils/themeeditor/models/parsetreenode.h index 39f0dbdfcd..106907799e 100644 --- a/utils/themeeditor/models/parsetreenode.h +++ b/utils/themeeditor/models/parsetreenode.h | |||
@@ -34,9 +34,11 @@ | |||
34 | class ParseTreeNode | 34 | class ParseTreeNode |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | ParseTreeNode(struct skin_element* data); | 37 | ParseTreeNode(struct skin_element* data, ParseTreeModel* model); |
38 | ParseTreeNode(struct skin_element* data, ParseTreeNode* parent); | 38 | ParseTreeNode(struct skin_element* data, ParseTreeNode* parent, |
39 | ParseTreeNode(struct skin_tag_parameter* data, ParseTreeNode* parent); | 39 | ParseTreeModel* model); |
40 | ParseTreeNode(struct skin_tag_parameter* data, ParseTreeNode* parent, | ||
41 | ParseTreeModel* model); | ||
40 | virtual ~ParseTreeNode(); | 42 | virtual ~ParseTreeNode(); |
41 | 43 | ||
42 | QString genCode() const; | 44 | QString genCode() const; |
@@ -84,6 +86,8 @@ private: | |||
84 | static bool breakFlag; | 86 | static bool breakFlag; |
85 | QGraphicsItem* rendered; | 87 | QGraphicsItem* rendered; |
86 | 88 | ||
89 | ParseTreeModel* model; | ||
90 | |||
87 | }; | 91 | }; |
88 | 92 | ||
89 | #endif // PARSETREENODE_H | 93 | #endif // PARSETREENODE_H |
diff --git a/utils/themeeditor/resources.qrc b/utils/themeeditor/resources.qrc index 9290ca9b48..0d85172eb4 100644 --- a/utils/themeeditor/resources.qrc +++ b/utils/themeeditor/resources.qrc | |||
@@ -23,6 +23,7 @@ | |||
23 | <file>resources/edit-cut.png</file> | 23 | <file>resources/edit-cut.png</file> |
24 | <file>resources/edit-paste.png</file> | 24 | <file>resources/edit-paste.png</file> |
25 | <file>resources/edit-find-replace.png</file> | 25 | <file>resources/edit-find-replace.png</file> |
26 | <file>resources/applications-system.png</file> | ||
26 | </qresource> | 27 | </qresource> |
27 | <qresource prefix="/render"> | 28 | <qresource prefix="/render"> |
28 | <file alias="scenebg.png">resources/render/scenebg.png</file> | 29 | <file alias="scenebg.png">resources/render/scenebg.png</file> |
diff --git a/utils/themeeditor/resources/COPYING b/utils/themeeditor/resources/COPYING index 14c27fa030..a8c779744f 100644 --- a/utils/themeeditor/resources/COPYING +++ b/utils/themeeditor/resources/COPYING | |||
@@ -1,8 +1,8 @@ | |||
1 | The files edit-cut.png, edit-copy.png, edit-paste.png, edit-find-replace.png, | 1 | The files applications-system.png, edit-cut.png, edit-copy.png, edit-paste.png, |
2 | edit-undo.png, edit-redo.png, ffwd.png, rwnd.png, play.png, pause.png, | 2 | edit-find-replace.png, edit-undo.png, edit-redo.png, ffwd.png, rwnd.png, |
3 | document-new.png, document-open.png, document-save-as.png, and document-save.png | 3 | play.png, pause.png, document-new.png, document-open.png, document-save-as.png, |
4 | came from the Tango Desktop Project (http://www.tango.freedesktop.org) and are | 4 | and document-save.png came from the Tango Desktop Project |
5 | in the public domain. | 5 | (http://www.tango.freedesktop.org) and are in the public domain. |
6 | 6 | ||
7 | The files zoomin.png, zoomout.png, and zoomeven.png came from the Tango Project | 7 | The files zoomin.png, zoomout.png, and zoomeven.png came from the Tango Project |
8 | with modifications by Robert Bieber, also in the public domain. | 8 | with modifications by Robert Bieber, also in the public domain. |
diff --git a/utils/themeeditor/resources/applications-system.png b/utils/themeeditor/resources/applications-system.png new file mode 100644 index 0000000000..4decc893f8 --- /dev/null +++ b/utils/themeeditor/resources/applications-system.png | |||
Binary files differ | |||
diff --git a/utils/themeeditor/themeeditor.pro b/utils/themeeditor/themeeditor.pro index d3d8b1d080..5418bbf555 100644 --- a/utils/themeeditor/themeeditor.pro +++ b/utils/themeeditor/themeeditor.pro | |||
@@ -182,7 +182,8 @@ OTHER_FILES += README \ | |||
182 | resources/edit-paste.png \ | 182 | resources/edit-paste.png \ |
183 | resources/edit-cut.png \ | 183 | resources/edit-cut.png \ |
184 | resources/edit-copy.png \ | 184 | resources/edit-copy.png \ |
185 | resources/edit-find-replace.png | 185 | resources/edit-find-replace.png \ |
186 | resources/applications-system.png | ||
186 | FORMS += gui/editorwindow.ui \ | 187 | FORMS += gui/editorwindow.ui \ |
187 | gui/preferencesdialog.ui \ | 188 | gui/preferencesdialog.ui \ |
188 | gui/configdocument.ui \ | 189 | gui/configdocument.ui \ |