changeset 624:c0a20cd1a9ff

If maximised on exit, don't save (maximised) geometry but instead mark as maximised and maximise on restart
author Chris Cannam
date Fri, 20 Sep 2013 16:38:00 +0100
parents 2093255c8203
children 763b1fbeb31c b0f5fa844caf
files main/MainWindow.cpp main/main.cpp
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Sep 16 15:47:42 2013 +0100
+++ b/main/MainWindow.cpp	Fri Sep 20 16:38:00 2013 +0100
@@ -3094,8 +3094,11 @@
 
     QSettings settings;
     settings.beginGroup("MainWindow");
-    settings.setValue("size", size());
-    settings.setValue("position", pos());
+    settings.setValue("maximised", isMaximized());
+    if (!isMaximized()) {
+        settings.setValue("size", size());
+        settings.setValue("position", pos());
+    }
     settings.endGroup();
 
     if (m_preferencesDialog &&
--- a/main/main.cpp	Mon Sep 16 15:47:42 2013 +0100
+++ b/main/main.cpp	Fri Sep 20 16:38:00 2013 +0100
@@ -363,14 +363,21 @@
     if (width > height * 2) width = height * 2;
 
     settings.beginGroup("MainWindow");
+
     QSize size = settings.value("size", QSize(width, height)).toSize();
     gui->resizeConstrained(size);
+
     if (settings.contains("position")) {
         QRect prevrect(settings.value("position").toPoint(), size);
         if (!(available & prevrect).isEmpty()) {
             gui->move(prevrect.topLeft());
         }
     }
+
+    if (settings.value("maximised", false).toBool()) {
+        gui->setWindowState(Qt::WindowMaximized);
+    }
+
     settings.endGroup();
     
     gui->show();