comparison base/Preferences.cpp @ 277:3b8008d09541

* Add a colour database, and Add New Colour function to the colour combo in property box. The colour property is only correctly handled in the waveform layer so far. * Add en_GB translation, to translate those annoying Color texts in the Qt colour picker dialog.
author Chris Cannam
date Wed, 11 Jul 2007 17:21:37 +0000
parents d7eeffbb8aaf
children c022976d18e8
comparison
equal deleted inserted replaced
276:657825878970 277:3b8008d09541
37 Preferences::Preferences() : 37 Preferences::Preferences() :
38 m_spectrogramSmoothing(SpectrogramZeroPadded), 38 m_spectrogramSmoothing(SpectrogramZeroPadded),
39 m_tuningFrequency(440), 39 m_tuningFrequency(440),
40 m_propertyBoxLayout(VerticallyStacked), 40 m_propertyBoxLayout(VerticallyStacked),
41 m_windowType(HanningWindow), 41 m_windowType(HanningWindow),
42 m_resampleQuality(1) 42 m_resampleQuality(1),
43 m_omitRecentTemps(true)
43 { 44 {
44 QSettings settings; 45 QSettings settings;
45 settings.beginGroup("Preferences"); 46 settings.beginGroup("Preferences");
46 m_spectrogramSmoothing = SpectrogramSmoothing 47 m_spectrogramSmoothing = SpectrogramSmoothing
47 (settings.value("spectrogram-smoothing", int(m_spectrogramSmoothing)).toInt()); 48 (settings.value("spectrogram-smoothing", int(m_spectrogramSmoothing)).toInt());
65 props.push_back("Spectrogram Smoothing"); 66 props.push_back("Spectrogram Smoothing");
66 props.push_back("Tuning Frequency"); 67 props.push_back("Tuning Frequency");
67 props.push_back("Property Box Layout"); 68 props.push_back("Property Box Layout");
68 props.push_back("Window Type"); 69 props.push_back("Window Type");
69 props.push_back("Resample Quality"); 70 props.push_back("Resample Quality");
71 props.push_back("Omit Temporaries from Recent Files");
70 return props; 72 return props;
71 } 73 }
72 74
73 QString 75 QString
74 Preferences::getPropertyLabel(const PropertyName &name) const 76 Preferences::getPropertyLabel(const PropertyName &name) const
86 return tr("Spectral analysis window shape"); 88 return tr("Spectral analysis window shape");
87 } 89 }
88 if (name == "Resample Quality") { 90 if (name == "Resample Quality") {
89 return tr("Playback resampler type"); 91 return tr("Playback resampler type");
90 } 92 }
93 if (name == "Omit Temporaries from Recent Files") {
94 return tr("Omit Temporaries from Recent Files");
95 }
91 return name; 96 return name;
92 } 97 }
93 98
94 Preferences::PropertyType 99 Preferences::PropertyType
95 Preferences::getPropertyType(const PropertyName &name) const 100 Preferences::getPropertyType(const PropertyName &name) const
106 if (name == "Window Type") { 111 if (name == "Window Type") {
107 return ValueProperty; 112 return ValueProperty;
108 } 113 }
109 if (name == "Resample Quality") { 114 if (name == "Resample Quality") {
110 return ValueProperty; 115 return ValueProperty;
116 }
117 if (name == "Omit Temporaries from Recent Files") {
118 return ToggleProperty;
111 } 119 }
112 return InvalidProperty; 120 return InvalidProperty;
113 } 121 }
114 122
115 int 123 int
142 if (name == "Resample Quality") { 150 if (name == "Resample Quality") {
143 if (min) *min = 0; 151 if (min) *min = 0;
144 if (max) *max = 2; 152 if (max) *max = 2;
145 if (deflt) *deflt = 1; 153 if (deflt) *deflt = 1;
146 return m_resampleQuality; 154 return m_resampleQuality;
155 }
156
157 if (name == "Omit Temporaries from Recent Files") {
158 if (deflt) *deflt = 1;
147 } 159 }
148 160
149 return 0; 161 return 0;
150 } 162 }
151 163
211 setPropertyBoxLayout(value == 0 ? VerticallyStacked : Layered); 223 setPropertyBoxLayout(value == 0 ? VerticallyStacked : Layered);
212 } else if (name == "Window Type") { 224 } else if (name == "Window Type") {
213 setWindowType(WindowType(value)); 225 setWindowType(WindowType(value));
214 } else if (name == "Resample Quality") { 226 } else if (name == "Resample Quality") {
215 setResampleQuality(value); 227 setResampleQuality(value);
228 } else if (name == "Omit Temporaries from Recent Files") {
229 setOmitTempsFromRecentFiles(value ? true : false);
216 } 230 }
217 } 231 }
218 232
219 void 233 void
220 Preferences::setSpectrogramSmoothing(SpectrogramSmoothing smoothing) 234 Preferences::setSpectrogramSmoothing(SpectrogramSmoothing smoothing)
282 settings.setValue("resample-quality", q); 296 settings.setValue("resample-quality", q);
283 settings.endGroup(); 297 settings.endGroup();
284 emit propertyChanged("Resample Quality"); 298 emit propertyChanged("Resample Quality");
285 } 299 }
286 } 300 }
301
302 void
303 Preferences::setOmitTempsFromRecentFiles(bool omit)
304 {
305 if (m_omitRecentTemps != omit) {
306 m_omitRecentTemps = omit;
307 QSettings settings;
308 settings.beginGroup("Preferences");
309 settings.setValue("omit-recent-temporaries", omit);
310 settings.endGroup();
311 emit propertyChanged("Omit Temporaries from Recent Files");
312 }
313 }