comparison 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
comparison
equal deleted inserted replaced
445:45f2e4cda1d7 446:8df5d64bf7c5
4170 } 4170 }
4171 4171
4172 void 4172 void
4173 MainWindow::toggleViewMode() 4173 MainWindow::toggleViewMode()
4174 { 4174 {
4175 QSettings settings;
4176 settings.beginGroup("MainWindow");
4177
4178 bool wasMinimal = m_viewManager->getMinimalModeEnabled();
4175 bool show; 4179 bool show;
4176 4180
4177 if (m_viewManager->getMinimalModeEnabled()) { 4181 if (wasMinimal) {
4178 show = true; 4182 show = true;
4179 m_viewManager->setMinimalModeEnabled(false); 4183 m_viewManager->setMinimalModeEnabled(false);
4180 m_scroll->show(); 4184 m_scroll->show();
4181 } else { 4185 } else {
4186 settings.setValue("size", size());
4182 show = false; 4187 show = false;
4183 m_viewManager->setMinimalModeEnabled(true); 4188 m_viewManager->setMinimalModeEnabled(true);
4184 m_scroll->hide(); 4189 m_scroll->hide();
4185 } 4190 }
4186 4191
4201 m_showPropertyBoxesAction->setVisible(show); 4206 m_showPropertyBoxesAction->setVisible(show);
4202 m_showStatusBarAction->setVisible(show); 4207 m_showStatusBarAction->setVisible(show);
4203 4208
4204 //layout()->activate(); 4209 //layout()->activate();
4205 //layout()->update(); 4210 //layout()->update();
4206 adjustSize(); //shrinks successfully the main window but does not remove the space allocated for the central widget containing panes 4211
4212 if (wasMinimal) {
4213 resizeConstrained(settings.value("size").toSize());
4214 } else {
4215 adjustSize(); //shrinks successfully the main window but does not remove the space allocated for the central widget containing panes
4216 }
4217
4218 settings.endGroup();
4207 4219
4208 //TO-DOS: 4220 //TO-DOS:
4209 //- when switching back to full mode, the pane is not shown entirely, should restore the previous size 4221 //- when switching back to full mode, the pane is not shown entirely, should restore the previous size
4210 //- the size of the overview (namely its width) should be increased when the minimal mode is activated 4222 //- the size of the overview (namely its width) should be increased when the minimal mode is activated
4211 //- the menus which have no effects in the minimal mode should be removed (or their actions disabled) 4223 //- the menus which have no effects in the minimal mode should be removed (or their actions disabled)