Mercurial > hg > sonic-visualiser
comparison main/PreferencesDialog.cpp @ 1096:11ef2f95ea15 3.0-integration
Add default spectrogram colours to prefs
author | Chris Cannam |
---|---|
date | Wed, 20 Jan 2016 11:43:16 +0000 |
parents | 52570633e6ff |
children | df73c834764c |
comparison
equal
deleted
inserted
replaced
1095:88f3978cb0df | 1096:11ef2f95ea15 |
---|---|
38 | 38 |
39 #include "widgets/WindowTypeSelector.h" | 39 #include "widgets/WindowTypeSelector.h" |
40 #include "widgets/IconLoader.h" | 40 #include "widgets/IconLoader.h" |
41 #include "base/Preferences.h" | 41 #include "base/Preferences.h" |
42 #include "base/ResourceFinder.h" | 42 #include "base/ResourceFinder.h" |
43 #include "layer/ColourMapper.h" | |
43 | 44 |
44 //#include "audioio/AudioTargetFactory.h" | 45 //#include "audioio/AudioTargetFactory.h" |
45 | 46 |
46 #include "version.h" | 47 #include "version.h" |
47 | 48 |
121 propertyLayout->setCurrentIndex(pl); | 122 propertyLayout->setCurrentIndex(pl); |
122 | 123 |
123 connect(propertyLayout, SIGNAL(currentIndexChanged(int)), | 124 connect(propertyLayout, SIGNAL(currentIndexChanged(int)), |
124 this, SLOT(propertyLayoutChanged(int))); | 125 this, SLOT(propertyLayoutChanged(int))); |
125 | 126 |
127 QSettings settings; | |
128 settings.beginGroup("Preferences"); | |
129 m_spectrogramGColour = (settings.value("spectrogram-colour", | |
130 int(ColourMapper::Green)).toInt()); | |
131 m_spectrogramMColour = (settings.value("spectrogram-melodic-colour", | |
132 int(ColourMapper::Sunset)).toInt()); | |
133 settings.endGroup(); | |
134 QComboBox *spectrogramGColour = new QComboBox; | |
135 QComboBox *spectrogramMColour = new QComboBox; | |
136 for (i = 0; i < ColourMapper::getColourMapCount(); ++i) { | |
137 spectrogramGColour->addItem(ColourMapper::getColourMapName(i)); | |
138 spectrogramMColour->addItem(ColourMapper::getColourMapName(i)); | |
139 if (i == m_spectrogramGColour) spectrogramGColour->setCurrentIndex(i); | |
140 if (i == m_spectrogramMColour) spectrogramMColour->setCurrentIndex(i); | |
141 } | |
142 connect(spectrogramGColour, SIGNAL(currentIndexChanged(int)), | |
143 this, SLOT(spectrogramGColourChanged(int))); | |
144 connect(spectrogramMColour, SIGNAL(currentIndexChanged(int)), | |
145 this, SLOT(spectrogramMColourChanged(int))); | |
126 | 146 |
127 m_tuningFrequency = prefs->getTuningFrequency(); | 147 m_tuningFrequency = prefs->getTuningFrequency(); |
128 | 148 |
129 QDoubleSpinBox *frequency = new QDoubleSpinBox; | 149 QDoubleSpinBox *frequency = new QDoubleSpinBox; |
130 frequency->setMinimum(100.0); | 150 frequency->setMinimum(100.0); |
147 } | 167 } |
148 octaveSystem->setCurrentIndex(oct); | 168 octaveSystem->setCurrentIndex(oct); |
149 | 169 |
150 connect(octaveSystem, SIGNAL(currentIndexChanged(int)), | 170 connect(octaveSystem, SIGNAL(currentIndexChanged(int)), |
151 this, SLOT(octaveSystemChanged(int))); | 171 this, SLOT(octaveSystemChanged(int))); |
152 | |
153 QSettings settings; | |
154 | 172 |
155 /*!!! restore | 173 /*!!! restore |
156 QComboBox *audioDevice = new QComboBox; | 174 QComboBox *audioDevice = new QComboBox; |
157 std::vector<QString> devices = | 175 std::vector<QString> devices = |
158 AudioTargetFactory::getInstance()->getCallbackTargetNames(); | 176 AudioTargetFactory::getInstance()->getCallbackTargetNames(); |
375 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 393 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
376 ("Property Box Layout"))), | 394 ("Property Box Layout"))), |
377 row, 0); | 395 row, 0); |
378 subgrid->addWidget(propertyLayout, row++, 1, 1, 2); | 396 subgrid->addWidget(propertyLayout, row++, 1, 1, 2); |
379 | 397 |
398 subgrid->addWidget(new QLabel(tr("Default spectrogram color:")), | |
399 row, 0); | |
400 subgrid->addWidget(spectrogramGColour, row++, 1, 1, 2); | |
401 | |
402 subgrid->addWidget(new QLabel(tr("Default melodic spectrogram color:")), | |
403 row, 0); | |
404 subgrid->addWidget(spectrogramMColour, row++, 1, 1, 2); | |
405 | |
380 #ifdef NOT_DEFINED // see earlier | 406 #ifdef NOT_DEFINED // see earlier |
381 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 407 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
382 ("Background Mode"))), | 408 ("Background Mode"))), |
383 row, 0); | 409 row, 0); |
384 subgrid->addWidget(bgMode, row++, 1, 1, 2); | 410 subgrid->addWidget(bgMode, row++, 1, 1, 2); |
532 | 558 |
533 void | 559 void |
534 PreferencesDialog::spectrogramXSmoothingChanged(int smoothing) | 560 PreferencesDialog::spectrogramXSmoothingChanged(int smoothing) |
535 { | 561 { |
536 m_spectrogramXSmoothing = smoothing; | 562 m_spectrogramXSmoothing = smoothing; |
563 m_applyButton->setEnabled(true); | |
564 } | |
565 | |
566 void | |
567 PreferencesDialog::spectrogramGColourChanged(int colour) | |
568 { | |
569 m_spectrogramGColour = colour; | |
570 m_applyButton->setEnabled(true); | |
571 } | |
572 | |
573 void | |
574 PreferencesDialog::spectrogramMColourChanged(int colour) | |
575 { | |
576 m_spectrogramMColour = colour; | |
537 m_applyButton->setEnabled(true); | 577 m_applyButton->setEnabled(true); |
538 } | 578 } |
539 | 579 |
540 void | 580 void |
541 PreferencesDialog::propertyLayoutChanged(int layout) | 581 PreferencesDialog::propertyLayoutChanged(int layout) |
708 //!!! settings.setValue("audio-target", devices[m_audioDevice]); | 748 //!!! settings.setValue("audio-target", devices[m_audioDevice]); |
709 settings.setValue("locale", m_currentLocale); | 749 settings.setValue("locale", m_currentLocale); |
710 #ifdef Q_OS_MAC | 750 #ifdef Q_OS_MAC |
711 settings.setValue("scaledHiDpi", m_retina); | 751 settings.setValue("scaledHiDpi", m_retina); |
712 #endif | 752 #endif |
753 settings.setValue("spectrogram-colour", m_spectrogramGColour); | |
754 settings.setValue("spectrogram-melodic-colour", m_spectrogramMColour); | |
713 settings.endGroup(); | 755 settings.endGroup(); |
714 | 756 |
715 settings.beginGroup("MainWindow"); | 757 settings.beginGroup("MainWindow"); |
716 settings.setValue("sessiontemplate", m_currentTemplate); | 758 settings.setValue("sessiontemplate", m_currentTemplate); |
717 settings.endGroup(); | 759 settings.endGroup(); |