Mercurial > hg > svcore
comparison base/Preferences.cpp @ 906:654990320867
Merge from 899:bc0ff66102a8
author | Chris Cannam |
---|---|
date | Wed, 07 May 2014 15:17:51 +0100 |
parents | 451f7f3ab6e7 |
children | 4c7b4040bd2d |
comparison
equal
deleted
inserted
replaced
905:1f94f3776158 | 906:654990320867 |
---|---|
45 m_tempDirRoot(""), | 45 m_tempDirRoot(""), |
46 m_resampleOnLoad(false), | 46 m_resampleOnLoad(false), |
47 m_viewFontSize(10), | 47 m_viewFontSize(10), |
48 m_backgroundMode(BackgroundFromTheme), | 48 m_backgroundMode(BackgroundFromTheme), |
49 m_timeToTextMode(TimeToTextMs), | 49 m_timeToTextMode(TimeToTextMs), |
50 m_octave(4), | |
50 m_showSplash(true) | 51 m_showSplash(true) |
51 { | 52 { |
52 QSettings settings; | 53 QSettings settings; |
53 settings.beginGroup("Preferences"); | 54 settings.beginGroup("Preferences"); |
54 m_spectrogramSmoothing = SpectrogramSmoothing | 55 m_spectrogramSmoothing = SpectrogramSmoothing |
64 m_resampleOnLoad = settings.value("resample-on-load", false).toBool(); | 65 m_resampleOnLoad = settings.value("resample-on-load", false).toBool(); |
65 m_backgroundMode = BackgroundMode | 66 m_backgroundMode = BackgroundMode |
66 (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); | 67 (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); |
67 m_timeToTextMode = TimeToTextMode | 68 m_timeToTextMode = TimeToTextMode |
68 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); | 69 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); |
70 m_octave = (settings.value("octave-of-middle-c", 4)).toInt(); | |
69 m_viewFontSize = settings.value("view-font-size", 10).toInt(); | 71 m_viewFontSize = settings.value("view-font-size", 10).toInt(); |
70 m_showSplash = settings.value("show-splash", true).toBool(); | 72 m_showSplash = settings.value("show-splash", true).toBool(); |
71 settings.endGroup(); | 73 settings.endGroup(); |
72 | 74 |
73 settings.beginGroup("TempDirectory"); | 75 settings.beginGroup("TempDirectory"); |
92 props.push_back("Omit Temporaries from Recent Files"); | 94 props.push_back("Omit Temporaries from Recent Files"); |
93 props.push_back("Resample On Load"); | 95 props.push_back("Resample On Load"); |
94 props.push_back("Temporary Directory Root"); | 96 props.push_back("Temporary Directory Root"); |
95 props.push_back("Background Mode"); | 97 props.push_back("Background Mode"); |
96 props.push_back("Time To Text Mode"); | 98 props.push_back("Time To Text Mode"); |
99 props.push_back("Octave Numbering System"); | |
97 props.push_back("View Font Size"); | 100 props.push_back("View Font Size"); |
98 props.push_back("Show Splash Screen"); | 101 props.push_back("Show Splash Screen"); |
99 return props; | 102 return props; |
100 } | 103 } |
101 | 104 |
133 return tr("Background colour preference"); | 136 return tr("Background colour preference"); |
134 } | 137 } |
135 if (name == "Time To Text Mode") { | 138 if (name == "Time To Text Mode") { |
136 return tr("Time display format"); | 139 return tr("Time display format"); |
137 } | 140 } |
141 if (name == "Octave Numbering System") { | |
142 return tr("Label middle C as"); | |
143 } | |
138 if (name == "View Font Size") { | 144 if (name == "View Font Size") { |
139 return tr("Font size for text overlays"); | 145 return tr("Font size for text overlays"); |
140 } | 146 } |
141 if (name == "Show Splash Screen") { | 147 if (name == "Show Splash Screen") { |
142 return tr("Show splash screen on startup"); | 148 return tr("Show splash screen on startup"); |
177 } | 183 } |
178 if (name == "Background Mode") { | 184 if (name == "Background Mode") { |
179 return ValueProperty; | 185 return ValueProperty; |
180 } | 186 } |
181 if (name == "Time To Text Mode") { | 187 if (name == "Time To Text Mode") { |
188 return ValueProperty; | |
189 } | |
190 if (name == "Octave Numbering System") { | |
182 return ValueProperty; | 191 return ValueProperty; |
183 } | 192 } |
184 if (name == "View Font Size") { | 193 if (name == "View Font Size") { |
185 return RangeProperty; | 194 return RangeProperty; |
186 } | 195 } |
245 if (min) *min = 0; | 254 if (min) *min = 0; |
246 if (max) *max = 6; | 255 if (max) *max = 6; |
247 if (deflt) *deflt = 0; | 256 if (deflt) *deflt = 0; |
248 return int(m_timeToTextMode); | 257 return int(m_timeToTextMode); |
249 } | 258 } |
259 | |
260 if (name == "Octave Numbering System") { | |
261 // we don't support arbitrary octaves in the gui, because we | |
262 // want to be able to label what the octave system comes | |
263 // from. so we support 0, 3, 4 and 5. | |
264 if (min) *min = 0; | |
265 if (max) *max = 3; | |
266 if (deflt) *deflt = 2; | |
267 return int(getSystemWithMiddleCInOctave(m_octave)); | |
268 } | |
250 | 269 |
251 if (name == "View Font Size") { | 270 if (name == "View Font Size") { |
252 if (min) *min = 3; | 271 if (min) *min = 3; |
253 if (max) *max = 48; | 272 if (max) *max = 48; |
254 if (deflt) *deflt = 10; | 273 if (deflt) *deflt = 10; |
318 case TimeToText24Frame: return tr("24 FPS"); | 337 case TimeToText24Frame: return tr("24 FPS"); |
319 case TimeToText25Frame: return tr("25 FPS"); | 338 case TimeToText25Frame: return tr("25 FPS"); |
320 case TimeToText30Frame: return tr("30 FPS"); | 339 case TimeToText30Frame: return tr("30 FPS"); |
321 case TimeToText50Frame: return tr("50 FPS"); | 340 case TimeToText50Frame: return tr("50 FPS"); |
322 case TimeToText60Frame: return tr("60 FPS"); | 341 case TimeToText60Frame: return tr("60 FPS"); |
342 } | |
343 } | |
344 if (name == "Octave Numbering System") { | |
345 switch (value) { | |
346 case C0_Centre: return tr("C0 - middle of octave scale"); | |
347 case C3_Logic: return tr("C3 - common MIDI sequencer convention"); | |
348 case C4_ASA: return tr("C4 - ASA American standard"); | |
349 case C5_Sonar: return tr("C5 - used in Cakewalk and others"); | |
323 } | 350 } |
324 } | 351 } |
325 | 352 |
326 return ""; | 353 return ""; |
327 } | 354 } |
357 setOmitTempsFromRecentFiles(value ? true : false); | 384 setOmitTempsFromRecentFiles(value ? true : false); |
358 } else if (name == "Background Mode") { | 385 } else if (name == "Background Mode") { |
359 setBackgroundMode(BackgroundMode(value)); | 386 setBackgroundMode(BackgroundMode(value)); |
360 } else if (name == "Time To Text Mode") { | 387 } else if (name == "Time To Text Mode") { |
361 setTimeToTextMode(TimeToTextMode(value)); | 388 setTimeToTextMode(TimeToTextMode(value)); |
389 } else if (name == "Octave Numbering System") { | |
390 setOctaveOfMiddleC(getOctaveOfMiddleCInSystem | |
391 (OctaveNumberingSystem(value))); | |
362 } else if (name == "View Font Size") { | 392 } else if (name == "View Font Size") { |
363 setViewFontSize(value); | 393 setViewFontSize(value); |
364 } else if (name == "Show Splash Screen") { | 394 } else if (name == "Show Splash Screen") { |
365 setShowSplash(value ? true : false); | 395 setShowSplash(value ? true : false); |
366 } | 396 } |
523 emit propertyChanged("Time To Text Mode"); | 553 emit propertyChanged("Time To Text Mode"); |
524 } | 554 } |
525 } | 555 } |
526 | 556 |
527 void | 557 void |
558 Preferences::setOctaveOfMiddleC(int oct) | |
559 { | |
560 if (m_octave != oct) { | |
561 | |
562 m_octave = oct; | |
563 | |
564 QSettings settings; | |
565 settings.beginGroup("Preferences"); | |
566 settings.setValue("octave-of-middle-c", int(oct)); | |
567 settings.endGroup(); | |
568 emit propertyChanged("Octave Numbering System"); | |
569 } | |
570 } | |
571 | |
572 int | |
573 Preferences::getOctaveOfMiddleCInSystem(OctaveNumberingSystem s) | |
574 { | |
575 switch (s) { | |
576 case C0_Centre: return 0; | |
577 case C3_Logic: return 3; | |
578 case C4_ASA: return 4; | |
579 case C5_Sonar: return 5; | |
580 default: return 4; | |
581 } | |
582 } | |
583 | |
584 Preferences::OctaveNumberingSystem | |
585 Preferences::getSystemWithMiddleCInOctave(int o) | |
586 { | |
587 switch (o) { | |
588 case 0: return C0_Centre; | |
589 case 3: return C3_Logic; | |
590 case 4: return C4_ASA; | |
591 case 5: return C5_Sonar; | |
592 default: return C4_ASA; | |
593 } | |
594 } | |
595 | |
596 void | |
528 Preferences::setViewFontSize(int size) | 597 Preferences::setViewFontSize(int size) |
529 { | 598 { |
530 if (m_viewFontSize != size) { | 599 if (m_viewFontSize != size) { |
531 | 600 |
532 m_viewFontSize = size; | 601 m_viewFontSize = size; |