aboutsummaryrefslogtreecommitdiff
path: root/mainwindow.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-06-14 18:57:00 +0200
committerJavier <dev.git@javispedro.com>2015-06-14 18:57:00 +0200
commit8f96d8d5edc98fc1b7cacd02f3219e1a2f0fcab7 (patch)
treee8a38bce0a94d45cc0dab6f2fa4a90bf6c32a628 /mainwindow.cc
parent9f917957ddc7e1e60f58c16801210db9a5bdd3f5 (diff)
downloadscribiu-8f96d8d5edc98fc1b7cacd02f3219e1a2f0fcab7.tar.gz
scribiu-8f96d8d5edc98fc1b7cacd02f3219e1a2f0fcab7.zip
add saving of mainwindow state/geometry
Diffstat (limited to 'mainwindow.cc')
-rw-r--r--mainwindow.cc29
1 files changed, 24 insertions, 5 deletions
diff --git a/mainwindow.cc b/mainwindow.cc
index 48a7de0..0610993 100644
--- a/mainwindow.cc
+++ b/mainwindow.cc
@@ -18,6 +18,7 @@
#include <QtCore/QDebug>
#include <QtCore/QTimer>
+#include <QtCore/QSettings>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include <QtSvg/QSvgGenerator>
@@ -61,6 +62,13 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(handleMediaTotalTimeChanged(qint64)));
connect(_media, SIGNAL(tick(qint64)),
this, SLOT(handleMediaTick(qint64)));
+
+ QSettings settings;
+ settings.beginGroup("mainwindow");
+ restoreGeometry(settings.value("geometry").toByteArray());
+ restoreState(settings.value("state").toByteArray());
+ ui->splitter->restoreState(settings.value("splitter").toByteArray());
+ settings.endGroup();
}
MainWindow::~MainWindow()
@@ -324,6 +332,22 @@ void MainWindow::handleExport()
}
}
+void MainWindow::handleAbout()
+{
+ QMessageBox::about(this, tr("About Scribiu"), tr("Read notebooks and audio notes from your Livescribe Echo pen"));
+}
+
+void MainWindow::closeEvent(QCloseEvent *event)
+{
+ QSettings settings;
+ Q_UNUSED(event);
+ settings.beginGroup("mainwindow");
+ settings.setValue("geometry", saveGeometry());
+ settings.setValue("state", saveState());
+ settings.setValue("splitter", ui->splitter->saveState());
+ settings.endGroup();
+}
+
QString MainWindow::formatDuration(qint64 time)
{
int secs = time / 1000;
@@ -339,8 +363,3 @@ QString MainWindow::formatDuration(qint64 time)
return QString("%2:%3").arg(mins).arg(secs, 2, 10, fill);
}
}
-
-void MainWindow::handleAbout()
-{
- QMessageBox::about(this, tr("About Scribiu"), tr("Read notebooks and audio notes from your Livescribe Echo pen"));
-}