aboutsummaryrefslogtreecommitdiff
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
parent9f917957ddc7e1e60f58c16801210db9a5bdd3f5 (diff)
downloadscribiu-8f96d8d5edc98fc1b7cacd02f3219e1a2f0fcab7.tar.gz
scribiu-8f96d8d5edc98fc1b7cacd02f3219e1a2f0fcab7.zip
add saving of mainwindow state/geometry
-rw-r--r--mainwindow.cc29
-rw-r--r--mainwindow.h3
-rw-r--r--scribiu.pro2
3 files changed, 28 insertions, 6 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"));
-}
diff --git a/mainwindow.h b/mainwindow.h
index 3f6aafc..e176122 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -62,6 +62,9 @@ private slots:
void handleExport();
void handleAbout();
+protected:
+ void closeEvent(QCloseEvent *event);
+
private:
QString formatDuration(qint64 time);
diff --git a/scribiu.pro b/scribiu.pro
index f8247c2..a9b12d0 100644
--- a/scribiu.pro
+++ b/scribiu.pro
@@ -48,7 +48,7 @@ isEmpty(PREFIX) {
target.path = $$PREFIX/bin
-udev.path = /etc/udev/rules.d
+udev.path = /lib/udev/rules.d
udev.files = 60-livescribe.rules
icon_scalable.path = $$PREFIX/share/icons/hicolor/scalable/apps