summaryrefslogtreecommitdiff
path: root/utils/themeeditor/editorwindow.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-05 07:14:03 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-05 07:14:03 +0000
commit0af886077520658a12a0c0b2d41bc15e5b906239 (patch)
treec9344b0a4d770f51088a336fa220850b8674b38e /utils/themeeditor/editorwindow.cpp
parente7f38daf171c61f140557fb9e9902f03c4ddd39f (diff)
downloadrockbox-0af886077520658a12a0c0b2d41bc15e5b906239.zip
rockbox-0af886077520658a12a0c0b2d41bc15e5b906239.tar.gz
rockbox-0af886077520658a12a0c0b2d41bc15e5b906239.tar.bz2
rockbox-0af886077520658a12a0c0b2d41bc15e5b906239.tar.xz
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/themeeditor/editorwindow.cpp')
-rw-r--r--utils/themeeditor/editorwindow.cpp44
1 files changed, 31 insertions, 13 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index 92d400c..4268788 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -24,6 +24,7 @@
#include <QDesktopWidget>
#include <QFileSystemModel>
+#include <QSettings>
EditorWindow::EditorWindow(QWidget *parent) :
QMainWindow(parent),
@@ -37,19 +38,39 @@ EditorWindow::EditorWindow(QWidget *parent) :
void EditorWindow::loadSettings()
{
- /* When there are settings to load, they'll be loaded here */
- /* For now, we'll just set the window to take up most of the screen */
- QDesktopWidget* desktop = QApplication::desktop();
- QRect availableSpace = desktop->availableGeometry(desktop->primaryScreen());
- QRect buffer(availableSpace.left() + availableSpace.width() / 10,
- availableSpace.top() + availableSpace.height() / 10,
- availableSpace.width() * 8 / 10,
- availableSpace.height() * 8 / 10);
- this->setGeometry(buffer);
+ QSettings settings;
+
+ /* Main Window location */
+ settings.beginGroup("MainWindow");
+ QSize size = settings.value("size").toSize();
+ QPoint pos = settings.value("position").toPoint();
+ QByteArray state = settings.value("state").toByteArray();
+ settings.endGroup();
+
+ if(!(size.isNull() || pos.isNull() || state.isNull()))
+ {
+ resize(size);
+ move(pos);
+ restoreState(state);
+ }
+
}
+void EditorWindow::saveSettings()
+{
+
+ QSettings settings;
+
+ /* Saving window and panel positions */
+ settings.beginGroup("MainWindow");
+ settings.setValue("position", pos());
+ settings.setValue("size", size());
+ settings.setValue("state", saveState());
+ settings.endGroup();
+}
+
void EditorWindow::setupUI()
{
/* Displaying some files to test the file tree view */
@@ -57,10 +78,6 @@ void EditorWindow::setupUI()
model->setRootPath(QDir::currentPath());
ui->fileTree->setModel(model);
- /* Connecting the buttons */
- QObject::connect(ui->fromTree, SIGNAL(pressed()),
- this, SLOT(updateCode()));
-
}
void EditorWindow::setupMenus()
@@ -97,6 +114,7 @@ void EditorWindow::showPanel()
void EditorWindow::closeEvent(QCloseEvent* event)
{
+ saveSettings();
event->accept();
}