comparison base/Preferences.cpp @ 919:4c7b4040bd2d tonioni

For Tony, resample all audio to 44100 on load
author Chris Cannam
date Fri, 13 Jun 2014 12:56:31 +0100
parents 451f7f3ab6e7
children 2896b8872834
comparison
equal deleted inserted replaced
918:e88a15c25a4a 919:4c7b4040bd2d
41 m_propertyBoxLayout(VerticallyStacked), 41 m_propertyBoxLayout(VerticallyStacked),
42 m_windowType(HanningWindow), 42 m_windowType(HanningWindow),
43 m_resampleQuality(1), 43 m_resampleQuality(1),
44 m_omitRecentTemps(true), 44 m_omitRecentTemps(true),
45 m_tempDirRoot(""), 45 m_tempDirRoot(""),
46 m_fixedSampleRate(0),
46 m_resampleOnLoad(false), 47 m_resampleOnLoad(false),
47 m_viewFontSize(10), 48 m_viewFontSize(10),
48 m_backgroundMode(BackgroundFromTheme), 49 m_backgroundMode(BackgroundFromTheme),
49 m_timeToTextMode(TimeToTextMs), 50 m_timeToTextMode(TimeToTextMs),
50 m_octave(4), 51 m_octave(4),
60 m_propertyBoxLayout = PropertyBoxLayout 61 m_propertyBoxLayout = PropertyBoxLayout
61 (settings.value("property-box-layout", int(VerticallyStacked)).toInt()); 62 (settings.value("property-box-layout", int(VerticallyStacked)).toInt());
62 m_windowType = WindowType 63 m_windowType = WindowType
63 (settings.value("window-type", int(HanningWindow)).toInt()); 64 (settings.value("window-type", int(HanningWindow)).toInt());
64 m_resampleQuality = settings.value("resample-quality", 1).toInt(); 65 m_resampleQuality = settings.value("resample-quality", 1).toInt();
66 m_fixedSampleRate = settings.value("fixed-sample-rate", 0).toInt();
65 m_resampleOnLoad = settings.value("resample-on-load", false).toBool(); 67 m_resampleOnLoad = settings.value("resample-on-load", false).toBool();
66 m_backgroundMode = BackgroundMode 68 m_backgroundMode = BackgroundMode
67 (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); 69 (settings.value("background-mode", int(BackgroundFromTheme)).toInt());
68 m_timeToTextMode = TimeToTextMode 70 m_timeToTextMode = TimeToTextMode
69 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); 71 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt());
91 props.push_back("Property Box Layout"); 93 props.push_back("Property Box Layout");
92 props.push_back("Window Type"); 94 props.push_back("Window Type");
93 props.push_back("Resample Quality"); 95 props.push_back("Resample Quality");
94 props.push_back("Omit Temporaries from Recent Files"); 96 props.push_back("Omit Temporaries from Recent Files");
95 props.push_back("Resample On Load"); 97 props.push_back("Resample On Load");
98 props.push_back("Fixed Sample Rate");
96 props.push_back("Temporary Directory Root"); 99 props.push_back("Temporary Directory Root");
97 props.push_back("Background Mode"); 100 props.push_back("Background Mode");
98 props.push_back("Time To Text Mode"); 101 props.push_back("Time To Text Mode");
99 props.push_back("Octave Numbering System"); 102 props.push_back("Octave Numbering System");
100 props.push_back("View Font Size"); 103 props.push_back("View Font Size");
127 return tr("Omit temporaries from Recent Files menu"); 130 return tr("Omit temporaries from Recent Files menu");
128 } 131 }
129 if (name == "Resample On Load") { 132 if (name == "Resample On Load") {
130 return tr("Resample mismatching files on import"); 133 return tr("Resample mismatching files on import");
131 } 134 }
135 if (name == "Fixed Sample Rate") {
136 return tr("Single fixed sample rate to resample all files to");
137 }
132 if (name == "Temporary Directory Root") { 138 if (name == "Temporary Directory Root") {
133 return tr("Location for cache file directory"); 139 return tr("Location for cache file directory");
134 } 140 }
135 if (name == "Background Mode") { 141 if (name == "Background Mode") {
136 return tr("Background colour preference"); 142 return tr("Background colour preference");
174 if (name == "Omit Temporaries from Recent Files") { 180 if (name == "Omit Temporaries from Recent Files") {
175 return ToggleProperty; 181 return ToggleProperty;
176 } 182 }
177 if (name == "Resample On Load") { 183 if (name == "Resample On Load") {
178 return ToggleProperty; 184 return ToggleProperty;
185 }
186 if (name == "Fixed Sample Rate") {
187 return ValueProperty;
179 } 188 }
180 if (name == "Temporary Directory Root") { 189 if (name == "Temporary Directory Root") {
181 // It's an arbitrary string, we don't have a set of values for this 190 // It's an arbitrary string, we don't have a set of values for this
182 return InvalidProperty; 191 return InvalidProperty;
183 } 192 }
523 emit propertyChanged("Resample On Load"); 532 emit propertyChanged("Resample On Load");
524 } 533 }
525 } 534 }
526 535
527 void 536 void
537 Preferences::setFixedSampleRate(int rate)
538 {
539 if (m_fixedSampleRate != rate) {
540 m_fixedSampleRate = rate;
541 QSettings settings;
542 settings.beginGroup("Preferences");
543 settings.setValue("fixed-sample-rate", rate);
544 settings.endGroup();
545 emit propertyChanged("Fixed Sample Rate");
546 }
547 }
548
549 void
528 Preferences::setBackgroundMode(BackgroundMode mode) 550 Preferences::setBackgroundMode(BackgroundMode mode)
529 { 551 {
530 if (m_backgroundMode != mode) { 552 if (m_backgroundMode != mode) {
531 553
532 m_backgroundMode = mode; 554 m_backgroundMode = mode;