comparison main/PreferencesDialog.cpp @ 299:15ce557e1bf8

* Restore (better quality) y-axis interpolation in spectrogram * Make spectrogram x axis interpolation a preference
author Chris Cannam
date Fri, 06 Feb 2009 15:06:23 +0000
parents 9d47adc3e32d
children a3b2cba73143
comparison
equal deleted inserted replaced
298:7872a95ee530 299:15ce557e1bf8
72 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)), 72 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)),
73 this, SLOT(windowTypeChanged(WindowType))); 73 this, SLOT(windowTypeChanged(WindowType)));
74 74
75 QComboBox *smoothing = new QComboBox; 75 QComboBox *smoothing = new QComboBox;
76 76
77 int sm = prefs->getPropertyRangeAndValue("Spectrogram Smoothing", &min, &max, 77 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max,
78 &deflt); 78 &deflt);
79 m_spectrogramSmoothing = sm; 79 m_spectrogramSmoothing = sm;
80 80
81 for (i = min; i <= max; ++i) { 81 for (i = min; i <= max; ++i) {
82 smoothing->addItem(prefs->getPropertyValueLabel("Spectrogram Smoothing", i)); 82 smoothing->addItem(prefs->getPropertyValueLabel("Spectrogram Y Smoothing", i));
83 } 83 }
84 84
85 smoothing->setCurrentIndex(sm); 85 smoothing->setCurrentIndex(sm);
86 86
87 connect(smoothing, SIGNAL(currentIndexChanged(int)), 87 connect(smoothing, SIGNAL(currentIndexChanged(int)),
88 this, SLOT(spectrogramSmoothingChanged(int))); 88 this, SLOT(spectrogramSmoothingChanged(int)));
89
90 QComboBox *xsmoothing = new QComboBox;
91
92 int xsm = prefs->getPropertyRangeAndValue("Spectrogram X Smoothing", &min, &max,
93 &deflt);
94 m_spectrogramXSmoothing = xsm;
95
96 for (i = min; i <= max; ++i) {
97 xsmoothing->addItem(prefs->getPropertyValueLabel("Spectrogram X Smoothing", i));
98 }
99
100 xsmoothing->setCurrentIndex(xsm);
101
102 connect(xsmoothing, SIGNAL(currentIndexChanged(int)),
103 this, SLOT(spectrogramXSmoothingChanged(int)));
89 104
90 QComboBox *propertyLayout = new QComboBox; 105 QComboBox *propertyLayout = new QComboBox;
91 int pl = prefs->getPropertyRangeAndValue("Property Box Layout", &min, &max, 106 int pl = prefs->getPropertyRangeAndValue("Property Box Layout", &min, &max,
92 &deflt); 107 &deflt);
93 m_propertyLayout = pl; 108 m_propertyLayout = pl;
276 ("Tuning Frequency"))), 291 ("Tuning Frequency"))),
277 row, 0); 292 row, 0);
278 subgrid->addWidget(frequency, row++, 1, 1, 2); 293 subgrid->addWidget(frequency, row++, 1, 1, 2);
279 294
280 subgrid->addWidget(new QLabel(prefs->getPropertyLabel 295 subgrid->addWidget(new QLabel(prefs->getPropertyLabel
281 ("Spectrogram Smoothing")), 296 ("Spectrogram Y Smoothing")),
282 row, 0); 297 row, 0);
283 subgrid->addWidget(smoothing, row++, 1, 1, 2); 298 subgrid->addWidget(smoothing, row++, 1, 1, 2);
299
300 subgrid->addWidget(new QLabel(prefs->getPropertyLabel
301 ("Spectrogram X Smoothing")),
302 row, 0);
303 subgrid->addWidget(xsmoothing, row++, 1, 1, 2);
284 304
285 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel 305 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
286 ("Window Type"))), 306 ("Window Type"))),
287 row, 0); 307 row, 0);
288 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2); 308 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2);
326 m_spectrogramSmoothing = smoothing; 346 m_spectrogramSmoothing = smoothing;
327 m_applyButton->setEnabled(true); 347 m_applyButton->setEnabled(true);
328 } 348 }
329 349
330 void 350 void
351 PreferencesDialog::spectrogramXSmoothingChanged(int smoothing)
352 {
353 m_spectrogramXSmoothing = smoothing;
354 m_applyButton->setEnabled(true);
355 }
356
357 void
331 PreferencesDialog::propertyLayoutChanged(int layout) 358 PreferencesDialog::propertyLayoutChanged(int layout)
332 { 359 {
333 m_propertyLayout = layout; 360 m_propertyLayout = layout;
334 m_applyButton->setEnabled(true); 361 m_applyButton->setEnabled(true);
335 } 362 }
418 { 445 {
419 Preferences *prefs = Preferences::getInstance(); 446 Preferences *prefs = Preferences::getInstance();
420 prefs->setWindowType(WindowType(m_windowType)); 447 prefs->setWindowType(WindowType(m_windowType));
421 prefs->setSpectrogramSmoothing(Preferences::SpectrogramSmoothing 448 prefs->setSpectrogramSmoothing(Preferences::SpectrogramSmoothing
422 (m_spectrogramSmoothing)); 449 (m_spectrogramSmoothing));
450 prefs->setSpectrogramXSmoothing(Preferences::SpectrogramXSmoothing
451 (m_spectrogramXSmoothing));
423 prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout 452 prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout
424 (m_propertyLayout)); 453 (m_propertyLayout));
425 prefs->setTuningFrequency(m_tuningFrequency); 454 prefs->setTuningFrequency(m_tuningFrequency);
426 prefs->setResampleQuality(m_resampleQuality); 455 prefs->setResampleQuality(m_resampleQuality);
427 prefs->setResampleOnLoad(m_resampleOnLoad); 456 prefs->setResampleOnLoad(m_resampleOnLoad);