Mercurial > hg > sonic-visualiser
comparison main/PreferencesDialog.cpp @ 1398:6f5a40419b00 bqaudioio
Merge from branch bqresample
author | Chris Cannam |
---|---|
date | Wed, 07 Dec 2016 11:53:44 +0000 |
parents | 558347e7e1ab |
children | a89ca5ccb958 |
comparison
equal
deleted
inserted
replaced
1044:be5b29ce283b | 1398:6f5a40419b00 |
---|---|
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 | 43 #include "layer/ColourMapper.h" |
44 //#include "audioio/AudioTargetFactory.h" | 44 |
45 #include "bqaudioio/AudioFactory.h" | |
45 | 46 |
46 #include "version.h" | 47 #include "version.h" |
48 | |
49 using namespace std; | |
47 | 50 |
48 PreferencesDialog::PreferencesDialog(QWidget *parent) : | 51 PreferencesDialog::PreferencesDialog(QWidget *parent) : |
49 QDialog(parent), | 52 QDialog(parent), |
50 m_audioDevice(0), | 53 m_audioImplementation(0), |
54 m_audioPlaybackDevice(0), | |
55 m_audioRecordDevice(0), | |
51 m_changesOnRestart(false) | 56 m_changesOnRestart(false) |
52 { | 57 { |
53 setWindowTitle(tr("Sonic Visualiser: Application Preferences")); | 58 setWindowTitle(tr("Sonic Visualiser: Application Preferences")); |
54 | 59 |
55 Preferences *prefs = Preferences::getInstance(); | 60 Preferences *prefs = Preferences::getInstance(); |
77 m_windowTypeSelector = new WindowTypeSelector(m_windowType); | 82 m_windowTypeSelector = new WindowTypeSelector(m_windowType); |
78 | 83 |
79 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)), | 84 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)), |
80 this, SLOT(windowTypeChanged(WindowType))); | 85 this, SLOT(windowTypeChanged(WindowType))); |
81 | 86 |
87 QCheckBox *vampProcessSeparation = new QCheckBox; | |
88 m_runPluginsInProcess = prefs->getRunPluginsInProcess(); | |
89 vampProcessSeparation->setCheckState(m_runPluginsInProcess ? Qt::Unchecked : | |
90 Qt::Checked); | |
91 connect(vampProcessSeparation, SIGNAL(stateChanged(int)), | |
92 this, SLOT(vampProcessSeparationChanged(int))); | |
93 | |
82 QComboBox *smoothing = new QComboBox; | 94 QComboBox *smoothing = new QComboBox; |
83 | 95 |
84 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max, | 96 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max, |
85 &deflt); | 97 &deflt); |
86 m_spectrogramSmoothing = sm; | 98 m_spectrogramSmoothing = sm; |
121 propertyLayout->setCurrentIndex(pl); | 133 propertyLayout->setCurrentIndex(pl); |
122 | 134 |
123 connect(propertyLayout, SIGNAL(currentIndexChanged(int)), | 135 connect(propertyLayout, SIGNAL(currentIndexChanged(int)), |
124 this, SLOT(propertyLayoutChanged(int))); | 136 this, SLOT(propertyLayoutChanged(int))); |
125 | 137 |
138 QSettings settings; | |
139 settings.beginGroup("Preferences"); | |
140 m_spectrogramGColour = (settings.value("spectrogram-colour", | |
141 int(ColourMapper::Green)).toInt()); | |
142 m_spectrogramMColour = (settings.value("spectrogram-melodic-colour", | |
143 int(ColourMapper::Sunset)).toInt()); | |
144 m_colour3DColour = (settings.value("colour-3d-plot-colour", | |
145 int(ColourMapper::Green)).toInt()); | |
146 settings.endGroup(); | |
147 QComboBox *spectrogramGColour = new QComboBox; | |
148 QComboBox *spectrogramMColour = new QComboBox; | |
149 QComboBox *colour3DColour = new QComboBox; | |
150 for (i = 0; i < ColourMapper::getColourMapCount(); ++i) { | |
151 spectrogramGColour->addItem(ColourMapper::getColourMapName(i)); | |
152 spectrogramMColour->addItem(ColourMapper::getColourMapName(i)); | |
153 colour3DColour->addItem(ColourMapper::getColourMapName(i)); | |
154 if (i == m_spectrogramGColour) spectrogramGColour->setCurrentIndex(i); | |
155 if (i == m_spectrogramMColour) spectrogramMColour->setCurrentIndex(i); | |
156 if (i == m_colour3DColour) colour3DColour->setCurrentIndex(i); | |
157 } | |
158 connect(spectrogramGColour, SIGNAL(currentIndexChanged(int)), | |
159 this, SLOT(spectrogramGColourChanged(int))); | |
160 connect(spectrogramMColour, SIGNAL(currentIndexChanged(int)), | |
161 this, SLOT(spectrogramMColourChanged(int))); | |
162 connect(colour3DColour, SIGNAL(currentIndexChanged(int)), | |
163 this, SLOT(colour3DColourChanged(int))); | |
126 | 164 |
127 m_tuningFrequency = prefs->getTuningFrequency(); | 165 m_tuningFrequency = prefs->getTuningFrequency(); |
128 | 166 |
129 QDoubleSpinBox *frequency = new QDoubleSpinBox; | 167 QDoubleSpinBox *frequency = new QDoubleSpinBox; |
130 frequency->setMinimum(100.0); | 168 frequency->setMinimum(100.0); |
148 octaveSystem->setCurrentIndex(oct); | 186 octaveSystem->setCurrentIndex(oct); |
149 | 187 |
150 connect(octaveSystem, SIGNAL(currentIndexChanged(int)), | 188 connect(octaveSystem, SIGNAL(currentIndexChanged(int)), |
151 this, SLOT(octaveSystemChanged(int))); | 189 this, SLOT(octaveSystemChanged(int))); |
152 | 190 |
153 QSettings settings; | |
154 | |
155 /*!!! restore | |
156 QComboBox *audioDevice = new QComboBox; | |
157 std::vector<QString> devices = | |
158 AudioTargetFactory::getInstance()->getCallbackTargetNames(); | |
159 | |
160 settings.beginGroup("Preferences"); | 191 settings.beginGroup("Preferences"); |
161 QString targetName = settings.value("audio-target", "").toString(); | 192 |
193 QComboBox *audioImplementation = new QComboBox; | |
194 connect(audioImplementation, SIGNAL(currentIndexChanged(int)), | |
195 this, SLOT(audioImplementationChanged(int))); | |
196 | |
197 m_audioPlaybackDeviceCombo = new QComboBox; | |
198 connect(m_audioPlaybackDeviceCombo, SIGNAL(currentIndexChanged(int)), | |
199 this, SLOT(audioPlaybackDeviceChanged(int))); | |
200 | |
201 m_audioRecordDeviceCombo = new QComboBox; | |
202 connect(m_audioRecordDeviceCombo, SIGNAL(currentIndexChanged(int)), | |
203 this, SLOT(audioRecordDeviceChanged(int))); | |
204 | |
205 vector<string> names = breakfastquay::AudioFactory::getImplementationNames(); | |
206 QString implementationName = settings.value("audio-target", "").toString(); | |
207 if (implementationName == "auto") implementationName = ""; | |
208 audioImplementation->addItem(tr("(auto)")); | |
209 m_audioImplementation = 0; | |
210 for (int i = 0; in_range_for(names, i); ++i) { | |
211 audioImplementation->addItem | |
212 (breakfastquay::AudioFactory::getImplementationDescription(names[i]). | |
213 c_str()); | |
214 if (implementationName.toStdString() == names[i]) { | |
215 audioImplementation->setCurrentIndex(i+1); | |
216 m_audioImplementation = i+1; | |
217 } | |
218 } | |
162 settings.endGroup(); | 219 settings.endGroup(); |
163 | 220 |
164 for (int i = 0; i < (int)devices.size(); ++i) { | 221 rebuildDeviceCombos(); |
165 audioDevice->addItem(AudioTargetFactory::getInstance() | 222 m_changesOnRestart = false; // the rebuild will have changed this |
166 ->getCallbackTargetDescription(devices[i])); | |
167 if (targetName == devices[i]) audioDevice->setCurrentIndex(i); | |
168 } | |
169 | |
170 connect(audioDevice, SIGNAL(currentIndexChanged(int)), | |
171 this, SLOT(audioDeviceChanged(int))); | |
172 */ | |
173 QComboBox *resampleQuality = new QComboBox; | |
174 | |
175 int rsq = prefs->getPropertyRangeAndValue("Resample Quality", &min, &max, | |
176 &deflt); | |
177 m_resampleQuality = rsq; | |
178 | |
179 for (i = min; i <= max; ++i) { | |
180 resampleQuality->addItem(prefs->getPropertyValueLabel("Resample Quality", i)); | |
181 } | |
182 | |
183 resampleQuality->setCurrentIndex(rsq); | |
184 | |
185 connect(resampleQuality, SIGNAL(currentIndexChanged(int)), | |
186 this, SLOT(resampleQualityChanged(int))); | |
187 | 223 |
188 QCheckBox *resampleOnLoad = new QCheckBox; | 224 QCheckBox *resampleOnLoad = new QCheckBox; |
189 m_resampleOnLoad = prefs->getResampleOnLoad(); | 225 m_resampleOnLoad = prefs->getResampleOnLoad(); |
190 resampleOnLoad->setCheckState(m_resampleOnLoad ? Qt::Checked : | 226 resampleOnLoad->setCheckState(m_resampleOnLoad ? Qt::Checked : |
191 Qt::Unchecked); | 227 Qt::Unchecked); |
192 connect(resampleOnLoad, SIGNAL(stateChanged(int)), | 228 connect(resampleOnLoad, SIGNAL(stateChanged(int)), |
193 this, SLOT(resampleOnLoadChanged(int))); | 229 this, SLOT(resampleOnLoadChanged(int))); |
230 | |
231 QCheckBox *gaplessMode = new QCheckBox; | |
232 m_gapless = prefs->getUseGaplessMode(); | |
233 gaplessMode->setCheckState(m_gapless ? Qt::Checked : Qt::Unchecked); | |
234 connect(gaplessMode, SIGNAL(stateChanged(int)), | |
235 this, SLOT(gaplessModeChanged(int))); | |
194 | 236 |
195 m_tempDirRootEdit = new QLineEdit; | 237 m_tempDirRootEdit = new QLineEdit; |
196 QString dir = prefs->getTemporaryDirectoryRoot(); | 238 QString dir = prefs->getTemporaryDirectoryRoot(); |
197 m_tempDirRoot = dir; | 239 m_tempDirRoot = dir; |
198 dir.replace("$HOME", tr("<home directory>")); | 240 dir.replace("$HOME", tr("<home directory>")); |
208 m_showSplash = prefs->getShowSplash(); | 250 m_showSplash = prefs->getShowSplash(); |
209 showSplash->setCheckState(m_showSplash ? Qt::Checked : Qt::Unchecked); | 251 showSplash->setCheckState(m_showSplash ? Qt::Checked : Qt::Unchecked); |
210 connect(showSplash, SIGNAL(stateChanged(int)), | 252 connect(showSplash, SIGNAL(stateChanged(int)), |
211 this, SLOT(showSplashChanged(int))); | 253 this, SLOT(showSplashChanged(int))); |
212 | 254 |
213 #ifndef Q_OS_MAC | 255 #ifdef NOT_DEFINED // This no longer works correctly on any platform AFAICS |
214 QComboBox *bgMode = new QComboBox; | 256 QComboBox *bgMode = new QComboBox; |
215 int bg = prefs->getPropertyRangeAndValue("Background Mode", &min, &max, | 257 int bg = prefs->getPropertyRangeAndValue("Background Mode", &min, &max, |
216 &deflt); | 258 &deflt); |
217 m_backgroundMode = bg; | 259 m_backgroundMode = bg; |
218 for (i = min; i <= max; ++i) { | 260 for (i = min; i <= max; ++i) { |
223 connect(bgMode, SIGNAL(currentIndexChanged(int)), | 265 connect(bgMode, SIGNAL(currentIndexChanged(int)), |
224 this, SLOT(backgroundModeChanged(int))); | 266 this, SLOT(backgroundModeChanged(int))); |
225 #endif | 267 #endif |
226 | 268 |
227 settings.beginGroup("Preferences"); | 269 settings.beginGroup("Preferences"); |
270 | |
271 #ifdef Q_OS_MAC | |
272 m_retina = settings.value("scaledHiDpi", true).toBool(); | |
273 QCheckBox *retina = new QCheckBox; | |
274 retina->setCheckState(m_retina ? Qt::Checked : Qt::Unchecked); | |
275 connect(retina, SIGNAL(stateChanged(int)), this, SLOT(retinaChanged(int))); | |
276 #else | |
277 m_retina = false; | |
278 #endif | |
228 | 279 |
229 QString userLocale = settings.value("locale", "").toString(); | 280 QString userLocale = settings.value("locale", "").toString(); |
230 m_currentLocale = userLocale; | 281 m_currentLocale = userLocale; |
231 | 282 |
232 QString permishTag = QString("network-permission-%1").arg(SV_VERSION); | 283 QString permishTag = QString("network-permission-%1").arg(SV_VERSION); |
329 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 380 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
330 ("Resample On Load"))), | 381 ("Resample On Load"))), |
331 row, 0); | 382 row, 0); |
332 subgrid->addWidget(resampleOnLoad, row++, 1, 1, 1); | 383 subgrid->addWidget(resampleOnLoad, row++, 1, 1, 1); |
333 | 384 |
334 //!!! subgrid->addWidget(new QLabel(tr("Playback audio device:")), row, 0); | 385 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
335 //!!! subgrid->addWidget(audioDevice, row++, 1, 1, 2); | 386 ("Use Gapless Mode"))), |
336 | 387 row, 0); |
337 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 388 subgrid->addWidget(gaplessMode, row++, 1, 1, 1); |
338 ("Resample Quality"))), | 389 |
339 row, 0); | 390 subgrid->addWidget(new QLabel(tr("Audio service:")), row, 0); |
340 subgrid->addWidget(resampleQuality, row++, 1, 1, 2); | 391 subgrid->addWidget(audioImplementation, row++, 1, 1, 2); |
392 | |
393 subgrid->addWidget(new QLabel(tr("Audio playback device:")), row, 0); | |
394 subgrid->addWidget(m_audioPlaybackDeviceCombo, row++, 1, 1, 2); | |
395 | |
396 subgrid->addWidget(new QLabel(tr("Audio record device:")), row, 0); | |
397 subgrid->addWidget(m_audioRecordDeviceCombo, row++, 1, 1, 2); | |
341 | 398 |
342 subgrid->setRowStretch(row, 10); | 399 subgrid->setRowStretch(row, 10); |
343 | 400 |
344 m_tabOrdering[GeneralTab] = m_tabs->count(); | 401 m_tabOrdering[GeneralTab] = m_tabs->count(); |
345 m_tabs->addTab(frame, tr("&General")); | 402 m_tabs->addTab(frame, tr("&General")); |
354 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 411 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
355 ("Show Splash Screen"))), | 412 ("Show Splash Screen"))), |
356 row, 0); | 413 row, 0); |
357 subgrid->addWidget(showSplash, row++, 1, 1, 1); | 414 subgrid->addWidget(showSplash, row++, 1, 1, 1); |
358 | 415 |
416 #ifdef Q_OS_MAC | |
417 if (devicePixelRatio() > 1) { | |
418 subgrid->addWidget(new QLabel(tr("Draw layers at Retina resolution:")), row, 0); | |
419 subgrid->addWidget(retina, row++, 1, 1, 1); | |
420 } | |
421 #endif | |
422 | |
359 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 423 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
360 ("Property Box Layout"))), | 424 ("Property Box Layout"))), |
361 row, 0); | 425 row, 0); |
362 subgrid->addWidget(propertyLayout, row++, 1, 1, 2); | 426 subgrid->addWidget(propertyLayout, row++, 1, 1, 2); |
363 | 427 |
364 #ifndef Q_OS_MAC | 428 subgrid->addWidget(new QLabel(tr("Default spectrogram colour:")), |
429 row, 0); | |
430 subgrid->addWidget(spectrogramGColour, row++, 1, 1, 2); | |
431 | |
432 subgrid->addWidget(new QLabel(tr("Default melodic spectrogram colour:")), | |
433 row, 0); | |
434 subgrid->addWidget(spectrogramMColour, row++, 1, 1, 2); | |
435 | |
436 subgrid->addWidget(new QLabel(tr("Default colour 3D plot colour:")), | |
437 row, 0); | |
438 subgrid->addWidget(colour3DColour, row++, 1, 1, 2); | |
439 | |
440 #ifdef NOT_DEFINED // see earlier | |
365 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 441 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
366 ("Background Mode"))), | 442 ("Background Mode"))), |
367 row, 0); | 443 row, 0); |
368 subgrid->addWidget(bgMode, row++, 1, 1, 2); | 444 subgrid->addWidget(bgMode, row++, 1, 1, 2); |
369 #endif | 445 #endif |
417 | 493 |
418 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel | 494 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel |
419 ("Window Type"))), | 495 ("Window Type"))), |
420 row, 0); | 496 row, 0); |
421 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2); | 497 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2); |
498 | |
422 subgrid->setRowStretch(row, 10); | 499 subgrid->setRowStretch(row, 10); |
423 row++; | 500 row++; |
501 | |
502 subgrid->addWidget(new QLabel(tr("Run Vamp plugins in separate process:")), | |
503 row, 0); | |
504 subgrid->addWidget(vampProcessSeparation, row++, 1, 1, 1); | |
424 | 505 |
425 subgrid->setRowStretch(row, 10); | 506 subgrid->setRowStretch(row, 10); |
426 | 507 |
427 m_tabOrdering[AnalysisTab] = m_tabs->count(); | 508 m_tabOrdering[AnalysisTab] = m_tabs->count(); |
428 m_tabs->addTab(frame, tr("Anal&ysis")); | 509 m_tabs->addTab(frame, tr("Anal&ysis")); |
451 } | 532 } |
452 m_templates.push_back(""); | 533 m_templates.push_back(""); |
453 | 534 |
454 QStringList templates = ResourceFinder().getResourceFiles("templates", "svt"); | 535 QStringList templates = ResourceFinder().getResourceFiles("templates", "svt"); |
455 | 536 |
456 std::set<QString> byName; | 537 set<QString> byName; |
457 foreach (QString t, templates) { | 538 foreach (QString t, templates) { |
458 byName.insert(QFileInfo(t).baseName()); | 539 byName.insert(QFileInfo(t).baseName()); |
459 } | 540 } |
460 | 541 |
461 foreach (QString t, byName) { | 542 foreach (QString t, byName) { |
491 { | 572 { |
492 SVDEBUG << "PreferencesDialog::~PreferencesDialog()" << endl; | 573 SVDEBUG << "PreferencesDialog::~PreferencesDialog()" << endl; |
493 } | 574 } |
494 | 575 |
495 void | 576 void |
577 PreferencesDialog::rebuildDeviceCombos() | |
578 { | |
579 QSettings settings; | |
580 settings.beginGroup("Preferences"); | |
581 | |
582 vector<string> names = breakfastquay::AudioFactory::getImplementationNames(); | |
583 string implementationName; | |
584 if (in_range_for(names, m_audioImplementation-1)) { | |
585 implementationName = names[m_audioImplementation-1]; | |
586 } | |
587 | |
588 m_audioPlaybackDeviceCombo->clear(); | |
589 m_audioRecordDeviceCombo->clear(); | |
590 | |
591 QString suffix; | |
592 if (implementationName != "") { | |
593 suffix = "-" + QString(implementationName.c_str()); | |
594 } | |
595 | |
596 names = breakfastquay::AudioFactory::getPlaybackDeviceNames(implementationName); | |
597 QString playbackDeviceName = settings.value | |
598 ("audio-playback-device" + suffix, "").toString(); | |
599 m_audioPlaybackDeviceCombo->addItem(tr("(auto)")); | |
600 m_audioPlaybackDeviceCombo->setCurrentIndex(0); | |
601 m_audioPlaybackDevice = 0; | |
602 for (int i = 0; in_range_for(names, i); ++i) { | |
603 m_audioPlaybackDeviceCombo->addItem(names[i].c_str()); | |
604 if (playbackDeviceName.toStdString() == names[i]) { | |
605 m_audioPlaybackDeviceCombo->setCurrentIndex(i+1); | |
606 m_audioPlaybackDevice = i+1; | |
607 } | |
608 } | |
609 | |
610 names = breakfastquay::AudioFactory::getRecordDeviceNames(implementationName); | |
611 QString recordDeviceName = settings.value | |
612 ("audio-record-device" + suffix, "").toString(); | |
613 m_audioRecordDeviceCombo->addItem(tr("(auto)")); | |
614 m_audioRecordDeviceCombo->setCurrentIndex(0); | |
615 m_audioRecordDevice = 0; | |
616 for (int i = 0; in_range_for(names, i); ++i) { | |
617 m_audioRecordDeviceCombo->addItem(names[i].c_str()); | |
618 if (recordDeviceName.toStdString() == names[i]) { | |
619 m_audioRecordDeviceCombo->setCurrentIndex(i+1); | |
620 m_audioRecordDevice = i+1; | |
621 } | |
622 } | |
623 | |
624 settings.endGroup(); | |
625 } | |
626 | |
627 void | |
496 PreferencesDialog::switchToTab(Tab t) | 628 PreferencesDialog::switchToTab(Tab t) |
497 { | 629 { |
498 if (m_tabOrdering.contains(t)) { | 630 if (m_tabOrdering.contains(t)) { |
499 m_tabs->setCurrentIndex(m_tabOrdering[t]); | 631 m_tabs->setCurrentIndex(m_tabOrdering[t]); |
500 } | 632 } |
520 m_spectrogramXSmoothing = smoothing; | 652 m_spectrogramXSmoothing = smoothing; |
521 m_applyButton->setEnabled(true); | 653 m_applyButton->setEnabled(true); |
522 } | 654 } |
523 | 655 |
524 void | 656 void |
657 PreferencesDialog::spectrogramGColourChanged(int colour) | |
658 { | |
659 m_spectrogramGColour = colour; | |
660 m_applyButton->setEnabled(true); | |
661 } | |
662 | |
663 void | |
664 PreferencesDialog::spectrogramMColourChanged(int colour) | |
665 { | |
666 m_spectrogramMColour = colour; | |
667 m_applyButton->setEnabled(true); | |
668 } | |
669 | |
670 void | |
671 PreferencesDialog::colour3DColourChanged(int colour) | |
672 { | |
673 m_colour3DColour = colour; | |
674 m_applyButton->setEnabled(true); | |
675 } | |
676 | |
677 void | |
525 PreferencesDialog::propertyLayoutChanged(int layout) | 678 PreferencesDialog::propertyLayoutChanged(int layout) |
526 { | 679 { |
527 m_propertyLayout = layout; | 680 m_propertyLayout = layout; |
528 m_applyButton->setEnabled(true); | 681 m_applyButton->setEnabled(true); |
529 } | 682 } |
534 m_tuningFrequency = freq; | 687 m_tuningFrequency = freq; |
535 m_applyButton->setEnabled(true); | 688 m_applyButton->setEnabled(true); |
536 } | 689 } |
537 | 690 |
538 void | 691 void |
539 PreferencesDialog::audioDeviceChanged(int s) | 692 PreferencesDialog::audioImplementationChanged(int s) |
540 { | 693 { |
541 m_audioDevice = s; | 694 if (m_audioImplementation != s) { |
695 m_audioImplementation = s; | |
696 rebuildDeviceCombos(); | |
697 m_applyButton->setEnabled(true); | |
698 m_changesOnRestart = true; | |
699 } | |
700 } | |
701 | |
702 void | |
703 PreferencesDialog::audioPlaybackDeviceChanged(int s) | |
704 { | |
705 if (m_audioPlaybackDevice != s) { | |
706 m_audioPlaybackDevice = s; | |
707 m_applyButton->setEnabled(true); | |
708 m_changesOnRestart = true; | |
709 } | |
710 } | |
711 | |
712 void | |
713 PreferencesDialog::audioRecordDeviceChanged(int s) | |
714 { | |
715 if (m_audioRecordDevice != s) { | |
716 m_audioRecordDevice = s; | |
717 m_applyButton->setEnabled(true); | |
718 m_changesOnRestart = true; | |
719 } | |
720 } | |
721 | |
722 void | |
723 PreferencesDialog::resampleOnLoadChanged(int state) | |
724 { | |
725 m_resampleOnLoad = (state == Qt::Checked); | |
542 m_applyButton->setEnabled(true); | 726 m_applyButton->setEnabled(true); |
543 m_changesOnRestart = true; | 727 m_changesOnRestart = true; |
544 } | 728 } |
545 | 729 |
546 void | 730 void |
547 PreferencesDialog::resampleQualityChanged(int q) | 731 PreferencesDialog::gaplessModeChanged(int state) |
548 { | 732 { |
549 m_resampleQuality = q; | 733 m_gapless = (state == Qt::Checked); |
550 m_applyButton->setEnabled(true); | 734 m_applyButton->setEnabled(true); |
551 } | 735 } |
552 | 736 |
553 void | 737 void |
554 PreferencesDialog::resampleOnLoadChanged(int state) | 738 PreferencesDialog::vampProcessSeparationChanged(int state) |
555 { | 739 { |
556 m_resampleOnLoad = (state == Qt::Checked); | 740 m_runPluginsInProcess = (state == Qt::Unchecked); |
557 m_applyButton->setEnabled(true); | 741 m_applyButton->setEnabled(true); |
558 m_changesOnRestart = true; | 742 m_changesOnRestart = true; |
559 } | 743 } |
560 | 744 |
561 void | 745 void |
562 PreferencesDialog::networkPermissionChanged(int state) | 746 PreferencesDialog::networkPermissionChanged(int state) |
563 { | 747 { |
564 m_networkPermission = (state == Qt::Checked); | 748 m_networkPermission = (state == Qt::Checked); |
565 m_applyButton->setEnabled(true); | 749 m_applyButton->setEnabled(true); |
566 m_changesOnRestart = true; | 750 m_changesOnRestart = true; |
751 } | |
752 | |
753 void | |
754 PreferencesDialog::retinaChanged(int state) | |
755 { | |
756 m_retina = (state == Qt::Checked); | |
757 m_applyButton->setEnabled(true); | |
758 // Does not require a restart | |
567 } | 759 } |
568 | 760 |
569 void | 761 void |
570 PreferencesDialog::showSplashChanged(int state) | 762 PreferencesDialog::showSplashChanged(int state) |
571 { | 763 { |
661 prefs->setSpectrogramXSmoothing(Preferences::SpectrogramXSmoothing | 853 prefs->setSpectrogramXSmoothing(Preferences::SpectrogramXSmoothing |
662 (m_spectrogramXSmoothing)); | 854 (m_spectrogramXSmoothing)); |
663 prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout | 855 prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout |
664 (m_propertyLayout)); | 856 (m_propertyLayout)); |
665 prefs->setTuningFrequency(m_tuningFrequency); | 857 prefs->setTuningFrequency(m_tuningFrequency); |
666 prefs->setResampleQuality(m_resampleQuality); | |
667 prefs->setResampleOnLoad(m_resampleOnLoad); | 858 prefs->setResampleOnLoad(m_resampleOnLoad); |
859 prefs->setUseGaplessMode(m_gapless); | |
860 prefs->setRunPluginsInProcess(m_runPluginsInProcess); | |
668 prefs->setShowSplash(m_showSplash); | 861 prefs->setShowSplash(m_showSplash); |
669 prefs->setTemporaryDirectoryRoot(m_tempDirRoot); | 862 prefs->setTemporaryDirectoryRoot(m_tempDirRoot); |
670 prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode)); | 863 prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode)); |
671 prefs->setTimeToTextMode(Preferences::TimeToTextMode(m_timeToTextMode)); | 864 prefs->setTimeToTextMode(Preferences::TimeToTextMode(m_timeToTextMode)); |
672 prefs->setShowHMS(m_showHMS); | 865 prefs->setShowHMS(m_showHMS); |
673 prefs->setViewFontSize(m_viewFontSize); | 866 prefs->setViewFontSize(m_viewFontSize); |
674 | 867 |
675 prefs->setProperty("Octave Numbering System", m_octaveSystem); | 868 prefs->setProperty("Octave Numbering System", m_octaveSystem); |
676 | 869 |
677 //!!! std::vector<QString> devices = | |
678 //!!! AudioTargetFactory::getInstance()->getCallbackTargetNames(); | |
679 | |
680 QSettings settings; | 870 QSettings settings; |
681 settings.beginGroup("Preferences"); | 871 settings.beginGroup("Preferences"); |
682 QString permishTag = QString("network-permission-%1").arg(SV_VERSION); | 872 QString permishTag = QString("network-permission-%1").arg(SV_VERSION); |
683 settings.setValue(permishTag, m_networkPermission); | 873 settings.setValue(permishTag, m_networkPermission); |
684 //!!! settings.setValue("audio-target", devices[m_audioDevice]); | 874 |
875 vector<string> names = breakfastquay::AudioFactory::getImplementationNames(); | |
876 string implementationName; | |
877 if (m_audioImplementation > 0) { | |
878 implementationName = names[m_audioImplementation-1]; | |
879 } | |
880 settings.setValue("audio-target", implementationName.c_str()); | |
881 | |
882 QString suffix; | |
883 if (implementationName != "") { | |
884 suffix = "-" + QString(implementationName.c_str()); | |
885 } | |
886 | |
887 names = breakfastquay::AudioFactory::getPlaybackDeviceNames(implementationName); | |
888 string deviceName; | |
889 if (m_audioPlaybackDevice > 0) { | |
890 deviceName = names[m_audioPlaybackDevice-1]; | |
891 } | |
892 settings.setValue("audio-playback-device" + suffix, deviceName.c_str()); | |
893 | |
894 names = breakfastquay::AudioFactory::getRecordDeviceNames(implementationName); | |
895 deviceName = ""; | |
896 if (m_audioRecordDevice > 0) { | |
897 deviceName = names[m_audioRecordDevice-1]; | |
898 } | |
899 settings.setValue("audio-record-device" + suffix, deviceName.c_str()); | |
900 | |
685 settings.setValue("locale", m_currentLocale); | 901 settings.setValue("locale", m_currentLocale); |
902 #ifdef Q_OS_MAC | |
903 settings.setValue("scaledHiDpi", m_retina); | |
904 #endif | |
905 settings.setValue("spectrogram-colour", m_spectrogramGColour); | |
906 settings.setValue("spectrogram-melodic-colour", m_spectrogramMColour); | |
907 settings.setValue("colour-3d-plot-colour", m_colour3DColour); | |
686 settings.endGroup(); | 908 settings.endGroup(); |
687 | 909 |
688 settings.beginGroup("MainWindow"); | 910 settings.beginGroup("MainWindow"); |
689 settings.setValue("sessiontemplate", m_currentTemplate); | 911 settings.setValue("sessiontemplate", m_currentTemplate); |
690 settings.endGroup(); | 912 settings.endGroup(); |