Mercurial > hg > svcore
comparison base/Preferences.cpp @ 1031:344c9ea90181
Add option to toggle H:M:S time display (when off, just show seconds even when more than 60)
author | Chris Cannam |
---|---|
date | Wed, 18 Feb 2015 12:08:17 +0000 |
parents | 2896b8872834 |
children | cc27f35aa75c |
comparison
equal
deleted
inserted
replaced
1030:920699b6989d | 1031:344c9ea90181 |
---|---|
47 m_resampleOnLoad(false), | 47 m_resampleOnLoad(false), |
48 m_normaliseAudio(false), | 48 m_normaliseAudio(false), |
49 m_viewFontSize(10), | 49 m_viewFontSize(10), |
50 m_backgroundMode(BackgroundFromTheme), | 50 m_backgroundMode(BackgroundFromTheme), |
51 m_timeToTextMode(TimeToTextMs), | 51 m_timeToTextMode(TimeToTextMs), |
52 m_showHMS(true), | |
52 m_octave(4), | 53 m_octave(4), |
53 m_showSplash(true) | 54 m_showSplash(true) |
54 { | 55 { |
55 QSettings settings; | 56 QSettings settings; |
56 settings.beginGroup("Preferences"); | 57 settings.beginGroup("Preferences"); |
69 m_normaliseAudio = settings.value("normalise-audio", false).toBool(); | 70 m_normaliseAudio = settings.value("normalise-audio", false).toBool(); |
70 m_backgroundMode = BackgroundMode | 71 m_backgroundMode = BackgroundMode |
71 (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); | 72 (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); |
72 m_timeToTextMode = TimeToTextMode | 73 m_timeToTextMode = TimeToTextMode |
73 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); | 74 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); |
75 m_showHMS = (settings.value("show-hours-minutes-seconds", true)).toBool(); | |
74 m_octave = (settings.value("octave-of-middle-c", 4)).toInt(); | 76 m_octave = (settings.value("octave-of-middle-c", 4)).toInt(); |
75 m_viewFontSize = settings.value("view-font-size", 10).toInt(); | 77 m_viewFontSize = settings.value("view-font-size", 10).toInt(); |
76 m_showSplash = settings.value("show-splash", true).toBool(); | 78 m_showSplash = settings.value("show-splash", true).toBool(); |
77 settings.endGroup(); | 79 settings.endGroup(); |
78 | 80 |
100 props.push_back("Normalise Audio"); | 102 props.push_back("Normalise Audio"); |
101 props.push_back("Fixed Sample Rate"); | 103 props.push_back("Fixed Sample Rate"); |
102 props.push_back("Temporary Directory Root"); | 104 props.push_back("Temporary Directory Root"); |
103 props.push_back("Background Mode"); | 105 props.push_back("Background Mode"); |
104 props.push_back("Time To Text Mode"); | 106 props.push_back("Time To Text Mode"); |
107 props.push_back("Show Hours And Minutes"); | |
105 props.push_back("Octave Numbering System"); | 108 props.push_back("Octave Numbering System"); |
106 props.push_back("View Font Size"); | 109 props.push_back("View Font Size"); |
107 props.push_back("Show Splash Screen"); | 110 props.push_back("Show Splash Screen"); |
108 return props; | 111 return props; |
109 } | 112 } |
146 } | 149 } |
147 if (name == "Background Mode") { | 150 if (name == "Background Mode") { |
148 return tr("Background colour preference"); | 151 return tr("Background colour preference"); |
149 } | 152 } |
150 if (name == "Time To Text Mode") { | 153 if (name == "Time To Text Mode") { |
151 return tr("Time display format"); | 154 return tr("Time display precision"); |
155 } | |
156 if (name == "Show Hours And Minutes") { | |
157 return tr("Use hours:minutes:seconds format"); | |
152 } | 158 } |
153 if (name == "Octave Numbering System") { | 159 if (name == "Octave Numbering System") { |
154 return tr("Label middle C as"); | 160 return tr("Label middle C as"); |
155 } | 161 } |
156 if (name == "View Font Size") { | 162 if (name == "View Font Size") { |
202 if (name == "Background Mode") { | 208 if (name == "Background Mode") { |
203 return ValueProperty; | 209 return ValueProperty; |
204 } | 210 } |
205 if (name == "Time To Text Mode") { | 211 if (name == "Time To Text Mode") { |
206 return ValueProperty; | 212 return ValueProperty; |
213 } | |
214 if (name == "Show Hours And Minutes") { | |
215 return ToggleProperty; | |
207 } | 216 } |
208 if (name == "Octave Numbering System") { | 217 if (name == "Octave Numbering System") { |
209 return ValueProperty; | 218 return ValueProperty; |
210 } | 219 } |
211 if (name == "View Font Size") { | 220 if (name == "View Font Size") { |
257 return m_resampleQuality; | 266 return m_resampleQuality; |
258 } | 267 } |
259 | 268 |
260 if (name == "Omit Temporaries from Recent Files") { | 269 if (name == "Omit Temporaries from Recent Files") { |
261 if (deflt) *deflt = 1; | 270 if (deflt) *deflt = 1; |
271 return m_omitRecentTemps ? 1 : 0; | |
262 } | 272 } |
263 | 273 |
264 if (name == "Background Mode") { | 274 if (name == "Background Mode") { |
265 if (min) *min = 0; | 275 if (min) *min = 0; |
266 if (max) *max = 2; | 276 if (max) *max = 2; |
273 if (max) *max = 6; | 283 if (max) *max = 6; |
274 if (deflt) *deflt = 0; | 284 if (deflt) *deflt = 0; |
275 return int(m_timeToTextMode); | 285 return int(m_timeToTextMode); |
276 } | 286 } |
277 | 287 |
288 if (name == "Show Hours And Minutes") { | |
289 if (deflt) *deflt = 1; | |
290 return m_showHMS ? 1 : 0; | |
291 } | |
292 | |
278 if (name == "Octave Numbering System") { | 293 if (name == "Octave Numbering System") { |
279 // we don't support arbitrary octaves in the gui, because we | 294 // we don't support arbitrary octaves in the gui, because we |
280 // want to be able to label what the octave system comes | 295 // want to be able to label what the octave system comes |
281 // from. so we support 0, 3, 4 and 5. | 296 // from. so we support 0, 3, 4 and 5. |
282 if (min) *min = 0; | 297 if (min) *min = 0; |
292 return int(m_viewFontSize); | 307 return int(m_viewFontSize); |
293 } | 308 } |
294 | 309 |
295 if (name == "Show Splash Screen") { | 310 if (name == "Show Splash Screen") { |
296 if (deflt) *deflt = 1; | 311 if (deflt) *deflt = 1; |
312 return m_showSplash ? 1 : 0; | |
297 } | 313 } |
298 | 314 |
299 return 0; | 315 return 0; |
300 } | 316 } |
301 | 317 |
402 setOmitTempsFromRecentFiles(value ? true : false); | 418 setOmitTempsFromRecentFiles(value ? true : false); |
403 } else if (name == "Background Mode") { | 419 } else if (name == "Background Mode") { |
404 setBackgroundMode(BackgroundMode(value)); | 420 setBackgroundMode(BackgroundMode(value)); |
405 } else if (name == "Time To Text Mode") { | 421 } else if (name == "Time To Text Mode") { |
406 setTimeToTextMode(TimeToTextMode(value)); | 422 setTimeToTextMode(TimeToTextMode(value)); |
423 } else if (name == "Show Hours And Minutes") { | |
424 setShowHMS(value ? true : false); | |
407 } else if (name == "Octave Numbering System") { | 425 } else if (name == "Octave Numbering System") { |
408 setOctaveOfMiddleC(getOctaveOfMiddleCInSystem | 426 setOctaveOfMiddleC(getOctaveOfMiddleCInSystem |
409 (OctaveNumberingSystem(value))); | 427 (OctaveNumberingSystem(value))); |
410 } else if (name == "View Font Size") { | 428 } else if (name == "View Font Size") { |
411 setViewFontSize(value); | 429 setViewFontSize(value); |
597 emit propertyChanged("Time To Text Mode"); | 615 emit propertyChanged("Time To Text Mode"); |
598 } | 616 } |
599 } | 617 } |
600 | 618 |
601 void | 619 void |
620 Preferences::setShowHMS(bool show) | |
621 { | |
622 if (m_showHMS != show) { | |
623 | |
624 m_showHMS = show; | |
625 | |
626 QSettings settings; | |
627 settings.beginGroup("Preferences"); | |
628 settings.setValue("show-hours-minutes-seconds", show); | |
629 settings.endGroup(); | |
630 emit propertyChanged("Show Hours And Minutes"); | |
631 } | |
632 } | |
633 | |
634 void | |
602 Preferences::setOctaveOfMiddleC(int oct) | 635 Preferences::setOctaveOfMiddleC(int oct) |
603 { | 636 { |
604 if (m_octave != oct) { | 637 if (m_octave != oct) { |
605 | 638 |
606 m_octave = oct; | 639 m_octave = oct; |