diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-06 02:11:04 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-06 02:11:04 +0000 |
commit | 5619b4f6cf968b8d5820d214790ec29f7f109a63 (patch) | |
tree | 39efebbd0ae096fa742b46dc9989f0669e624cd2 | |
parent | bc9b353c3e6f44d61fea7b352ccca915ef62a5d8 (diff) | |
download | rockbox-5619b4f6cf968b8d5820d214790ec29f7f109a63.tar.gz rockbox-5619b4f6cf968b8d5820d214790ec29f7f109a63.zip |
Theme Editor: Added code generation with tabs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26608 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/themeeditor/editorwindow.cpp | 17 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.h | 1 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.ui | 6 | ||||
-rw-r--r-- | utils/themeeditor/skindocument.h | 1 |
4 files changed, 25 insertions, 0 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index 4d2ed87169..bc66fec425 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp | |||
@@ -84,6 +84,10 @@ void EditorWindow::setupUI() | |||
84 | QObject::connect(ui->editorTabs, SIGNAL(tabCloseRequested(int)), | 84 | QObject::connect(ui->editorTabs, SIGNAL(tabCloseRequested(int)), |
85 | this, SLOT(closeTab(int))); | 85 | this, SLOT(closeTab(int))); |
86 | 86 | ||
87 | /* Connecting the code gen button */ | ||
88 | QObject::connect(ui->fromTree, SIGNAL(pressed()), | ||
89 | this, SLOT(updateCurrent())); | ||
90 | |||
87 | } | 91 | } |
88 | 92 | ||
89 | void EditorWindow::setupMenus() | 93 | void EditorWindow::setupMenus() |
@@ -133,6 +137,8 @@ void EditorWindow::shiftTab(int index) | |||
133 | ui->actionSave_Document->setEnabled(false); | 137 | ui->actionSave_Document->setEnabled(false); |
134 | ui->actionSave_Document_As->setEnabled(false); | 138 | ui->actionSave_Document_As->setEnabled(false); |
135 | ui->actionClose_Document->setEnabled(false); | 139 | ui->actionClose_Document->setEnabled(false); |
140 | ui->actionToolbarSave->setEnabled(false); | ||
141 | ui->fromTree->setEnabled(false); | ||
136 | } | 142 | } |
137 | else | 143 | else |
138 | { | 144 | { |
@@ -141,6 +147,8 @@ void EditorWindow::shiftTab(int index) | |||
141 | ui->actionSave_Document->setEnabled(true); | 147 | ui->actionSave_Document->setEnabled(true); |
142 | ui->actionSave_Document_As->setEnabled(true); | 148 | ui->actionSave_Document_As->setEnabled(true); |
143 | ui->actionClose_Document->setEnabled(true); | 149 | ui->actionClose_Document->setEnabled(true); |
150 | ui->actionToolbarSave->setEnabled(true); | ||
151 | ui->fromTree->setEnabled(true); | ||
144 | } | 152 | } |
145 | } | 153 | } |
146 | 154 | ||
@@ -211,6 +219,15 @@ void EditorWindow::closeEvent(QCloseEvent* event) | |||
211 | event->accept(); | 219 | event->accept(); |
212 | } | 220 | } |
213 | 221 | ||
222 | void EditorWindow::updateCurrent() | ||
223 | { | ||
224 | if(ui->editorTabs->currentIndex() < 0) | ||
225 | return; | ||
226 | |||
227 | dynamic_cast<SkinDocument*> | ||
228 | (ui->editorTabs->currentWidget())->genCode(); | ||
229 | } | ||
230 | |||
214 | EditorWindow::~EditorWindow() | 231 | EditorWindow::~EditorWindow() |
215 | { | 232 | { |
216 | delete ui; | 233 | delete ui; |
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h index 0febe54021..bf1228acec 100644 --- a/utils/themeeditor/editorwindow.h +++ b/utils/themeeditor/editorwindow.h | |||
@@ -50,6 +50,7 @@ private slots: | |||
50 | void saveCurrent(); | 50 | void saveCurrent(); |
51 | void saveCurrentAs(); | 51 | void saveCurrentAs(); |
52 | void tabTitleChanged(QString title); | 52 | void tabTitleChanged(QString title); |
53 | void updateCurrent(); /* Generates code in the current tab */ | ||
53 | 54 | ||
54 | private: | 55 | private: |
55 | /* Setup functions */ | 56 | /* Setup functions */ |
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui index b5e6c9d228..b25243f254 100644 --- a/utils/themeeditor/editorwindow.ui +++ b/utils/themeeditor/editorwindow.ui | |||
@@ -129,6 +129,9 @@ | |||
129 | </item> | 129 | </item> |
130 | <item> | 130 | <item> |
131 | <widget class="QPushButton" name="fromTree"> | 131 | <widget class="QPushButton" name="fromTree"> |
132 | <property name="enabled"> | ||
133 | <bool>false</bool> | ||
134 | </property> | ||
132 | <property name="text"> | 135 | <property name="text"> |
133 | <string>Update Code</string> | 136 | <string>Update Code</string> |
134 | </property> | 137 | </property> |
@@ -260,6 +263,9 @@ | |||
260 | </property> | 263 | </property> |
261 | </action> | 264 | </action> |
262 | <action name="actionToolbarSave"> | 265 | <action name="actionToolbarSave"> |
266 | <property name="enabled"> | ||
267 | <bool>false</bool> | ||
268 | </property> | ||
263 | <property name="icon"> | 269 | <property name="icon"> |
264 | <iconset resource="resources.qrc"> | 270 | <iconset resource="resources.qrc"> |
265 | <normaloff>:/resources/resources/document-save.png</normaloff>:/resources/resources/document-save.png</iconset> | 271 | <normaloff>:/resources/resources/document-save.png</normaloff>:/resources/resources/document-save.png</iconset> |
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h index d00c81f36b..f222543522 100644 --- a/utils/themeeditor/skindocument.h +++ b/utils/themeeditor/skindocument.h | |||
@@ -41,6 +41,7 @@ public: | |||
41 | 41 | ||
42 | ParseTreeModel* getModel(){ return model; } | 42 | ParseTreeModel* getModel(){ return model; } |
43 | QString getTitle(){ return title; } | 43 | QString getTitle(){ return title; } |
44 | void genCode(){ editor->document()->setPlainText(model->genCode()); } | ||
44 | 45 | ||
45 | void save(); | 46 | void save(); |
46 | void saveAs(); | 47 | void saveAs(); |