Mercurial > hg > svgui
changeset 891:09b2940f483a
Update units when prefs change
author | Chris Cannam |
---|---|
date | Tue, 09 Dec 2014 12:17:04 +0000 |
parents | 1f2dc7fcad92 |
children | af63372e9002 |
files | widgets/UnitConverter.cpp widgets/UnitConverter.h |
diffstat | 2 files changed, 46 insertions(+), 9 deletions(-) [+] |
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() +{ +}
--- a/widgets/UnitConverter.h Tue Dec 09 11:49:27 2014 +0000 +++ b/widgets/UnitConverter.h Tue Dec 09 12:17:04 2014 +0000 @@ -17,9 +17,12 @@ #include <QDialog> +#include "base/PropertyContainer.h" + class QSpinBox; class QDoubleSpinBox; class QComboBox; +class QLabel; class UnitConverter : public QDialog { @@ -37,6 +40,7 @@ void centsChanged(double); void pianoChanged(int); + void preferenceChanged(PropertyContainer::PropertyName); private: QDoubleSpinBox *m_freq; @@ -45,8 +49,13 @@ QSpinBox *m_octave; QDoubleSpinBox *m_cents; QSpinBox *m_piano; + QLabel *m_pitchPrefsLabel; + void updatePitchesFromFreq(); + void updatePitchPrefsLabel(); - void updatePitchesFromFreq(); + QDoubleSpinBox *m_samples; + + void updateTempiFromSamples(); }; #endif