summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-03 20:05:55 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-03 20:05:55 +0000
commit69dce7cc2d55835349a5a21ef2d1569c66b6d9f3 (patch)
treeab1c95d130a678fe17a38139b45ffd583fca345c
parent88160b6e271f3d948e80e414f06a9506c98bb9a9 (diff)
downloadrockbox-69dce7cc2d55835349a5a21ef2d1569c66b6d9f3.tar.gz
rockbox-69dce7cc2d55835349a5a21ef2d1569c66b6d9f3.zip
Theme Editor: Mocked up most of the UI, added View menu items for all dockable widgets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26520 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/editorwindow.cpp27
-rw-r--r--utils/themeeditor/editorwindow.h3
-rw-r--r--utils/themeeditor/editorwindow.ui241
-rw-r--r--utils/themeeditor/parsetreemodel.cpp5
4 files changed, 256 insertions, 20 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index e06f0d8937..36242bf8cb 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -22,7 +22,8 @@
22#include "editorwindow.h" 22#include "editorwindow.h"
23#include "ui_editorwindow.h" 23#include "ui_editorwindow.h"
24 24
25#include <iostream> 25#include <QDesktopWidget>
26#include <QFileSystemModel>
26 27
27EditorWindow::EditorWindow(QWidget *parent) : 28EditorWindow::EditorWindow(QWidget *parent) :
28 QMainWindow(parent), 29 QMainWindow(parent),
@@ -37,10 +38,25 @@ EditorWindow::EditorWindow(QWidget *parent) :
37void EditorWindow::loadSettings() 38void EditorWindow::loadSettings()
38{ 39{
39 /* When there are settings to load, they'll be loaded here */ 40 /* When there are settings to load, they'll be loaded here */
41 /* For now, we'll just set the window to take up most of the screen */
42 QDesktopWidget* desktop = QApplication::desktop();
43
44 QRect availableSpace = desktop->availableGeometry(desktop->primaryScreen());
45 QRect buffer(availableSpace.left() + availableSpace.width() / 10,
46 availableSpace.top() + availableSpace.height() / 10,
47 availableSpace.width() * 8 / 10,
48 availableSpace.height() * 8 / 10);
49 this->setGeometry(buffer);
50
40} 51}
41 52
42void EditorWindow::setupUI() 53void EditorWindow::setupUI()
43{ 54{
55 /* Displaying some files to test the file tree view */
56 QFileSystemModel* model = new QFileSystemModel;
57 model->setRootPath(QDir::currentPath());
58 ui->fileTree->setModel(model);
59
44 /* Establishing the parse tree */ 60 /* Establishing the parse tree */
45 tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText(). 61 tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText().
46 toAscii()); 62 toAscii());
@@ -70,10 +86,15 @@ void EditorWindow::codeChanged()
70 ui->parseTree->expandAll(); 86 ui->parseTree->expandAll();
71} 87}
72 88
89void EditorWindow::closeEvent(QCloseEvent* event)
90{
91 event->accept();
92}
93
73void EditorWindow::updateCode() 94void EditorWindow::updateCode()
74{ 95{
75 tree->genCode(); 96 if(tree)
76 ui->codeEdit->document()->setPlainText(tree->genCode()); 97 ui->codeEdit->document()->setPlainText(tree->genCode());
77} 98}
78 99
79EditorWindow::~EditorWindow() 100EditorWindow::~EditorWindow()
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h
index f37cfcbf29..27d08521ab 100644
--- a/utils/themeeditor/editorwindow.h
+++ b/utils/themeeditor/editorwindow.h
@@ -37,6 +37,9 @@ public:
37 EditorWindow(QWidget *parent = 0); 37 EditorWindow(QWidget *parent = 0);
38 ~EditorWindow(); 38 ~EditorWindow();
39 39
40protected:
41 virtual void closeEvent(QCloseEvent* event);
42
40private slots: 43private slots:
41 void updateCode(); 44 void updateCode();
42 void codeChanged(); 45 void codeChanged();
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui
index a85ef62155..24bd1b4325 100644
--- a/utils/themeeditor/editorwindow.ui
+++ b/utils/themeeditor/editorwindow.ui
@@ -6,8 +6,8 @@
6 <rect> 6 <rect>
7 <x>0</x> 7 <x>0</x>
8 <y>0</y> 8 <y>0</y>
9 <width>800</width> 9 <width>628</width>
10 <height>400</height> 10 <height>433</height>
11 </rect> 11 </rect>
12 </property> 12 </property>
13 <property name="windowTitle"> 13 <property name="windowTitle">
@@ -33,7 +33,7 @@
33 <rect> 33 <rect>
34 <x>0</x> 34 <x>0</x>
35 <y>0</y> 35 <y>0</y>
36 <width>800</width> 36 <width>628</width>
37 <height>25</height> 37 <height>25</height>
38 </rect> 38 </rect>
39 </property> 39 </property>
@@ -41,30 +41,102 @@
41 <property name="title"> 41 <property name="title">
42 <string>File</string> 42 <string>File</string>
43 </property> 43 </property>
44 <addaction name="actionPreferences"/>
45 <addaction name="separator"/>
44 <addaction name="actionQuit"/> 46 <addaction name="actionQuit"/>
45 </widget> 47 </widget>
48 <widget class="QMenu" name="menuView">
49 <property name="title">
50 <string>View</string>
51 </property>
52 <addaction name="actionPreview_Panel"/>
53 <addaction name="actionDisplay_Panel"/>
54 <addaction name="actionFile_Panel"/>
55 </widget>
46 <addaction name="menuFile"/> 56 <addaction name="menuFile"/>
57 <addaction name="menuView"/>
47 </widget> 58 </widget>
48 <widget class="QStatusBar" name="statusbar"/> 59 <widget class="QStatusBar" name="statusbar"/>
49 <widget class="QDockWidget" name="outputDock"> 60 <widget class="QDockWidget" name="skinPreviewDock">
50 <attribute name="dockWidgetArea"> 61 <attribute name="dockWidgetArea">
51 <number>2</number> 62 <number>2</number>
52 </attribute> 63 </attribute>
53 <widget class="QWidget" name="dockWidgetContents"> 64 <widget class="QWidget" name="dockWidgetContents">
65 <layout class="QVBoxLayout" name="verticalLayout_2">
66 <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"/>
78 </item>
79 </layout>
80 </widget>
81 </widget>
82 <widget class="QToolBar" name="toolBar">
83 <property name="windowTitle">
84 <string>toolBar</string>
85 </property>
86 <attribute name="toolBarArea">
87 <enum>TopToolBarArea</enum>
88 </attribute>
89 <attribute name="toolBarBreak">
90 <bool>true</bool>
91 </attribute>
92 </widget>
93 <widget class="QDockWidget" name="fileDock">
94 <attribute name="dockWidgetArea">
95 <number>1</number>
96 </attribute>
97 <widget class="QWidget" name="dockWidgetContents_2">
98 <layout class="QVBoxLayout" name="verticalLayout_4">
99 <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"/>
111 </item>
112 </layout>
113 </widget>
114 </widget>
115 <widget class="QDockWidget" name="parseTreeDock">
116 <attribute name="dockWidgetArea">
117 <number>2</number>
118 </attribute>
119 <widget class="QWidget" name="dockWidgetContents_3">
54 <layout class="QVBoxLayout" name="verticalLayout_3"> 120 <layout class="QVBoxLayout" name="verticalLayout_3">
55 <item> 121 <item>
56 <layout class="QVBoxLayout" name="verticalLayout_2"> 122 <widget class="QLabel" name="label">
57 <item> 123 <property name="text">
58 <widget class="QTreeView" name="parseTree"/> 124 <string>Parse Tree</string>
59 </item> 125 </property>
60 <item> 126 <property name="buddy">
61 <widget class="QPushButton" name="fromTree"> 127 <cstring>parseTree</cstring>
62 <property name="text"> 128 </property>
63 <string>Update Code</string> 129 </widget>
64 </property> 130 </item>
65 </widget> 131 <item>
66 </item> 132 <widget class="QTreeView" name="parseTree"/>
67 </layout> 133 </item>
134 <item>
135 <widget class="QPushButton" name="fromTree">
136 <property name="text">
137 <string>Update Code</string>
138 </property>
139 </widget>
68 </item> 140 </item>
69 </layout> 141 </layout>
70 </widget> 142 </widget>
@@ -77,6 +149,47 @@
77 <string>Ctrl+Q</string> 149 <string>Ctrl+Q</string>
78 </property> 150 </property>
79 </action> 151 </action>
152 <action name="actionDisplay_Panel">
153 <property name="checkable">
154 <bool>true</bool>
155 </property>
156 <property name="checked">
157 <bool>true</bool>
158 </property>
159 <property name="text">
160 <string>Parse Tree Panel</string>
161 </property>
162 <property name="shortcut">
163 <string>Ctrl+D</string>
164 </property>
165 </action>
166 <action name="actionPreferences">
167 <property name="text">
168 <string>Preferences</string>
169 </property>
170 </action>
171 <action name="actionFile_Panel">
172 <property name="checkable">
173 <bool>true</bool>
174 </property>
175 <property name="checked">
176 <bool>true</bool>
177 </property>
178 <property name="text">
179 <string>File Panel</string>
180 </property>
181 </action>
182 <action name="actionPreview_Panel">
183 <property name="checkable">
184 <bool>true</bool>
185 </property>
186 <property name="checked">
187 <bool>true</bool>
188 </property>
189 <property name="text">
190 <string>Preview Panel</string>
191 </property>
192 </action>
80 </widget> 193 </widget>
81 <resources/> 194 <resources/>
82 <connections> 195 <connections>
@@ -96,5 +209,101 @@
96 </hint> 209 </hint>
97 </hints> 210 </hints>
98 </connection> 211 </connection>
212 <connection>
213 <sender>actionDisplay_Panel</sender>
214 <signal>toggled(bool)</signal>
215 <receiver>parseTreeDock</receiver>
216 <slot>setVisible(bool)</slot>
217 <hints>
218 <hint type="sourcelabel">
219 <x>-1</x>
220 <y>-1</y>
221 </hint>
222 <hint type="destinationlabel">
223 <x>680</x>
224 <y>129</y>
225 </hint>
226 </hints>
227 </connection>
228 <connection>
229 <sender>parseTreeDock</sender>
230 <signal>visibilityChanged(bool)</signal>
231 <receiver>actionDisplay_Panel</receiver>
232 <slot>setChecked(bool)</slot>
233 <hints>
234 <hint type="sourcelabel">
235 <x>680</x>
236 <y>129</y>
237 </hint>
238 <hint type="destinationlabel">
239 <x>-1</x>
240 <y>-1</y>
241 </hint>
242 </hints>
243 </connection>
244 <connection>
245 <sender>actionFile_Panel</sender>
246 <signal>toggled(bool)</signal>
247 <receiver>fileDock</receiver>
248 <slot>setVisible(bool)</slot>
249 <hints>
250 <hint type="sourcelabel">
251 <x>-1</x>
252 <y>-1</y>
253 </hint>
254 <hint type="destinationlabel">
255 <x>79</x>
256 <y>206</y>
257 </hint>
258 </hints>
259 </connection>
260 <connection>
261 <sender>fileDock</sender>
262 <signal>visibilityChanged(bool)</signal>
263 <receiver>actionFile_Panel</receiver>
264 <slot>setChecked(bool)</slot>
265 <hints>
266 <hint type="sourcelabel">
267 <x>79</x>
268 <y>206</y>
269 </hint>
270 <hint type="destinationlabel">
271 <x>-1</x>
272 <y>-1</y>
273 </hint>
274 </hints>
275 </connection>
276 <connection>
277 <sender>actionPreview_Panel</sender>
278 <signal>toggled(bool)</signal>
279 <receiver>skinPreviewDock</receiver>
280 <slot>setVisible(bool)</slot>
281 <hints>
282 <hint type="sourcelabel">
283 <x>-1</x>
284 <y>-1</y>
285 </hint>
286 <hint type="destinationlabel">
287 <x>680</x>
288 <y>112</y>
289 </hint>
290 </hints>
291 </connection>
292 <connection>
293 <sender>skinPreviewDock</sender>
294 <signal>visibilityChanged(bool)</signal>
295 <receiver>actionPreview_Panel</receiver>
296 <slot>setChecked(bool)</slot>
297 <hints>
298 <hint type="sourcelabel">
299 <x>680</x>
300 <y>112</y>
301 </hint>
302 <hint type="destinationlabel">
303 <x>-1</x>
304 <y>-1</y>
305 </hint>
306 </hints>
307 </connection>
99 </connections> 308 </connections>
100</ui> 309</ui>
diff --git a/utils/themeeditor/parsetreemodel.cpp b/utils/themeeditor/parsetreemodel.cpp
index 918903bb68..eecdc98334 100644
--- a/utils/themeeditor/parsetreemodel.cpp
+++ b/utils/themeeditor/parsetreemodel.cpp
@@ -131,7 +131,10 @@ int ParseTreeModel::rowCount(const QModelIndex &parent) const
131 131
132int ParseTreeModel::columnCount(const QModelIndex &parent) const 132int ParseTreeModel::columnCount(const QModelIndex &parent) const
133{ 133{
134 return numColumns; 134 if(parent.isValid())
135 return numColumns;
136 else
137 return numColumns;
135} 138}
136 139
137QVariant ParseTreeModel::data(const QModelIndex &index, int role) const 140QVariant ParseTreeModel::data(const QModelIndex &index, int role) const