Mercurial > hg > sonic-visualiser
changeset 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 | 9a7006ebfc56 |
files | main/MainWindow.cpp main/MainWindow.h main/PreferencesDialog.cpp main/PreferencesDialog.h main/main.cpp |
diffstat | 5 files changed, 56 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/main/MainWindow.cpp Mon Jul 04 13:06:02 2011 +0100 +++ b/main/MainWindow.cpp Mon Jul 04 16:08:20 2011 +0100 @@ -749,7 +749,13 @@ action->setStatusTip(tr("Activates the Minimal Mode")); connect(action, SIGNAL(triggered()), this, SLOT(toggleViewMode())); action->setCheckable(true); - action->setChecked(m_viewManager->getMinimalModeEnabled()); + + QSettings settings; + settings.beginGroup("Preferences"); + bool mini = settings.value("start-in-mini-mode",true).toBool(); + action->setChecked(mini); + settings.endGroup(); + m_keyReference->registerShortcut(action); m_viewMenu->addAction(action); m_viewToolBar->addAction(action); @@ -925,7 +931,7 @@ m_showStatusBarAction->setChecked(true); m_viewMenu->addAction(m_showStatusBarAction); - QSettings settings; + //QSettings settings; settings.beginGroup("MainWindow"); bool sb = settings.value("showstatusbar", true).toBool(); if (!sb) { @@ -2869,8 +2875,8 @@ return; } - // Don't save size and position if in minimal mode (because we - // always start up in full mode) + // Don't save size and position if in minimal mode (in case we + //start up in full mode) bool minimal = m_viewManager->getMinimalModeEnabled(); if (!minimal) { QSettings settings; @@ -4182,6 +4188,9 @@ settings.beginGroup("MainWindow"); bool wasMinimal = m_viewManager->getMinimalModeEnabled(); + + //std::cerr << "minimal mode enabled was: " << wasMinimal << std::endl; + bool show; if (wasMinimal) { @@ -4255,16 +4264,18 @@ resizeConstrained(settings.value("size").toSize()); } else { QApplication::processEvents(); - adjustSize(); //shrinks successfully the main window but does not remove the space allocated for the central widget containing panes + adjustSize(); } settings.endGroup(); //TO-DOS: - //The Constrain Playback to Selection option is still effective when the minimal mode is activated whereas + //- The Constrain Playback to Selection option is still effective when the minimal mode is activated whereas //the functionality to modify the selection has been removed from this mode. Playback mode should switch to //normal when the minimal mode is activated and then be set up again to what it was when the full mode is //activated again. + //- after adding the minimal mode at startup option in Preferences/Appearance, the minimal mode window size + //is not optimized as before //done: //- when switching back to full mode, the pane is not shown entirely, should restore the previous size @@ -4272,5 +4283,6 @@ //- the menus which have no effects in the minimal mode should be removed (or their actions disabled) //even if this doesn't lead cause the application to crash (the actual changes are made in the hidden pane(s)) //- the menu actions which have no effects in the minimal mode should be removed or disabled + //- add Minimal mode at startup in the Preferences/Appearance }
--- a/main/MainWindow.h Mon Jul 04 13:06:02 2011 +0100 +++ b/main/MainWindow.h Mon Jul 04 16:08:20 2011 +0100 @@ -76,6 +76,7 @@ public slots: virtual void preferenceChanged(PropertyContainer::PropertyName); virtual bool commitData(bool mayAskUser); + virtual void toggleViewMode(); //to switch between minimal and full modes protected slots: virtual void openSession(); @@ -176,7 +177,7 @@ virtual void keyReference(); virtual void newerVersionAvailable(QString); - virtual void toggleViewMode(); //to switch between minimal and full modes + //virtual void toggleViewMode(); //to switch between minimal and full modes protected: Overview *m_overview;
--- a/main/PreferencesDialog.cpp Mon Jul 04 13:06:02 2011 +0100 +++ b/main/PreferencesDialog.cpp Mon Jul 04 16:08:20 2011 +0100 @@ -187,6 +187,12 @@ connect(showSplash, SIGNAL(stateChanged(int)), this, SLOT(showSplashChanged(int))); + QCheckBox *startInMiniMode = new QCheckBox; + m_startInMiniMode = prefs->getStartInMiniMode(); + startInMiniMode->setCheckState(m_startInMiniMode ? Qt::Checked : Qt::Unchecked); + connect(startInMiniMode, SIGNAL(stateChanged(int)), + this, SLOT(startInMiniModeChanged(int))); + #ifndef Q_WS_MAC QComboBox *bgMode = new QComboBox; int bg = prefs->getPropertyRangeAndValue("Background Mode", &min, &max, @@ -294,6 +300,13 @@ subgrid->addWidget(showSplash, row++, 1, 1, 1); subgrid->setRowStretch(row, 10); + + subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel + ("Start In Minimal Mode"))), + row, 0); + subgrid->addWidget(startInMiniMode, row++, 1, 1, 1); + + subgrid->setRowStretch(row, 10); tab->addTab(frame, tr("&Appearance")); @@ -417,6 +430,14 @@ } void +PreferencesDialog::startInMiniModeChanged(int state) +{ + m_startInMiniMode = (state == Qt::Checked); + m_applyButton->setEnabled(true); + m_changesOnRestart = true; +} + +void PreferencesDialog::tempDirRootChanged(QString r) { m_tempDirRoot = r; @@ -479,6 +500,7 @@ prefs->setResampleQuality(m_resampleQuality); prefs->setResampleOnLoad(m_resampleOnLoad); prefs->setShowSplash(m_showSplash); + prefs->setStartInMiniMode(m_startInMiniMode); prefs->setTemporaryDirectoryRoot(m_tempDirRoot); prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode)); prefs->setTimeToTextMode(Preferences::TimeToTextMode(m_timeToTextMode));
--- a/main/PreferencesDialog.h Mon Jul 04 13:06:02 2011 +0100 +++ b/main/PreferencesDialog.h Mon Jul 04 16:08:20 2011 +0100 @@ -50,6 +50,8 @@ void viewFontSizeChanged(int sz); void showSplashChanged(int state); + void startInMiniModeChanged(int state); + void tempDirButtonClicked(); void okClicked(); @@ -76,6 +78,8 @@ int m_viewFontSize; bool m_showSplash; + bool m_startInMiniMode; + bool m_changesOnRestart; };
--- a/main/main.cpp Mon Jul 04 13:06:02 2011 +0100 +++ b/main/main.cpp Mon Jul 04 16:08:20 2011 +0100 @@ -351,6 +351,16 @@ } settings.endGroup(); + settings.beginGroup("Preferences"); + bool mini = settings.value("start-in-mini-mode",true).toBool(); + + //std::cerr << "Minimal mode at startup (true/false): " << mini << std::endl; + + if (mini) { + gui->toggleViewMode(); + } + settings.endGroup(); + gui->show(); // The MainWindow class seems to have trouble dealing with this if