Commit cb364743 authored by Edric Milaret's avatar Edric Milaret Committed by gerrit2

ui: remember mainwindow size and pos on exit

Change-Id: I82585c4567d620f4ced6e2864486e50ec77d3b35
Tuleap: #396
parent 47c40eb2
...@@ -80,7 +80,14 @@ MainWindow::MainWindow(QWidget* parent) : ...@@ -80,7 +80,14 @@ MainWindow::MainWindow(QWidget* parent) :
} }
#endif #endif
resize(1054, 600); QSettings settings;
QVariant size = settings.value(SettingsKey::savedSize);
QVariant pos = settings.value(SettingsKey::savedPos);
if (size.isValid() && pos.isValid()) {
resize(size.toSize());
move(pos.toPoint());
} else
resize(1054, 600);
#ifdef ENABLE_AUTOUPDATE #ifdef ENABLE_AUTOUPDATE
win_sparkle_set_appcast_url("http://gpl.savoirfairelinux.net/ring-download/windows/winsparkle-ring.xml"); win_sparkle_set_appcast_url("http://gpl.savoirfairelinux.net/ring-download/windows/winsparkle-ring.xml");
...@@ -192,5 +199,8 @@ MainWindow::closeEvent(QCloseEvent* event) ...@@ -192,5 +199,8 @@ MainWindow::closeEvent(QCloseEvent* event)
if (settings.value(SettingsKey::closeOrMinimized).toBool()) { if (settings.value(SettingsKey::closeOrMinimized).toBool()) {
this->hide(); this->hide();
event->ignore(); event->ignore();
} else {
settings.setValue(SettingsKey::savedSize, size());
settings.setValue(SettingsKey::savedPos, pos());
} }
} }
...@@ -22,7 +22,8 @@ namespace SettingsKey { ...@@ -22,7 +22,8 @@ namespace SettingsKey {
constexpr static char closeOrMinimized[] = "closeOrMin"; constexpr static char closeOrMinimized[] = "closeOrMin";
constexpr static char autoAnswer[] = "autoAnswer"; constexpr static char autoAnswer[] = "autoAnswer";
constexpr static char savedSize[] = "savedSize";
constexpr static char savedPos[] = "savedPos";
} }
#define accountAutoAnswer(A) (A+SettingsKey::autoAnswer) #define accountAutoAnswer(A) (A+SettingsKey::autoAnswer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment