comparison base/Preferences.cpp @ 372:d31b4ccb7ddb

* Update remaining editable layers to support proper realignment on copy/paste * Permit pasting when no suitable layer is current: create a new layer on paste * Add preference for showing the splash screen or not * Rename spectrogram smoothing prefs (partly following Craig's suggestions)
author Chris Cannam
date Wed, 06 Feb 2008 14:15:09 +0000
parents 722bc705775a
children 98a480c5f410
comparison
equal deleted inserted replaced
371:d77e1fa49e26 372:d31b4ccb7ddb
44 m_resampleQuality(1), 44 m_resampleQuality(1),
45 m_omitRecentTemps(true), 45 m_omitRecentTemps(true),
46 m_tempDirRoot(""), 46 m_tempDirRoot(""),
47 m_resampleOnLoad(false), 47 m_resampleOnLoad(false),
48 m_viewFontSize(10), 48 m_viewFontSize(10),
49 m_backgroundMode(BackgroundFromTheme) 49 m_backgroundMode(BackgroundFromTheme),
50 m_showSplash(true)
50 { 51 {
51 QSettings settings; 52 QSettings settings;
52 settings.beginGroup("Preferences"); 53 settings.beginGroup("Preferences");
53 m_spectrogramSmoothing = SpectrogramSmoothing 54 m_spectrogramSmoothing = SpectrogramSmoothing
54 (settings.value("spectrogram-smoothing", int(m_spectrogramSmoothing)).toInt()); 55 (settings.value("spectrogram-smoothing", int(m_spectrogramSmoothing)).toInt());
62 m_backgroundMode = BackgroundMode 63 m_backgroundMode = BackgroundMode
63 (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); 64 (settings.value("background-mode", int(BackgroundFromTheme)).toInt());
64 m_viewFontSize = settings.value 65 m_viewFontSize = settings.value
65 ("view-font-size", int(QApplication::font().pointSize() * 0.9)) 66 ("view-font-size", int(QApplication::font().pointSize() * 0.9))
66 .toInt(); 67 .toInt();
68 m_showSplash = settings.value("show-splash", true).toBool();
67 settings.endGroup(); 69 settings.endGroup();
68 70
69 settings.beginGroup("TempDirectory"); 71 settings.beginGroup("TempDirectory");
70 m_tempDirRoot = settings.value("create-in", "$HOME").toString(); 72 m_tempDirRoot = settings.value("create-in", "$HOME").toString();
71 settings.endGroup(); 73 settings.endGroup();
87 props.push_back("Omit Temporaries from Recent Files"); 89 props.push_back("Omit Temporaries from Recent Files");
88 props.push_back("Resample On Load"); 90 props.push_back("Resample On Load");
89 props.push_back("Temporary Directory Root"); 91 props.push_back("Temporary Directory Root");
90 props.push_back("Background Mode"); 92 props.push_back("Background Mode");
91 props.push_back("View Font Size"); 93 props.push_back("View Font Size");
94 props.push_back("Show Splash Screen");
92 return props; 95 return props;
93 } 96 }
94 97
95 QString 98 QString
96 Preferences::getPropertyLabel(const PropertyName &name) const 99 Preferences::getPropertyLabel(const PropertyName &name) const
97 { 100 {
98 if (name == "Spectrogram Smoothing") { 101 if (name == "Spectrogram Smoothing") {
99 return tr("Spectrogram y-axis smoothing:"); 102 return tr("Spectrogram y-axis interpolation:");
100 } 103 }
101 if (name == "Tuning Frequency") { 104 if (name == "Tuning Frequency") {
102 return tr("Frequency of concert A"); 105 return tr("Frequency of concert A");
103 } 106 }
104 if (name == "Property Box Layout") { 107 if (name == "Property Box Layout") {
122 if (name == "Background Mode") { 125 if (name == "Background Mode") {
123 return tr("Background colour preference"); 126 return tr("Background colour preference");
124 } 127 }
125 if (name == "View Font Size") { 128 if (name == "View Font Size") {
126 return tr("Font size for text overlays"); 129 return tr("Font size for text overlays");
130 }
131 if (name == "Show Splash Screen") {
132 return tr("Show splash screen on startup");
127 } 133 }
128 return name; 134 return name;
129 } 135 }
130 136
131 Preferences::PropertyType 137 Preferences::PropertyType
159 if (name == "Background Mode") { 165 if (name == "Background Mode") {
160 return ValueProperty; 166 return ValueProperty;
161 } 167 }
162 if (name == "View Font Size") { 168 if (name == "View Font Size") {
163 return RangeProperty; 169 return RangeProperty;
170 }
171 if (name == "Show Splash Screen") {
172 return ToggleProperty;
164 } 173 }
165 return InvalidProperty; 174 return InvalidProperty;
166 } 175 }
167 176
168 int 177 int
213 if (name == "View Font Size") { 222 if (name == "View Font Size") {
214 if (min) *min = 3; 223 if (min) *min = 3;
215 if (max) *max = 48; 224 if (max) *max = 48;
216 if (deflt) *deflt = int(QApplication::font().pointSize() * 0.9); 225 if (deflt) *deflt = int(QApplication::font().pointSize() * 0.9);
217 return int(m_viewFontSize); 226 return int(m_viewFontSize);
227 }
228
229 if (name == "Show Splash Screen") {
230 if (deflt) *deflt = 1;
218 } 231 }
219 232
220 return 0; 233 return 0;
221 } 234 }
222 235
249 } 262 }
250 } 263 }
251 if (name == "Spectrogram Smoothing") { 264 if (name == "Spectrogram Smoothing") {
252 switch (value) { 265 switch (value) {
253 case NoSpectrogramSmoothing: return tr("None - blocky but accurate"); 266 case NoSpectrogramSmoothing: return tr("None - blocky but accurate");
254 case SpectrogramInterpolated: return tr("Interpolate - fast but fuzzy"); 267 case SpectrogramInterpolated: return tr("Linear - fast but fuzzy");
255 case SpectrogramZeroPadded: return tr("Zero pad FFT - slow but clear"); 268 case SpectrogramZeroPadded: return tr("4 x Oversampled - slow but clear");
256 } 269 }
257 } 270 }
258 if (name == "Background Mode") { 271 if (name == "Background Mode") {
259 switch (value) { 272 switch (value) {
260 case BackgroundFromTheme: return tr("Follow desktop theme"); 273 case BackgroundFromTheme: return tr("Follow desktop theme");
295 setOmitTempsFromRecentFiles(value ? true : false); 308 setOmitTempsFromRecentFiles(value ? true : false);
296 } else if (name == "Background Mode") { 309 } else if (name == "Background Mode") {
297 setBackgroundMode(BackgroundMode(value)); 310 setBackgroundMode(BackgroundMode(value));
298 } else if (name == "View Font Size") { 311 } else if (name == "View Font Size") {
299 setViewFontSize(value); 312 setViewFontSize(value);
313 } else if (name == "Show Splash Screen") {
314 setShowSplash(value ? true : false);
300 } 315 }
301 } 316 }
302 317
303 void 318 void
304 Preferences::setSpectrogramSmoothing(SpectrogramSmoothing smoothing) 319 Preferences::setSpectrogramSmoothing(SpectrogramSmoothing smoothing)
439 settings.endGroup(); 454 settings.endGroup();
440 emit propertyChanged("View Font Size"); 455 emit propertyChanged("View Font Size");
441 } 456 }
442 } 457 }
443 458
459 void
460 Preferences::setShowSplash(bool show)
461 {
462 if (m_showSplash != show) {
463
464 m_showSplash = show;
465
466 QSettings settings;
467 settings.beginGroup("Preferences");
468 settings.setValue("show-splash", show);
469 settings.endGroup();
470 emit propertyChanged("Show Splash Screen");
471 }
472 }
473