diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-05 07:14:03 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-05 07:14:03 +0000 |
commit | 0af886077520658a12a0c0b2d41bc15e5b906239 (patch) | |
tree | c9344b0a4d770f51088a336fa220850b8674b38e /utils | |
parent | e7f38daf171c61f140557fb9e9902f03c4ddd39f (diff) | |
download | rockbox-0af886077520658a12a0c0b2d41bc15e5b906239.tar.gz rockbox-0af886077520658a12a0c0b2d41bc15e5b906239.zip |
Theme Editor: Enabled persistent window and panel locations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26565 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
-rw-r--r-- | utils/themeeditor/editorwindow.cpp | 44 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.h | 1 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.ui | 6 | ||||
-rw-r--r-- | utils/themeeditor/main.cpp | 5 |
4 files changed, 38 insertions, 18 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index 92d400cf78..4268788772 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <QDesktopWidget> | 25 | #include <QDesktopWidget> |
26 | #include <QFileSystemModel> | 26 | #include <QFileSystemModel> |
27 | #include <QSettings> | ||
27 | 28 | ||
28 | EditorWindow::EditorWindow(QWidget *parent) : | 29 | EditorWindow::EditorWindow(QWidget *parent) : |
29 | QMainWindow(parent), | 30 | QMainWindow(parent), |
@@ -37,19 +38,39 @@ EditorWindow::EditorWindow(QWidget *parent) : | |||
37 | 38 | ||
38 | void EditorWindow::loadSettings() | 39 | void EditorWindow::loadSettings() |
39 | { | 40 | { |
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 | 41 | ||
44 | QRect availableSpace = desktop->availableGeometry(desktop->primaryScreen()); | 42 | QSettings settings; |
45 | QRect buffer(availableSpace.left() + availableSpace.width() / 10, | 43 | |
46 | availableSpace.top() + availableSpace.height() / 10, | 44 | /* Main Window location */ |
47 | availableSpace.width() * 8 / 10, | 45 | settings.beginGroup("MainWindow"); |
48 | availableSpace.height() * 8 / 10); | 46 | QSize size = settings.value("size").toSize(); |
49 | this->setGeometry(buffer); | 47 | QPoint pos = settings.value("position").toPoint(); |
48 | QByteArray state = settings.value("state").toByteArray(); | ||
49 | settings.endGroup(); | ||
50 | |||
51 | if(!(size.isNull() || pos.isNull() || state.isNull())) | ||
52 | { | ||
53 | resize(size); | ||
54 | move(pos); | ||
55 | restoreState(state); | ||
56 | } | ||
57 | |||
50 | 58 | ||
51 | } | 59 | } |
52 | 60 | ||
61 | void EditorWindow::saveSettings() | ||
62 | { | ||
63 | |||
64 | QSettings settings; | ||
65 | |||
66 | /* Saving window and panel positions */ | ||
67 | settings.beginGroup("MainWindow"); | ||
68 | settings.setValue("position", pos()); | ||
69 | settings.setValue("size", size()); | ||
70 | settings.setValue("state", saveState()); | ||
71 | settings.endGroup(); | ||
72 | } | ||
73 | |||
53 | void EditorWindow::setupUI() | 74 | void EditorWindow::setupUI() |
54 | { | 75 | { |
55 | /* Displaying some files to test the file tree view */ | 76 | /* Displaying some files to test the file tree view */ |
@@ -57,10 +78,6 @@ void EditorWindow::setupUI() | |||
57 | model->setRootPath(QDir::currentPath()); | 78 | model->setRootPath(QDir::currentPath()); |
58 | ui->fileTree->setModel(model); | 79 | ui->fileTree->setModel(model); |
59 | 80 | ||
60 | /* Connecting the buttons */ | ||
61 | QObject::connect(ui->fromTree, SIGNAL(pressed()), | ||
62 | this, SLOT(updateCode())); | ||
63 | |||
64 | } | 81 | } |
65 | 82 | ||
66 | void EditorWindow::setupMenus() | 83 | void EditorWindow::setupMenus() |
@@ -97,6 +114,7 @@ void EditorWindow::showPanel() | |||
97 | 114 | ||
98 | void EditorWindow::closeEvent(QCloseEvent* event) | 115 | void EditorWindow::closeEvent(QCloseEvent* event) |
99 | { | 116 | { |
117 | saveSettings(); | ||
100 | event->accept(); | 118 | event->accept(); |
101 | } | 119 | } |
102 | 120 | ||
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h index 2b64bde793..157ee6a30b 100644 --- a/utils/themeeditor/editorwindow.h +++ b/utils/themeeditor/editorwindow.h | |||
@@ -48,6 +48,7 @@ private slots: | |||
48 | private: | 48 | private: |
49 | /* Setup functions */ | 49 | /* Setup functions */ |
50 | void loadSettings(); | 50 | void loadSettings(); |
51 | void saveSettings(); | ||
51 | void setupUI(); | 52 | void setupUI(); |
52 | void setupMenus(); | 53 | void setupMenus(); |
53 | 54 | ||
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui index 0f6062d7f9..b990f6eabd 100644 --- a/utils/themeeditor/editorwindow.ui +++ b/utils/themeeditor/editorwindow.ui | |||
@@ -14,7 +14,7 @@ | |||
14 | <string>Rockbox Theme Editor</string> | 14 | <string>Rockbox Theme Editor</string> |
15 | </property> | 15 | </property> |
16 | <property name="windowIcon"> | 16 | <property name="windowIcon"> |
17 | <iconset resource="resources.qrc"> | 17 | <iconset> |
18 | <normaloff>:/resources/resources/windowicon.png</normaloff>:/resources/resources/windowicon.png</iconset> | 18 | <normaloff>:/resources/resources/windowicon.png</normaloff>:/resources/resources/windowicon.png</iconset> |
19 | </property> | 19 | </property> |
20 | <widget class="QWidget" name="centralwidget"> | 20 | <widget class="QWidget" name="centralwidget"> |
@@ -195,9 +195,7 @@ | |||
195 | </property> | 195 | </property> |
196 | </action> | 196 | </action> |
197 | </widget> | 197 | </widget> |
198 | <resources> | 198 | <resources/> |
199 | <include location="resources.qrc"/> | ||
200 | </resources> | ||
201 | <connections> | 199 | <connections> |
202 | <connection> | 200 | <connection> |
203 | <sender>actionQuit</sender> | 201 | <sender>actionQuit</sender> |
diff --git a/utils/themeeditor/main.cpp b/utils/themeeditor/main.cpp index 152f780a43..ad4ae6ffae 100644 --- a/utils/themeeditor/main.cpp +++ b/utils/themeeditor/main.cpp | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <iostream> | 28 | #include <iostream> |
29 | 29 | ||
30 | #include <QtGui/QApplication> | 30 | #include <QtGui/QApplication> |
31 | #include <QTreeView> | ||
32 | 31 | ||
33 | #include "parsetreemodel.h" | 32 | #include "parsetreemodel.h" |
34 | 33 | ||
@@ -36,6 +35,10 @@ int main(int argc, char* argv[]) | |||
36 | { | 35 | { |
37 | QApplication app(argc, argv); | 36 | QApplication app(argc, argv); |
38 | 37 | ||
38 | QCoreApplication::setApplicationName(QObject::tr("Rockbox Theme Editor")); | ||
39 | QCoreApplication::setApplicationVersion(QObject::tr("Pre-Alpha")); | ||
40 | QCoreApplication::setOrganizationName(QObject::tr("Rockbox")); | ||
41 | |||
39 | EditorWindow mainWindow; | 42 | EditorWindow mainWindow; |
40 | mainWindow.show(); | 43 | mainWindow.show(); |
41 | 44 | ||