diff main/PreferencesDialog.cpp @ 1463:f5c828d1f3e2 3.0-integration

Store/recall colours by hex name; simpler and more general (was having trouble with reloading on Mac). Also update subrepos inc PortAudio build
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 03 Jan 2017 15:15:26 +0000
parents 9a3684f1393b
children 06f061c54b66
line wrap: on
line diff
--- a/main/PreferencesDialog.cpp	Tue Jan 03 14:34:46 2017 +0000
+++ b/main/PreferencesDialog.cpp	Tue Jan 03 15:15:26 2017 +0000
@@ -148,10 +148,14 @@
                                            int(ColourMapper::Sunset)).toInt());
     m_colour3DColour = (settings.value("colour-3d-plot-colour",
                                        int(ColourMapper::Green)).toInt());
-    m_overviewColour =
-        (settings.value("overview-colour",
-                        ColourDatabase::getInstance()->getColour(tr("Green"))))
-        .value<QColor>();
+    m_overviewColour = ColourDatabase::getInstance()->getColour(tr("Green"));
+    if (settings.contains("overview-colour")) {
+        QString qcolorName =
+            settings.value("overview-colour", m_overviewColour.name())
+            .toString();
+        m_overviewColour.setNamedColor(qcolorName);
+        cerr << "loaded colour " << m_overviewColour.name() << " from settings" << endl;
+    }
     settings.endGroup();
 
     ColourMapComboBox *spectrogramGColour = new ColourMapComboBox(true);
@@ -167,6 +171,7 @@
     ColourComboBox *overviewColour = new ColourComboBox(false);
     int overviewColourIndex =
         ColourDatabase::getInstance()->getColourIndex(m_overviewColour);
+    cerr << "index = " << overviewColourIndex << " for colour " << m_overviewColour.name() << endl;
     if (overviewColourIndex >= 0) {
         overviewColour->setCurrentIndex(overviewColourIndex);
     }
@@ -976,7 +981,7 @@
     settings.setValue("spectrogram-colour", m_spectrogramGColour);
     settings.setValue("spectrogram-melodic-colour", m_spectrogramMColour);
     settings.setValue("colour-3d-plot-colour", m_colour3DColour);
-    settings.setValue("overview-colour", m_overviewColour);
+    settings.setValue("overview-colour", m_overviewColour.name());
     settings.endGroup();
 
     settings.beginGroup("MainWindow");