comparison 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
comparison
equal deleted inserted replaced
1462:f5180edc5dda 1463:f5c828d1f3e2
146 int(ColourMapper::Green)).toInt()); 146 int(ColourMapper::Green)).toInt());
147 m_spectrogramMColour = (settings.value("spectrogram-melodic-colour", 147 m_spectrogramMColour = (settings.value("spectrogram-melodic-colour",
148 int(ColourMapper::Sunset)).toInt()); 148 int(ColourMapper::Sunset)).toInt());
149 m_colour3DColour = (settings.value("colour-3d-plot-colour", 149 m_colour3DColour = (settings.value("colour-3d-plot-colour",
150 int(ColourMapper::Green)).toInt()); 150 int(ColourMapper::Green)).toInt());
151 m_overviewColour = 151 m_overviewColour = ColourDatabase::getInstance()->getColour(tr("Green"));
152 (settings.value("overview-colour", 152 if (settings.contains("overview-colour")) {
153 ColourDatabase::getInstance()->getColour(tr("Green")))) 153 QString qcolorName =
154 .value<QColor>(); 154 settings.value("overview-colour", m_overviewColour.name())
155 .toString();
156 m_overviewColour.setNamedColor(qcolorName);
157 cerr << "loaded colour " << m_overviewColour.name() << " from settings" << endl;
158 }
155 settings.endGroup(); 159 settings.endGroup();
156 160
157 ColourMapComboBox *spectrogramGColour = new ColourMapComboBox(true); 161 ColourMapComboBox *spectrogramGColour = new ColourMapComboBox(true);
158 spectrogramGColour->setCurrentIndex(m_spectrogramGColour); 162 spectrogramGColour->setCurrentIndex(m_spectrogramGColour);
159 163
165 169
166 // can't have "add new colour", as it gets saved in the session not in prefs 170 // can't have "add new colour", as it gets saved in the session not in prefs
167 ColourComboBox *overviewColour = new ColourComboBox(false); 171 ColourComboBox *overviewColour = new ColourComboBox(false);
168 int overviewColourIndex = 172 int overviewColourIndex =
169 ColourDatabase::getInstance()->getColourIndex(m_overviewColour); 173 ColourDatabase::getInstance()->getColourIndex(m_overviewColour);
174 cerr << "index = " << overviewColourIndex << " for colour " << m_overviewColour.name() << endl;
170 if (overviewColourIndex >= 0) { 175 if (overviewColourIndex >= 0) {
171 overviewColour->setCurrentIndex(overviewColourIndex); 176 overviewColour->setCurrentIndex(overviewColourIndex);
172 } 177 }
173 178
174 connect(spectrogramGColour, SIGNAL(colourMapChanged(int)), 179 connect(spectrogramGColour, SIGNAL(colourMapChanged(int)),
974 settings.setValue("scaledHiDpi", m_retina); 979 settings.setValue("scaledHiDpi", m_retina);
975 #endif 980 #endif
976 settings.setValue("spectrogram-colour", m_spectrogramGColour); 981 settings.setValue("spectrogram-colour", m_spectrogramGColour);
977 settings.setValue("spectrogram-melodic-colour", m_spectrogramMColour); 982 settings.setValue("spectrogram-melodic-colour", m_spectrogramMColour);
978 settings.setValue("colour-3d-plot-colour", m_colour3DColour); 983 settings.setValue("colour-3d-plot-colour", m_colour3DColour);
979 settings.setValue("overview-colour", m_overviewColour); 984 settings.setValue("overview-colour", m_overviewColour.name());
980 settings.endGroup(); 985 settings.endGroup();
981 986
982 settings.beginGroup("MainWindow"); 987 settings.beginGroup("MainWindow");
983 settings.setValue("sessiontemplate", m_currentTemplate); 988 settings.setValue("sessiontemplate", m_currentTemplate);
984 settings.endGroup(); 989 settings.endGroup();