diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-04 06:59:25 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-04 06:59:25 +0000 |
commit | 9616389377d169c5c23317f0695d322b8d958b09 (patch) | |
tree | 374cf26043cfc4e0d954a3de44d289fb860ba982 /utils | |
parent | d5171cc22574133b006fdbd8dc3bcad0ac139353 (diff) | |
download | rockbox-9616389377d169c5c23317f0695d322b8d958b09.tar.gz rockbox-9616389377d169c5c23317f0695d322b8d958b09.zip |
Theme Editor: Fixed bugs with menu signals, rearranged UI some more
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26540 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
-rw-r--r-- | utils/themeeditor/editorwindow.cpp | 42 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.ui | 183 |
3 files changed, 68 insertions, 159 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index 36242bf8cb..c19178a51a 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp | |||
@@ -57,49 +57,47 @@ void EditorWindow::setupUI() | |||
57 | model->setRootPath(QDir::currentPath()); | 57 | model->setRootPath(QDir::currentPath()); |
58 | ui->fileTree->setModel(model); | 58 | ui->fileTree->setModel(model); |
59 | 59 | ||
60 | /* Establishing the parse tree */ | ||
61 | tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText(). | ||
62 | toAscii()); | ||
63 | ui->parseTree->setModel(tree); | ||
64 | |||
65 | /* Setting up the syntax highlighter */ | ||
66 | highlighter = new SkinHighlighter(QColor(0,255,0), QColor(255,0,0), | ||
67 | QColor(0,0,255), QColor(150,150,150), | ||
68 | ui->codeEdit->document()); | ||
69 | |||
70 | /* Connecting the buttons */ | 60 | /* Connecting the buttons */ |
71 | QObject::connect(ui->codeEdit, SIGNAL(cursorPositionChanged()), | ||
72 | this, SLOT(codeChanged())); | ||
73 | QObject::connect(ui->fromTree, SIGNAL(pressed()), | 61 | QObject::connect(ui->fromTree, SIGNAL(pressed()), |
74 | this, SLOT(updateCode())); | 62 | this, SLOT(updateCode())); |
75 | |||
76 | } | 63 | } |
77 | 64 | ||
78 | void EditorWindow::setupMenus() | 65 | void EditorWindow::setupMenus() |
79 | { | 66 | { |
80 | /* When there are menus to setup, they'll be set up here */ | 67 | /* Connecting panel show actions */ |
68 | QObject::connect(ui->actionFile_Panel, SIGNAL(triggered()), | ||
69 | this, SLOT(showPanel())); | ||
70 | QObject::connect(ui->actionDisplay_Panel, SIGNAL(triggered()), | ||
71 | this, SLOT(showPanel())); | ||
72 | QObject::connect(ui->actionPreview_Panel, SIGNAL(triggered()), | ||
73 | this, SLOT(showPanel())); | ||
81 | } | 74 | } |
82 | 75 | ||
83 | void EditorWindow::codeChanged() | 76 | void EditorWindow::codeChanged() |
84 | { | 77 | { |
85 | tree->changeTree(ui->codeEdit->document()->toPlainText().toAscii()); | ||
86 | ui->parseTree->expandAll(); | 78 | ui->parseTree->expandAll(); |
87 | } | 79 | } |
88 | 80 | ||
89 | void EditorWindow::closeEvent(QCloseEvent* event) | 81 | void EditorWindow::updateCode() |
90 | { | 82 | { |
91 | event->accept(); | ||
92 | } | 83 | } |
93 | 84 | ||
94 | void EditorWindow::updateCode() | 85 | void EditorWindow::showPanel() |
86 | { | ||
87 | if(sender() == ui->actionFile_Panel) | ||
88 | ui->fileDock->setVisible(true); | ||
89 | if(sender() == ui->actionPreview_Panel) | ||
90 | ui->skinPreviewDock->setVisible(true); | ||
91 | if(sender() == ui->actionDisplay_Panel) | ||
92 | ui->parseTreeDock->setVisible(true); | ||
93 | } | ||
94 | |||
95 | void EditorWindow::closeEvent(QCloseEvent* event) | ||
95 | { | 96 | { |
96 | if(tree) | 97 | event->accept(); |
97 | ui->codeEdit->document()->setPlainText(tree->genCode()); | ||
98 | } | 98 | } |
99 | 99 | ||
100 | EditorWindow::~EditorWindow() | 100 | EditorWindow::~EditorWindow() |
101 | { | 101 | { |
102 | delete ui; | 102 | delete ui; |
103 | if(tree) | ||
104 | delete tree; | ||
105 | } | 103 | } |
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h index 27d08521ab..8cbfd99ede 100644 --- a/utils/themeeditor/editorwindow.h +++ b/utils/themeeditor/editorwindow.h | |||
@@ -43,6 +43,7 @@ protected: | |||
43 | private slots: | 43 | private slots: |
44 | void updateCode(); | 44 | void updateCode(); |
45 | void codeChanged(); | 45 | void codeChanged(); |
46 | void showPanel(); | ||
46 | 47 | ||
47 | private: | 48 | private: |
48 | /* Setup functions */ | 49 | /* Setup functions */ |
@@ -51,7 +52,6 @@ private: | |||
51 | void setupMenus(); | 52 | void setupMenus(); |
52 | 53 | ||
53 | Ui::EditorWindow *ui; | 54 | Ui::EditorWindow *ui; |
54 | ParseTreeModel* tree; | ||
55 | SkinHighlighter* highlighter; | 55 | SkinHighlighter* highlighter; |
56 | 56 | ||
57 | }; | 57 | }; |
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui index f5064a0b47..c7e89a4a0e 100644 --- a/utils/themeeditor/editorwindow.ui +++ b/utils/themeeditor/editorwindow.ui | |||
@@ -20,9 +20,18 @@ | |||
20 | <widget class="QWidget" name="centralwidget"> | 20 | <widget class="QWidget" name="centralwidget"> |
21 | <layout class="QVBoxLayout" name="verticalLayout"> | 21 | <layout class="QVBoxLayout" name="verticalLayout"> |
22 | <item> | 22 | <item> |
23 | <widget class="QPlainTextEdit" name="codeEdit"> | 23 | <widget class="QTabWidget" name="editorTabs"> |
24 | <property name="lineWrapMode"> | 24 | <property name="tabPosition"> |
25 | <enum>QPlainTextEdit::NoWrap</enum> | 25 | <enum>QTabWidget::North</enum> |
26 | </property> | ||
27 | <property name="currentIndex"> | ||
28 | <number>-1</number> | ||
29 | </property> | ||
30 | <property name="tabsClosable"> | ||
31 | <bool>true</bool> | ||
32 | </property> | ||
33 | <property name="movable"> | ||
34 | <bool>true</bool> | ||
26 | </property> | 35 | </property> |
27 | </widget> | 36 | </widget> |
28 | </item> | 37 | </item> |
@@ -41,6 +50,9 @@ | |||
41 | <property name="title"> | 50 | <property name="title"> |
42 | <string>&File</string> | 51 | <string>&File</string> |
43 | </property> | 52 | </property> |
53 | <addaction name="actionNew_Document"/> | ||
54 | <addaction name="actionOpen_Document"/> | ||
55 | <addaction name="separator"/> | ||
44 | <addaction name="actionPreferences"/> | 56 | <addaction name="actionPreferences"/> |
45 | <addaction name="separator"/> | 57 | <addaction name="separator"/> |
46 | <addaction name="actionQuit"/> | 58 | <addaction name="actionQuit"/> |
@@ -58,22 +70,15 @@ | |||
58 | </widget> | 70 | </widget> |
59 | <widget class="QStatusBar" name="statusbar"/> | 71 | <widget class="QStatusBar" name="statusbar"/> |
60 | <widget class="QDockWidget" name="skinPreviewDock"> | 72 | <widget class="QDockWidget" name="skinPreviewDock"> |
73 | <property name="windowTitle"> | ||
74 | <string>Skin Preview</string> | ||
75 | </property> | ||
61 | <attribute name="dockWidgetArea"> | 76 | <attribute name="dockWidgetArea"> |
62 | <number>2</number> | 77 | <number>2</number> |
63 | </attribute> | 78 | </attribute> |
64 | <widget class="QWidget" name="dockWidgetContents"> | 79 | <widget class="QWidget" name="dockWidgetContents"> |
65 | <layout class="QVBoxLayout" name="verticalLayout_2"> | 80 | <layout class="QVBoxLayout" name="verticalLayout_2"> |
66 | <item> | 81 | <item> |
67 | <widget class="QLabel" name="label_3"> | ||
68 | <property name="text"> | ||
69 | <string>Skin Preview</string> | ||
70 | </property> | ||
71 | <property name="buddy"> | ||
72 | <cstring>skinPreview</cstring> | ||
73 | </property> | ||
74 | </widget> | ||
75 | </item> | ||
76 | <item> | ||
77 | <widget class="QGraphicsView" name="skinPreview"/> | 82 | <widget class="QGraphicsView" name="skinPreview"/> |
78 | </item> | 83 | </item> |
79 | </layout> | 84 | </layout> |
@@ -87,48 +92,34 @@ | |||
87 | <enum>TopToolBarArea</enum> | 92 | <enum>TopToolBarArea</enum> |
88 | </attribute> | 93 | </attribute> |
89 | <attribute name="toolBarBreak"> | 94 | <attribute name="toolBarBreak"> |
90 | <bool>true</bool> | 95 | <bool>false</bool> |
91 | </attribute> | 96 | </attribute> |
92 | </widget> | 97 | </widget> |
93 | <widget class="QDockWidget" name="fileDock"> | 98 | <widget class="QDockWidget" name="fileDock"> |
99 | <property name="windowTitle"> | ||
100 | <string>Files</string> | ||
101 | </property> | ||
94 | <attribute name="dockWidgetArea"> | 102 | <attribute name="dockWidgetArea"> |
95 | <number>1</number> | 103 | <number>1</number> |
96 | </attribute> | 104 | </attribute> |
97 | <widget class="QWidget" name="dockWidgetContents_2"> | 105 | <widget class="QWidget" name="dockWidgetContents_2"> |
98 | <layout class="QVBoxLayout" name="verticalLayout_4"> | 106 | <layout class="QVBoxLayout" name="verticalLayout_4"> |
99 | <item> | 107 | <item> |
100 | <widget class="QLabel" name="label_2"> | ||
101 | <property name="text"> | ||
102 | <string>Files</string> | ||
103 | </property> | ||
104 | <property name="buddy"> | ||
105 | <cstring>fileTree</cstring> | ||
106 | </property> | ||
107 | </widget> | ||
108 | </item> | ||
109 | <item> | ||
110 | <widget class="QTreeView" name="fileTree"/> | 108 | <widget class="QTreeView" name="fileTree"/> |
111 | </item> | 109 | </item> |
112 | </layout> | 110 | </layout> |
113 | </widget> | 111 | </widget> |
114 | </widget> | 112 | </widget> |
115 | <widget class="QDockWidget" name="parseTreeDock"> | 113 | <widget class="QDockWidget" name="parseTreeDock"> |
114 | <property name="windowTitle"> | ||
115 | <string>Parse Tree</string> | ||
116 | </property> | ||
116 | <attribute name="dockWidgetArea"> | 117 | <attribute name="dockWidgetArea"> |
117 | <number>2</number> | 118 | <number>2</number> |
118 | </attribute> | 119 | </attribute> |
119 | <widget class="QWidget" name="dockWidgetContents_3"> | 120 | <widget class="QWidget" name="dockWidgetContents_3"> |
120 | <layout class="QVBoxLayout" name="verticalLayout_3"> | 121 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
121 | <item> | 122 | <item> |
122 | <widget class="QLabel" name="label"> | ||
123 | <property name="text"> | ||
124 | <string>Parse Tree</string> | ||
125 | </property> | ||
126 | <property name="buddy"> | ||
127 | <cstring>parseTree</cstring> | ||
128 | </property> | ||
129 | </widget> | ||
130 | </item> | ||
131 | <item> | ||
132 | <widget class="QTreeView" name="parseTree"/> | 123 | <widget class="QTreeView" name="parseTree"/> |
133 | </item> | 124 | </item> |
134 | <item> | 125 | <item> |
@@ -151,10 +142,10 @@ | |||
151 | </action> | 142 | </action> |
152 | <action name="actionDisplay_Panel"> | 143 | <action name="actionDisplay_Panel"> |
153 | <property name="checkable"> | 144 | <property name="checkable"> |
154 | <bool>true</bool> | 145 | <bool>false</bool> |
155 | </property> | 146 | </property> |
156 | <property name="checked"> | 147 | <property name="checked"> |
157 | <bool>true</bool> | 148 | <bool>false</bool> |
158 | </property> | 149 | </property> |
159 | <property name="text"> | 150 | <property name="text"> |
160 | <string>Parse &Tree Panel</string> | 151 | <string>Parse &Tree Panel</string> |
@@ -170,10 +161,10 @@ | |||
170 | </action> | 161 | </action> |
171 | <action name="actionFile_Panel"> | 162 | <action name="actionFile_Panel"> |
172 | <property name="checkable"> | 163 | <property name="checkable"> |
173 | <bool>true</bool> | 164 | <bool>false</bool> |
174 | </property> | 165 | </property> |
175 | <property name="checked"> | 166 | <property name="checked"> |
176 | <bool>true</bool> | 167 | <bool>false</bool> |
177 | </property> | 168 | </property> |
178 | <property name="text"> | 169 | <property name="text"> |
179 | <string>&File Panel</string> | 170 | <string>&File Panel</string> |
@@ -181,15 +172,31 @@ | |||
181 | </action> | 172 | </action> |
182 | <action name="actionPreview_Panel"> | 173 | <action name="actionPreview_Panel"> |
183 | <property name="checkable"> | 174 | <property name="checkable"> |
184 | <bool>true</bool> | 175 | <bool>false</bool> |
185 | </property> | 176 | </property> |
186 | <property name="checked"> | 177 | <property name="checked"> |
187 | <bool>true</bool> | 178 | <bool>false</bool> |
188 | </property> | 179 | </property> |
189 | <property name="text"> | 180 | <property name="text"> |
190 | <string>&Preview Panel</string> | 181 | <string>&Preview Panel</string> |
191 | </property> | 182 | </property> |
192 | </action> | 183 | </action> |
184 | <action name="actionNew_Document"> | ||
185 | <property name="text"> | ||
186 | <string>&New Document</string> | ||
187 | </property> | ||
188 | <property name="shortcut"> | ||
189 | <string>Ctrl+N</string> | ||
190 | </property> | ||
191 | </action> | ||
192 | <action name="actionOpen_Document"> | ||
193 | <property name="text"> | ||
194 | <string>&Open Document</string> | ||
195 | </property> | ||
196 | <property name="shortcut"> | ||
197 | <string>Ctrl+O</string> | ||
198 | </property> | ||
199 | </action> | ||
193 | </widget> | 200 | </widget> |
194 | <resources> | 201 | <resources> |
195 | <include location="resources.qrc"/> | 202 | <include location="resources.qrc"/> |
@@ -211,101 +218,5 @@ | |||
211 | </hint> | 218 | </hint> |
212 | </hints> | 219 | </hints> |
213 | </connection> | 220 | </connection> |
214 | <connection> | ||
215 | <sender>actionDisplay_Panel</sender> | ||
216 | <signal>toggled(bool)</signal> | ||
217 | <receiver>parseTreeDock</receiver> | ||
218 | <slot>setVisible(bool)</slot> | ||
219 | <hints> | ||
220 | <hint type="sourcelabel"> | ||
221 | <x>-1</x> | ||
222 | <y>-1</y> | ||
223 | </hint> | ||
224 | <hint type="destinationlabel"> | ||
225 | <x>680</x> | ||
226 | <y>129</y> | ||
227 | </hint> | ||
228 | </hints> | ||
229 | </connection> | ||
230 | <connection> | ||
231 | <sender>parseTreeDock</sender> | ||
232 | <signal>visibilityChanged(bool)</signal> | ||
233 | <receiver>actionDisplay_Panel</receiver> | ||
234 | <slot>setChecked(bool)</slot> | ||
235 | <hints> | ||
236 | <hint type="sourcelabel"> | ||
237 | <x>680</x> | ||
238 | <y>129</y> | ||
239 | </hint> | ||
240 | <hint type="destinationlabel"> | ||
241 | <x>-1</x> | ||
242 | <y>-1</y> | ||
243 | </hint> | ||
244 | </hints> | ||
245 | </connection> | ||
246 | <connection> | ||
247 | <sender>actionFile_Panel</sender> | ||
248 | <signal>toggled(bool)</signal> | ||
249 | <receiver>fileDock</receiver> | ||
250 | <slot>setVisible(bool)</slot> | ||
251 | <hints> | ||
252 | <hint type="sourcelabel"> | ||
253 | <x>-1</x> | ||
254 | <y>-1</y> | ||
255 | </hint> | ||
256 | <hint type="destinationlabel"> | ||
257 | <x>79</x> | ||
258 | <y>206</y> | ||
259 | </hint> | ||
260 | </hints> | ||
261 | </connection> | ||
262 | <connection> | ||
263 | <sender>fileDock</sender> | ||
264 | <signal>visibilityChanged(bool)</signal> | ||
265 | <receiver>actionFile_Panel</receiver> | ||
266 | <slot>setChecked(bool)</slot> | ||
267 | <hints> | ||
268 | <hint type="sourcelabel"> | ||
269 | <x>79</x> | ||
270 | <y>206</y> | ||
271 | </hint> | ||
272 | <hint type="destinationlabel"> | ||
273 | <x>-1</x> | ||
274 | <y>-1</y> | ||
275 | </hint> | ||
276 | </hints> | ||
277 | </connection> | ||
278 | <connection> | ||
279 | <sender>actionPreview_Panel</sender> | ||
280 | <signal>toggled(bool)</signal> | ||
281 | <receiver>skinPreviewDock</receiver> | ||
282 | <slot>setVisible(bool)</slot> | ||
283 | <hints> | ||
284 | <hint type="sourcelabel"> | ||
285 | <x>-1</x> | ||
286 | <y>-1</y> | ||
287 | </hint> | ||
288 | <hint type="destinationlabel"> | ||
289 | <x>680</x> | ||
290 | <y>112</y> | ||
291 | </hint> | ||
292 | </hints> | ||
293 | </connection> | ||
294 | <connection> | ||
295 | <sender>skinPreviewDock</sender> | ||
296 | <signal>visibilityChanged(bool)</signal> | ||
297 | <receiver>actionPreview_Panel</receiver> | ||
298 | <slot>setChecked(bool)</slot> | ||
299 | <hints> | ||
300 | <hint type="sourcelabel"> | ||
301 | <x>680</x> | ||
302 | <y>112</y> | ||
303 | </hint> | ||
304 | <hint type="destinationlabel"> | ||
305 | <x>-1</x> | ||
306 | <y>-1</y> | ||
307 | </hint> | ||
308 | </hints> | ||
309 | </connection> | ||
310 | </connections> | 221 | </connections> |
311 | </ui> | 222 | </ui> |