diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-07-08 21:31:26 +0200 |
---|---|---|
committer | Anne Jan Brouwer <annejan@noprotocol.com> | 2015-07-08 21:31:26 +0200 |
commit | 5252f69dbf316984d30207dfc68fc452fd78946e (patch) | |
tree | cb0b8a246f81c79357b190292f6e73d622229491 | |
parent | 87cdd0b28c03c98c39b3daaec60db6ee3e00ee0b (diff) |
save size and stuff
-rw-r--r-- | dialog.cpp | 9 | ||||
-rw-r--r-- | dialog.h | 4 | ||||
-rw-r--r-- | keygendialog.cpp | 5 | ||||
-rw-r--r-- | keygendialog.h | 4 | ||||
-rw-r--r-- | mainwindow.cpp | 28 | ||||
-rw-r--r-- | qtpass.pro | 2 | ||||
-rw-r--r-- | usersdialog.cpp | 5 | ||||
-rw-r--r-- | usersdialog.h | 5 |
8 files changed, 61 insertions, 1 deletions
@@ -559,3 +559,12 @@ void Dialog::on_checkBoxUseTrayIcon_clicked() { ui->checkBoxHideOnClose->setEnabled(false); } } + +/** + * @brief Dialog::closeEvent + * @param event + */ +void Dialog::closeEvent(QCloseEvent *event) { + // TODO save window size or somethign + event->accept(); +} @@ -5,6 +5,7 @@ #include <QFileDialog> #include "mainwindow.h" #include <QTableWidgetItem> +#include <QCloseEvent> namespace Ui { @@ -51,6 +52,9 @@ public: void useTrayIcon(bool); void hideOnClose(bool); +protected: + void closeEvent(QCloseEvent *event); + private slots: void on_radioButtonNative_clicked(); void on_radioButtonPass_clicked(); diff --git a/keygendialog.cpp b/keygendialog.cpp index 0ae92c14..6789e091 100644 --- a/keygendialog.cpp +++ b/keygendialog.cpp @@ -140,3 +140,8 @@ void KeygenDialog::done(int r) return; } } + +void KeygenDialog::closeEvent(QCloseEvent *event) { + // TODO save window size or somethign + event->accept(); +} diff --git a/keygendialog.h b/keygendialog.h index d808816a..4cb34aff 100644 --- a/keygendialog.h +++ b/keygendialog.h @@ -2,6 +2,7 @@ #define KEYGENDIALOG_H #include <QDialog> +#include <QCloseEvent> #include "dialog.h" namespace Ui { @@ -16,6 +17,9 @@ public: explicit KeygenDialog(Dialog *parent = 0); ~KeygenDialog(); +protected: + void closeEvent(QCloseEvent *event); + private slots: void on_passphrase1_textChanged(const QString &arg1); void on_passphrase2_textChanged(const QString &arg1); diff --git a/mainwindow.cpp b/mainwindow.cpp index c0991381..39da92a4 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -134,6 +134,23 @@ bool MainWindow::checkConfig() { QSettings &settings(getSettings()); + if (firstRun) { + settings.beginGroup( "mainwindow" ); + restoreGeometry(settings.value( "geometry", saveGeometry() ).toByteArray()); + restoreState(settings.value( "savestate", saveState() ).toByteArray()); + move(settings.value( "pos", pos() ).toPoint()); + resize(settings.value( "size", size() ).toSize()); + QList<int> splitter = ui->splitter->sizes(); + int left = settings.value("splitterLeft", splitter[0]).toInt(); + int right= settings.value("splitterRight", splitter[1]).toInt(); + splitter[0] = left != 0 ? left : splitter[0]; + splitter[1] = right != 0 ? right : splitter[1]; + ui->splitter->setSizes(splitter); + if ( settings.value( "maximized", isMaximized() ).toBool() ) + showMaximized(); + settings.endGroup(); + } + usePass = (settings.value("usePass") == "true"); useClipboard = (settings.value("useClipboard") == "true"); @@ -1276,6 +1293,17 @@ void MainWindow::closeEvent(QCloseEvent *event) this->hide(); event->ignore(); } else { + settings->beginGroup( "mainwindow" ); + settings->setValue( "geometry", saveGeometry() ); + settings->setValue( "savestate", saveState() ); + settings->setValue( "maximized", isMaximized() ); + if ( !isMaximized() ) { + settings->setValue( "pos", pos() ); + settings->setValue( "size", size() ); + } + settings->setValue("splitterLeft", ui->splitter->sizes()[0]); + settings->setValue("splitterRight", ui->splitter->sizes()[1]); + settings->endGroup(); event->accept(); } } @@ -46,6 +46,8 @@ FORMS += mainwindow.ui \ usersdialog.ui \ keygendialog.ui +QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas + *-g++* { QMAKE_CXXFLAGS += -std=c++11 } diff --git a/usersdialog.cpp b/usersdialog.cpp index dd0b6517..36129315 100644 --- a/usersdialog.cpp +++ b/usersdialog.cpp @@ -67,3 +67,8 @@ void UsersDialog::on_lineEdit_textChanged(const QString &filter) { populateList(filter); } + +void UsersDialog::closeEvent(QCloseEvent *event) { + // TODO save window size or somethign + event->accept(); +} diff --git a/usersdialog.h b/usersdialog.h index b9bf5e60..46133e9b 100644 --- a/usersdialog.h +++ b/usersdialog.h @@ -1,10 +1,10 @@ #ifndef USERSDIALOG_H #define USERSDIALOG_H -//#include <QAbstractListModel> #include <QDialog> #include <QList> #include <QStandardItemModel> +#include <QCloseEvent> namespace Ui { class UsersDialog; @@ -30,6 +30,9 @@ public: ~UsersDialog(); void setUsers(QList<UserInfo> *); +protected: + void closeEvent(QCloseEvent *event); + private slots: void itemChange(QListWidgetItem *); void on_clearButton_clicked(); |