changeset 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 4ee8f295997b
children 049a9418cc27
files .hgsubstate main/PreferencesDialog.cpp main/PreferencesDialog.h
diffstat 3 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Tue Mar 11 17:29:58 2014 +0000
+++ b/.hgsubstate	Thu Mar 27 13:32:56 2014 +0000
@@ -1,5 +1,5 @@
 236814e07bd07473958c1ff89103124536a0c3c8 dataquay
 3c5adc4a864fa75e5b1e67c260b77541aaa4f1f6 sv-dependency-builds
 46b24009ce7a633a5150592720e192481e5adbb6 svapp
-7f97a4d9d14f09517a4e25f172305d5a9c64b36a svcore
+451f7f3ab6e7a1efeb603fdab0b5b9c9434d1e5b svcore
 d7e8cefedbbcb7bc6a54e3c1bfcc10ac21c208ff svgui
--- 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();
 
--- a/main/PreferencesDialog.h	Tue Mar 11 17:29:58 2014 +0000
+++ b/main/PreferencesDialog.h	Thu Mar 27 13:32:56 2014 +0000
@@ -57,6 +57,7 @@
     void tempDirRootChanged(QString root);
     void backgroundModeChanged(int mode);
     void timeToTextModeChanged(int mode);
+    void octaveSystemChanged(int system);
     void viewFontSizeChanged(int sz);
     void showSplashChanged(int state);
     void defaultTemplateChanged(int);
@@ -96,6 +97,7 @@
     QString m_tempDirRoot;
     int m_backgroundMode;
     int m_timeToTextMode;
+    int m_octaveSystem;
     int m_viewFontSize;
     bool m_showSplash;