diff main/MainWindow.cpp @ 446:8df5d64bf7c5 toggle

Save size before switching to minimal mode, restore it when switching back. This is the same mechanism as used to save/restore the window size when exiting & restarting the program
author Chris Cannam
date Fri, 24 Jun 2011 11:29:06 +0100
parents 45f2e4cda1d7
children bff590626547
line wrap: on
line diff
--- a/main/MainWindow.cpp	Fri Jun 24 11:21:56 2011 +0100
+++ b/main/MainWindow.cpp	Fri Jun 24 11:29:06 2011 +0100
@@ -4172,13 +4172,18 @@
 void
 MainWindow::toggleViewMode()
 {
+    QSettings settings;
+    settings.beginGroup("MainWindow");
+
+    bool wasMinimal = m_viewManager->getMinimalModeEnabled();
     bool show;
 
-    if (m_viewManager->getMinimalModeEnabled()) {
+    if (wasMinimal) {
         show = true;
         m_viewManager->setMinimalModeEnabled(false);
         m_scroll->show();
     } else {
+        settings.setValue("size", size());
         show = false;
         m_viewManager->setMinimalModeEnabled(true);
         m_scroll->hide();
@@ -4203,7 +4208,14 @@
 
     //layout()->activate();
     //layout()->update();
-    adjustSize(); //shrinks successfully the main window but does not remove the space allocated for the central widget containing panes
+
+    if (wasMinimal) {
+        resizeConstrained(settings.value("size").toSize());
+    } else {
+        adjustSize(); //shrinks successfully the main window but does not remove the space allocated for the central widget containing panes
+    }
+
+    settings.endGroup();
 
     //TO-DOS:
     //- when switching back to full mode, the pane is not shown entirely, should restore the previous size