diff main/PreferencesDialog.cpp @ 702:c7945dad2f49

Make octave numbering configurable, and change default to C4 = middle C
author Chris Cannam
date Thu, 27 Mar 2014 13:32:56 +0000
parents 7f7fba33b7de
children fbd2534d17f8
line wrap: on
line diff
--- a/main/PreferencesDialog.cpp	Tue Mar 11 17:29:58 2014 +0000
+++ b/main/PreferencesDialog.cpp	Thu Mar 27 13:32:56 2014 +0000
@@ -122,6 +122,8 @@
     connect(propertyLayout, SIGNAL(currentIndexChanged(int)),
             this, SLOT(propertyLayoutChanged(int)));
 
+    
+
     m_tuningFrequency = prefs->getTuningFrequency();
 
     QDoubleSpinBox *frequency = new QDoubleSpinBox;
@@ -135,6 +137,19 @@
     connect(frequency, SIGNAL(valueChanged(double)),
             this, SLOT(tuningFrequencyChanged(double)));
 
+    QComboBox *octaveSystem = new QComboBox;
+    int oct = prefs->getPropertyRangeAndValue
+        ("Octave Numbering System", &min, &max, &deflt);
+    m_octaveSystem = oct;
+    for (i = min; i <= max; ++i) {
+        octaveSystem->addItem(prefs->getPropertyValueLabel
+                              ("Octave Numbering System", i));
+    }
+    octaveSystem->setCurrentIndex(oct);
+
+    connect(octaveSystem, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(octaveSystemChanged(int)));
+
     QComboBox *audioDevice = new QComboBox;
     std::vector<QString> devices =
         AudioTargetFactory::getInstance()->getCallbackTargetNames();
@@ -370,6 +385,11 @@
                        row, 0);
     subgrid->addWidget(frequency, row++, 1, 1, 2);
 
+    subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
+                                                ("Octave Numbering System"))),
+                       row, 0);
+    subgrid->addWidget(octaveSystem, row++, 1, 1, 2);
+
     subgrid->addWidget(new QLabel(prefs->getPropertyLabel
                                   ("Spectrogram Y Smoothing")),
                        row, 0);
@@ -589,6 +609,13 @@
 }
 
 void
+PreferencesDialog::octaveSystemChanged(int system)
+{
+    m_octaveSystem = system;
+    m_applyButton->setEnabled(true);
+}
+
+void
 PreferencesDialog::viewFontSizeChanged(int sz)
 {
     m_viewFontSize = sz;
@@ -622,6 +649,8 @@
     prefs->setTimeToTextMode(Preferences::TimeToTextMode(m_timeToTextMode));
     prefs->setViewFontSize(m_viewFontSize);
     
+    prefs->setProperty("Octave Numbering System", m_octaveSystem);
+
     std::vector<QString> devices =
         AudioTargetFactory::getInstance()->getCallbackTargetNames();