Mercurial > hg > svcore
comparison base/Preferences.cpp @ 694:2c4aca969c24 toggle
Option added in the preference menu to be able to start the application in minimal mode
author | mathieub <mathieu.barthet@eecs.qmul.ac.uk> |
---|---|
date | Wed, 20 Jul 2011 16:30:07 +0100 |
parents | 75f154085a4d |
children |
comparison
equal
deleted
inserted
replaced
693:682101331278 | 694:2c4aca969c24 |
---|---|
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_showSplash(true) | 50 m_showSplash(true), |
51 m_startInMiniMode(false) | |
51 { | 52 { |
52 QSettings settings; | 53 QSettings settings; |
53 settings.beginGroup("Preferences"); | 54 settings.beginGroup("Preferences"); |
54 m_spectrogramSmoothing = SpectrogramSmoothing | 55 m_spectrogramSmoothing = SpectrogramSmoothing |
55 (settings.value("spectrogram-y-smoothing", int(m_spectrogramSmoothing)).toInt()); | 56 (settings.value("spectrogram-y-smoothing", int(m_spectrogramSmoothing)).toInt()); |
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()); |
69 m_viewFontSize = settings.value("view-font-size", 10).toInt(); | 70 m_viewFontSize = settings.value("view-font-size", 10).toInt(); |
70 m_showSplash = settings.value("show-splash", true).toBool(); | 71 m_showSplash = settings.value("show-splash", true).toBool(); |
72 m_startInMiniMode = settings.value("start-in-mini-mode", false).toBool(); | |
71 settings.endGroup(); | 73 settings.endGroup(); |
72 | 74 |
73 settings.beginGroup("TempDirectory"); | 75 settings.beginGroup("TempDirectory"); |
74 m_tempDirRoot = settings.value("create-in", "$HOME").toString(); | 76 m_tempDirRoot = settings.value("create-in", "$HOME").toString(); |
75 settings.endGroup(); | 77 settings.endGroup(); |
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"); |
97 props.push_back("View Font Size"); | 99 props.push_back("View Font Size"); |
98 props.push_back("Show Splash Screen"); | 100 props.push_back("Show Splash Screen"); |
101 props.push_back("Start In Minimal Mode"); | |
99 return props; | 102 return props; |
100 } | 103 } |
101 | 104 |
102 QString | 105 QString |
103 Preferences::getPropertyLabel(const PropertyName &name) const | 106 Preferences::getPropertyLabel(const PropertyName &name) const |
138 if (name == "View Font Size") { | 141 if (name == "View Font Size") { |
139 return tr("Font size for text overlays"); | 142 return tr("Font size for text overlays"); |
140 } | 143 } |
141 if (name == "Show Splash Screen") { | 144 if (name == "Show Splash Screen") { |
142 return tr("Show splash screen on startup"); | 145 return tr("Show splash screen on startup"); |
146 } | |
147 if (name == "Start In Minimal Mode") { | |
148 return tr("Start Sonic Visualiser in minimal mode"); | |
143 } | 149 } |
144 return name; | 150 return name; |
145 } | 151 } |
146 | 152 |
147 Preferences::PropertyType | 153 Preferences::PropertyType |
183 } | 189 } |
184 if (name == "View Font Size") { | 190 if (name == "View Font Size") { |
185 return RangeProperty; | 191 return RangeProperty; |
186 } | 192 } |
187 if (name == "Show Splash Screen") { | 193 if (name == "Show Splash Screen") { |
194 return ToggleProperty; | |
195 } | |
196 if (name == "Start In Minimal Mode") { | |
188 return ToggleProperty; | 197 return ToggleProperty; |
189 } | 198 } |
190 return InvalidProperty; | 199 return InvalidProperty; |
191 } | 200 } |
192 | 201 |
255 return int(m_viewFontSize); | 264 return int(m_viewFontSize); |
256 } | 265 } |
257 | 266 |
258 if (name == "Show Splash Screen") { | 267 if (name == "Show Splash Screen") { |
259 if (deflt) *deflt = 1; | 268 if (deflt) *deflt = 1; |
269 } | |
270 | |
271 if (name == "Start In Minimal Mode") { | |
272 if (deflt) *deflt = 0; | |
260 } | 273 } |
261 | 274 |
262 return 0; | 275 return 0; |
263 } | 276 } |
264 | 277 |
361 setTimeToTextMode(TimeToTextMode(value)); | 374 setTimeToTextMode(TimeToTextMode(value)); |
362 } else if (name == "View Font Size") { | 375 } else if (name == "View Font Size") { |
363 setViewFontSize(value); | 376 setViewFontSize(value); |
364 } else if (name == "Show Splash Screen") { | 377 } else if (name == "Show Splash Screen") { |
365 setShowSplash(value ? true : false); | 378 setShowSplash(value ? true : false); |
379 } else if (name == "Start In Minimal Mode") { | |
380 setStartInMiniMode(value ? true : false); | |
366 } | 381 } |
367 } | 382 } |
368 | 383 |
369 void | 384 void |
370 Preferences::setSpectrogramSmoothing(SpectrogramSmoothing smoothing) | 385 Preferences::setSpectrogramSmoothing(SpectrogramSmoothing smoothing) |
551 settings.setValue("show-splash", show); | 566 settings.setValue("show-splash", show); |
552 settings.endGroup(); | 567 settings.endGroup(); |
553 emit propertyChanged("Show Splash Screen"); | 568 emit propertyChanged("Show Splash Screen"); |
554 } | 569 } |
555 } | 570 } |
571 | |
572 void | |
573 Preferences::setStartInMiniMode(bool show) | |
574 { | |
575 if (m_startInMiniMode != show) { | |
576 | |
577 m_startInMiniMode = show; | |
578 | |
579 QSettings settings; | |
580 settings.beginGroup("Preferences"); | |
581 settings.setValue("start-in-mini-mode", show); | |
582 settings.endGroup(); | |
583 emit propertyChanged("Start Sonic Visualiser in minimal mode"); | |
584 } | |
585 } | |
556 | 586 |