Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
890:1f2dc7fcad92 | 891:09b2940f483a |
---|---|
112 grid->addWidget(new QLabel(tr("MIDI pitch")), row, 2, 1, 2); | 112 grid->addWidget(new QLabel(tr("MIDI pitch")), row, 2, 1, 2); |
113 grid->addWidget(m_midi, row, 4); | 113 grid->addWidget(m_midi, row, 4); |
114 | 114 |
115 ++row; | 115 ++row; |
116 | 116 |
117 grid->addWidget | 117 m_pitchPrefsLabel = new QLabel; |
118 (new QLabel(tr("With concert A tuning frequency at %1 Hz, and " | 118 grid->addWidget(m_pitchPrefsLabel, row, 0, 1, 9); |
119 "middle C residing in octave %2.\n" | |
120 "(These can be changed in the application preferences.)") | |
121 .arg(Preferences::getInstance()->getTuningFrequency()) | |
122 .arg(Preferences::getInstance()->getOctaveOfMiddleC())), | |
123 row, 0, 1, 9); | |
124 | 119 |
125 ++row; | 120 ++row; |
126 | 121 |
127 grid->addWidget | 122 grid->addWidget |
128 (new QLabel(tr("Note that only pitches in the range 0 to 127 are valid " | 123 (new QLabel(tr("Note that only pitches in the range 0 to 127 are valid " |
129 "in the MIDI protocol.")), | 124 "in the MIDI protocol.")), |
130 row, 0, 1, 9); | 125 row, 0, 1, 9); |
131 | 126 |
132 ++row; | 127 ++row; |
133 | 128 |
129 frame = new QFrame; | |
130 tabs->addTab(frame, tr("Tempo")); | |
131 | |
132 grid = new QGridLayout; | |
133 frame->setLayout(grid); | |
134 | |
135 connect(Preferences::getInstance(), | |
136 SIGNAL(propertyChanged(PropertyContainer::PropertyName)), | |
137 this, SLOT(preferenceChanged(PropertyContainer::PropertyName))); | |
138 | |
134 updatePitchesFromFreq(); | 139 updatePitchesFromFreq(); |
140 updatePitchPrefsLabel(); | |
141 updateTempiFromSamples(); | |
135 } | 142 } |
136 | 143 |
137 UnitConverter::~UnitConverter() | 144 UnitConverter::~UnitConverter() |
138 { | 145 { |
146 } | |
147 | |
148 void | |
149 UnitConverter::preferenceChanged(PropertyContainer::PropertyName) | |
150 { | |
151 updatePitchesFromFreq(); | |
152 updatePitchPrefsLabel(); | |
153 } | |
154 | |
155 void | |
156 UnitConverter::updatePitchPrefsLabel() | |
157 { | |
158 m_pitchPrefsLabel->setText | |
159 (tr("With concert-A tuning frequency at %1 Hz, and " | |
160 "middle C residing in octave %2.\n" | |
161 "(These can be changed in the application preferences.)") | |
162 .arg(Preferences::getInstance()->getTuningFrequency()) | |
163 .arg(Preferences::getInstance()->getOctaveOfMiddleC())); | |
139 } | 164 } |
140 | 165 |
141 void | 166 void |
142 UnitConverter::freqChanged(double freq) | 167 UnitConverter::freqChanged(double freq) |
143 { | 168 { |
215 m_cents->blockSignals(false); | 240 m_cents->blockSignals(false); |
216 m_note->blockSignals(false); | 241 m_note->blockSignals(false); |
217 m_octave->blockSignals(false); | 242 m_octave->blockSignals(false); |
218 } | 243 } |
219 | 244 |
220 | 245 void |
246 UnitConverter::updateTempiFromSamples() | |
247 { | |
248 } | |
221 | 249 |
222 | 250 |