comparison main/MainWindow.cpp @ 459:f8f74f1b5b4f toggle

Start in minimal mode option added in the Preferences/Appearance menu
author mathieub <mathieu.barthet@eecs.qmul.ac.uk>
date Mon, 04 Jul 2011 16:08:20 +0100
parents a94be56cf98f
children 083182cde1c7
comparison
equal deleted inserted replaced
458:a94be56cf98f 459:f8f74f1b5b4f
747 action = new QAction(icon,tr("Minimal Mode"), this); 747 action = new QAction(icon,tr("Minimal Mode"), this);
748 action->setShortcut(tr("C")); 748 action->setShortcut(tr("C"));
749 action->setStatusTip(tr("Activates the Minimal Mode")); 749 action->setStatusTip(tr("Activates the Minimal Mode"));
750 connect(action, SIGNAL(triggered()), this, SLOT(toggleViewMode())); 750 connect(action, SIGNAL(triggered()), this, SLOT(toggleViewMode()));
751 action->setCheckable(true); 751 action->setCheckable(true);
752 action->setChecked(m_viewManager->getMinimalModeEnabled()); 752
753 QSettings settings;
754 settings.beginGroup("Preferences");
755 bool mini = settings.value("start-in-mini-mode",true).toBool();
756 action->setChecked(mini);
757 settings.endGroup();
758
753 m_keyReference->registerShortcut(action); 759 m_keyReference->registerShortcut(action);
754 m_viewMenu->addAction(action); 760 m_viewMenu->addAction(action);
755 m_viewToolBar->addAction(action); 761 m_viewToolBar->addAction(action);
756 762
757 m_viewMenu->addSeparator(); 763 m_viewMenu->addSeparator();
923 connect(m_showStatusBarAction, SIGNAL(triggered()), this, SLOT(toggleStatusBar())); 929 connect(m_showStatusBarAction, SIGNAL(triggered()), this, SLOT(toggleStatusBar()));
924 m_showStatusBarAction->setCheckable(true); 930 m_showStatusBarAction->setCheckable(true);
925 m_showStatusBarAction->setChecked(true); 931 m_showStatusBarAction->setChecked(true);
926 m_viewMenu->addAction(m_showStatusBarAction); 932 m_viewMenu->addAction(m_showStatusBarAction);
927 933
928 QSettings settings; 934 //QSettings settings;
929 settings.beginGroup("MainWindow"); 935 settings.beginGroup("MainWindow");
930 bool sb = settings.value("showstatusbar", true).toBool(); 936 bool sb = settings.value("showstatusbar", true).toBool();
931 if (!sb) { 937 if (!sb) {
932 action->setChecked(false); 938 action->setChecked(false);
933 statusBar()->hide(); 939 statusBar()->hide();
2867 // SVDEBUG << "Ignoring close event" << endl; 2873 // SVDEBUG << "Ignoring close event" << endl;
2868 e->ignore(); 2874 e->ignore();
2869 return; 2875 return;
2870 } 2876 }
2871 2877
2872 // Don't save size and position if in minimal mode (because we 2878 // Don't save size and position if in minimal mode (in case we
2873 // always start up in full mode) 2879 //start up in full mode)
2874 bool minimal = m_viewManager->getMinimalModeEnabled(); 2880 bool minimal = m_viewManager->getMinimalModeEnabled();
2875 if (!minimal) { 2881 if (!minimal) {
2876 QSettings settings; 2882 QSettings settings;
2877 settings.beginGroup("MainWindow"); 2883 settings.beginGroup("MainWindow");
2878 settings.setValue("size", size()); 2884 settings.setValue("size", size());
4180 { 4186 {
4181 QSettings settings; 4187 QSettings settings;
4182 settings.beginGroup("MainWindow"); 4188 settings.beginGroup("MainWindow");
4183 4189
4184 bool wasMinimal = m_viewManager->getMinimalModeEnabled(); 4190 bool wasMinimal = m_viewManager->getMinimalModeEnabled();
4191
4192 //std::cerr << "minimal mode enabled was: " << wasMinimal << std::endl;
4193
4185 bool show; 4194 bool show;
4186 4195
4187 if (wasMinimal) { 4196 if (wasMinimal) {
4188 4197
4189 show = true; 4198 show = true;
4253 4262
4254 if (wasMinimal) { 4263 if (wasMinimal) {
4255 resizeConstrained(settings.value("size").toSize()); 4264 resizeConstrained(settings.value("size").toSize());
4256 } else { 4265 } else {
4257 QApplication::processEvents(); 4266 QApplication::processEvents();
4258 adjustSize(); //shrinks successfully the main window but does not remove the space allocated for the central widget containing panes 4267 adjustSize();
4259 } 4268 }
4260 4269
4261 settings.endGroup(); 4270 settings.endGroup();
4262 4271
4263 //TO-DOS: 4272 //TO-DOS:
4264 //The Constrain Playback to Selection option is still effective when the minimal mode is activated whereas 4273 //- The Constrain Playback to Selection option is still effective when the minimal mode is activated whereas
4265 //the functionality to modify the selection has been removed from this mode. Playback mode should switch to 4274 //the functionality to modify the selection has been removed from this mode. Playback mode should switch to
4266 //normal when the minimal mode is activated and then be set up again to what it was when the full mode is 4275 //normal when the minimal mode is activated and then be set up again to what it was when the full mode is
4267 //activated again. 4276 //activated again.
4277 //- after adding the minimal mode at startup option in Preferences/Appearance, the minimal mode window size
4278 //is not optimized as before
4268 4279
4269 //done: 4280 //done:
4270 //- when switching back to full mode, the pane is not shown entirely, should restore the previous size 4281 //- when switching back to full mode, the pane is not shown entirely, should restore the previous size
4271 //- the size of the overview (namely its width) should be increased when the minimal mode is activated 4282 //- the size of the overview (namely its width) should be increased when the minimal mode is activated
4272 //- the menus which have no effects in the minimal mode should be removed (or their actions disabled) 4283 //- the menus which have no effects in the minimal mode should be removed (or their actions disabled)
4273 //even if this doesn't lead cause the application to crash (the actual changes are made in the hidden pane(s)) 4284 //even if this doesn't lead cause the application to crash (the actual changes are made in the hidden pane(s))
4274 //- the menu actions which have no effects in the minimal mode should be removed or disabled 4285 //- the menu actions which have no effects in the minimal mode should be removed or disabled
4275 } 4286 //- add Minimal mode at startup in the Preferences/Appearance
4276 4287 }
4288