# HG changeset patch # User Chris Cannam # Date 1579269082 0 # Node ID a94b289f0b93ed2a3b89b052df7d685f3d372bdf # Parent 2508e661e544717d46b81fdf1be5bd425cb7fccc Re-enable background mode switching, and make some fixes to it diff -r 2508e661e544 -r a94b289f0b93 main/PreferencesDialog.cpp --- a/main/PreferencesDialog.cpp Wed Jan 15 14:04:39 2020 +0000 +++ b/main/PreferencesDialog.cpp Fri Jan 17 13:51:22 2020 +0000 @@ -169,12 +169,12 @@ colour3DColour->setCurrentIndex(m_colour3DColour); // can't have "add new colour", as it gets saved in the session not in prefs - ColourComboBox *overviewColour = new ColourComboBox(false); + m_overviewColourCombo = new ColourComboBox(false); int overviewColourIndex = ColourDatabase::getInstance()->getColourIndex(m_overviewColour); SVCERR << "index = " << overviewColourIndex << " for colour " << m_overviewColour.name() << endl; if (overviewColourIndex >= 0) { - overviewColour->setCurrentIndex(overviewColourIndex); + m_overviewColourCombo->setCurrentIndex(overviewColourIndex); } connect(spectrogramGColour, SIGNAL(colourMapChanged(int)), @@ -183,7 +183,7 @@ this, SLOT(spectrogramMColourChanged(int))); connect(colour3DColour, SIGNAL(colourMapChanged(int)), this, SLOT(colour3DColourChanged(int))); - connect(overviewColour, SIGNAL(colourChanged(int)), + connect(m_overviewColourCombo, SIGNAL(colourChanged(int)), this, SLOT(overviewColourChanged(int))); m_tuningFrequency = prefs->getTuningFrequency(); @@ -285,7 +285,7 @@ connect(showSplash, SIGNAL(stateChanged(int)), this, SLOT(showSplashChanged(int))); -#ifdef NOT_DEFINED // This no longer works correctly on any platform AFAICS +#ifndef Q_OS_MAC QComboBox *bgMode = new QComboBox; int bg = prefs->getPropertyRangeAndValue("Background Mode", &min, &max, &deflt); @@ -404,6 +404,13 @@ } #endif +#ifndef Q_OS_MAC + subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel + ("Background Mode"))), + row, 0); + subgrid->addWidget(bgMode, row++, 1, 1, 2); +#endif + subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel ("Property Box Layout"))), row, 0); @@ -423,14 +430,7 @@ subgrid->addWidget(new QLabel(tr("Overview waveform colour:")), row, 0); - subgrid->addWidget(overviewColour, row++, 1, 1, 2); - -#ifdef NOT_DEFINED // see earlier - subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel - ("Background Mode"))), - row, 0); - subgrid->addWidget(bgMode, row++, 1, 1, 2); -#endif + subgrid->addWidget(m_overviewColourCombo, row++, 1, 1, 2); subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel ("View Font Size"))), @@ -884,6 +884,23 @@ m_backgroundMode = mode; m_applyButton->setEnabled(true); m_changesOnRestart = true; + + // When switching to one of the explicit background choices + // (dark/light), also default the overview colour preference to + // something sensible + + int overviewColour = m_overviewColourCombo->currentIndex(); + int plainColours = 6; // we happen to know there are 6 "light" and 6 "dark" + + if (mode == Preferences::DarkBackground && overviewColour < plainColours) { + overviewColour += plainColours; + } + if (mode == Preferences::LightBackground && overviewColour >= plainColours) { + overviewColour -= plainColours; + } + + m_overviewColourCombo->setCurrentIndex(overviewColour); + overviewColourChanged(overviewColour); } void diff -r 2508e661e544 -r a94b289f0b93 main/PreferencesDialog.h --- a/main/PreferencesDialog.h Wed Jan 15 14:04:39 2020 +0000 +++ b/main/PreferencesDialog.h Fri Jan 17 13:51:22 2020 +0000 @@ -28,6 +28,7 @@ class QTabWidget; class QComboBox; class PluginPathConfigurator; +class ColourComboBox; class PreferencesDialog : public QDialog { @@ -98,6 +99,7 @@ QLineEdit *m_tempDirRootEdit; + ColourComboBox *m_overviewColourCombo; QComboBox *m_audioPlaybackDeviceCombo; QComboBox *m_audioRecordDeviceCombo; void rebuildDeviceCombos(); diff -r 2508e661e544 -r a94b289f0b93 repoint-lock.json --- a/repoint-lock.json Wed Jan 15 14:04:39 2020 +0000 +++ b/repoint-lock.json Fri Jan 17 13:51:22 2020 +0000 @@ -7,10 +7,10 @@ "pin": "23d5cb3f9f38" }, "svgui": { - "pin": "5f6fdd525158" + "pin": "4e466690bf20" }, "svapp": { - "pin": "16932dfaf64e" + "pin": "c980a0300c58" }, "checker": { "pin": "ef64b3f171d9" diff -r 2508e661e544 -r a94b289f0b93 repoint-project.json --- a/repoint-project.json Wed Jan 15 14:04:39 2020 +0000 +++ b/repoint-project.json Fri Jan 17 13:51:22 2020 +0000 @@ -24,7 +24,8 @@ }, "svapp": { "vcs": "hg", - "service": "soundsoftware" + "service": "soundsoftware", + "branch": "background-mode" }, "checker": { "vcs": "hg",