aboutsummaryrefslogtreecommitdiff
path: root/mainwindow.cc
diff options
context:
space:
mode:
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"));
-}