Mercurial > hg > svgui
comparison layer/SpectrumLayer.cpp @ 1266:a34a2a25907c
Untabify
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 18:02:22 +0000 |
parents | 14dcdc596baf |
children | b4cb11ca8233 a04f1012fca2 |
comparison
equal
deleted
inserted
replaced
1265:6e724c81f18f | 1266:a34a2a25907c |
---|---|
164 | 164 |
165 QString | 165 QString |
166 SpectrumLayer::getPropertyGroupName(const PropertyName &name) const | 166 SpectrumLayer::getPropertyGroupName(const PropertyName &name) const |
167 { | 167 { |
168 if (name == "Window Size" || | 168 if (name == "Window Size" || |
169 name == "Window Increment") return tr("Window"); | 169 name == "Window Increment") return tr("Window"); |
170 if (name == "Show Peak Frequencies") return tr("Bins"); | 170 if (name == "Show Peak Frequencies") return tr("Bins"); |
171 return SliceLayer::getPropertyGroupName(name); | 171 return SliceLayer::getPropertyGroupName(name); |
172 } | 172 } |
173 | 173 |
174 int | 174 int |
182 if (!max) max = &garbage1; | 182 if (!max) max = &garbage1; |
183 if (!deflt) deflt = &garbage2; | 183 if (!deflt) deflt = &garbage2; |
184 | 184 |
185 if (name == "Window Size") { | 185 if (name == "Window Size") { |
186 | 186 |
187 *min = 0; | 187 *min = 0; |
188 *max = 15; | 188 *max = 15; |
189 *deflt = 5; | 189 *deflt = 5; |
190 | 190 |
191 val = 0; | 191 val = 0; |
192 int ws = m_windowSize; | 192 int ws = m_windowSize; |
193 while (ws > 32) { ws >>= 1; val ++; } | 193 while (ws > 32) { ws >>= 1; val ++; } |
194 | 194 |
195 } else if (name == "Window Increment") { | 195 } else if (name == "Window Increment") { |
196 | 196 |
197 *min = 0; | 197 *min = 0; |
198 *max = 5; | 198 *max = 5; |
199 *deflt = 2; | 199 *deflt = 2; |
200 | 200 |
201 val = m_windowHopLevel; | 201 val = m_windowHopLevel; |
202 | 202 |
203 } else if (name == "Show Peak Frequencies") { | 203 } else if (name == "Show Peak Frequencies") { |
204 | 204 |
205 return m_showPeaks ? 1 : 0; | 205 return m_showPeaks ? 1 : 0; |
212 return val; | 212 return val; |
213 } | 213 } |
214 | 214 |
215 QString | 215 QString |
216 SpectrumLayer::getPropertyValueLabel(const PropertyName &name, | 216 SpectrumLayer::getPropertyValueLabel(const PropertyName &name, |
217 int value) const | 217 int value) const |
218 { | 218 { |
219 if (name == "Window Size") { | 219 if (name == "Window Size") { |
220 return QString("%1").arg(32 << value); | 220 return QString("%1").arg(32 << value); |
221 } | 221 } |
222 if (name == "Window Increment") { | 222 if (name == "Window Increment") { |
223 switch (value) { | 223 switch (value) { |
224 default: | 224 default: |
225 case 0: return tr("None"); | 225 case 0: return tr("None"); |
226 case 1: return tr("25 %"); | 226 case 1: return tr("25 %"); |
227 case 2: return tr("50 %"); | 227 case 2: return tr("50 %"); |
228 case 3: return tr("75 %"); | 228 case 3: return tr("75 %"); |
229 case 4: return tr("87.5 %"); | 229 case 4: return tr("87.5 %"); |
230 case 5: return tr("93.75 %"); | 230 case 5: return tr("93.75 %"); |
231 } | 231 } |
232 } | 232 } |
233 return SliceLayer::getPropertyValueLabel(name, value); | 233 return SliceLayer::getPropertyValueLabel(name, value); |
234 } | 234 } |
235 | 235 |
236 RangeMapper * | 236 RangeMapper * |
241 | 241 |
242 void | 242 void |
243 SpectrumLayer::setProperty(const PropertyName &name, int value) | 243 SpectrumLayer::setProperty(const PropertyName &name, int value) |
244 { | 244 { |
245 if (name == "Window Size") { | 245 if (name == "Window Size") { |
246 setWindowSize(32 << value); | 246 setWindowSize(32 << value); |
247 } else if (name == "Window Increment") { | 247 } else if (name == "Window Increment") { |
248 setWindowHopLevel(value); | 248 setWindowHopLevel(value); |
249 } else if (name == "Show Peak Frequencies") { | 249 } else if (name == "Show Peak Frequencies") { |
250 setShowPeaks(value ? true : false); | 250 setShowPeaks(value ? true : false); |
251 } else { | 251 } else { |