Mercurial > hg > sonic-visualiser
changeset 2457:a94b289f0b93 background-mode
Re-enable background mode switching, and make some fixes to it
author | Chris Cannam |
---|---|
date | Fri, 17 Jan 2020 13:51:22 +0000 |
parents | 2508e661e544 |
children | 74d73990ac1d |
files | main/PreferencesDialog.cpp main/PreferencesDialog.h repoint-lock.json repoint-project.json |
diffstat | 4 files changed, 35 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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();
--- 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"