diff widgets/UnitConverter.cpp @ 891:09b2940f483a

Update units when prefs change
author Chris Cannam
date Tue, 09 Dec 2014 12:17:04 +0000
parents 1f2dc7fcad92
children af63372e9002
line wrap: on
line diff
--- a/widgets/UnitConverter.cpp	Tue Dec 09 11:49:27 2014 +0000
+++ b/widgets/UnitConverter.cpp	Tue Dec 09 12:17:04 2014 +0000
@@ -114,13 +114,8 @@
     
     ++row;
 
-    grid->addWidget
-	(new QLabel(tr("With concert A tuning frequency at %1 Hz, and "
-		       "middle C residing in octave %2.\n"
-		       "(These can be changed in the application preferences.)")
-		    .arg(Preferences::getInstance()->getTuningFrequency())
-		    .arg(Preferences::getInstance()->getOctaveOfMiddleC())),
-	 row, 0, 1, 9);
+    m_pitchPrefsLabel = new QLabel;
+    grid->addWidget(m_pitchPrefsLabel, row, 0, 1, 9);
 
     ++row;
     
@@ -130,8 +125,20 @@
 	 row, 0, 1, 9);
 
     ++row;
+    
+    frame = new QFrame;
+    tabs->addTab(frame, tr("Tempo"));
+    
+    grid = new QGridLayout;
+    frame->setLayout(grid);
 
+    connect(Preferences::getInstance(),
+	    SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
+	    this, SLOT(preferenceChanged(PropertyContainer::PropertyName)));
+    
     updatePitchesFromFreq();
+    updatePitchPrefsLabel();
+    updateTempiFromSamples();
 }
 
 UnitConverter::~UnitConverter()
@@ -139,6 +146,24 @@
 }
 
 void
+UnitConverter::preferenceChanged(PropertyContainer::PropertyName)
+{
+    updatePitchesFromFreq();
+    updatePitchPrefsLabel();
+}
+
+void
+UnitConverter::updatePitchPrefsLabel()
+{
+    m_pitchPrefsLabel->setText
+	(tr("With concert-A tuning frequency at %1 Hz, and "
+	    "middle C residing in octave %2.\n"
+	    "(These can be changed in the application preferences.)")
+	 .arg(Preferences::getInstance()->getTuningFrequency())
+	 .arg(Preferences::getInstance()->getOctaveOfMiddleC()));
+}
+
+void
 UnitConverter::freqChanged(double freq)
 {
     cerr << "freqChanged: " << freq << endl;
@@ -217,6 +242,9 @@
     m_octave->blockSignals(false);
 }
 
-
+void
+UnitConverter::updateTempiFromSamples()
+{
+}