Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 Sonic Visualiser
|
Chris@0
|
5 An audio file viewer and annotation editor.
|
Chris@0
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@0
|
7 This file copyright 2006 Chris Cannam.
|
Chris@0
|
8
|
Chris@0
|
9 This program is free software; you can redistribute it and/or
|
Chris@0
|
10 modify it under the terms of the GNU General Public License as
|
Chris@0
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@0
|
12 License, or (at your option) any later version. See the file
|
Chris@0
|
13 COPYING included with this distribution for more information.
|
Chris@0
|
14 */
|
Chris@0
|
15
|
Chris@0
|
16 #include "PreferencesDialog.h"
|
Chris@0
|
17
|
Chris@0
|
18 #include <QGridLayout>
|
Chris@0
|
19 #include <QComboBox>
|
Chris@0
|
20 #include <QCheckBox>
|
Chris@0
|
21 #include <QGroupBox>
|
Chris@0
|
22 #include <QDoubleSpinBox>
|
Chris@0
|
23 #include <QLabel>
|
Chris@0
|
24 #include <QPushButton>
|
Chris@0
|
25 #include <QHBoxLayout>
|
Chris@0
|
26 #include <QString>
|
Chris@163
|
27 #include <QDialogButtonBox>
|
Chris@163
|
28 #include <QMessageBox>
|
Chris@180
|
29 #include <QTabWidget>
|
Chris@180
|
30 #include <QLineEdit>
|
Chris@180
|
31 #include <QFileDialog>
|
Chris@180
|
32 #include <QMessageBox>
|
Chris@225
|
33 #include <QSpinBox>
|
Chris@436
|
34 #include <QListWidget>
|
Chris@263
|
35 #include <QSettings>
|
Chris@0
|
36
|
Chris@436
|
37 #include <set>
|
Chris@436
|
38
|
Chris@9
|
39 #include "widgets/WindowTypeSelector.h"
|
Chris@180
|
40 #include "widgets/IconLoader.h"
|
Chris@0
|
41 #include "base/Preferences.h"
|
Chris@436
|
42 #include "base/ResourceFinder.h"
|
Chris@1096
|
43 #include "layer/ColourMapper.h"
|
Chris@0
|
44
|
Chris@1035
|
45 //#include "audioio/AudioTargetFactory.h"
|
Chris@1035
|
46
|
Chris@686
|
47 #include "version.h"
|
Chris@686
|
48
|
Chris@528
|
49 PreferencesDialog::PreferencesDialog(QWidget *parent) :
|
Chris@528
|
50 QDialog(parent),
|
Chris@263
|
51 m_audioDevice(0),
|
Chris@180
|
52 m_changesOnRestart(false)
|
Chris@0
|
53 {
|
Chris@163
|
54 setWindowTitle(tr("Sonic Visualiser: Application Preferences"));
|
Chris@0
|
55
|
Chris@0
|
56 Preferences *prefs = Preferences::getInstance();
|
Chris@0
|
57
|
Chris@0
|
58 QGridLayout *grid = new QGridLayout;
|
Chris@0
|
59 setLayout(grid);
|
Chris@180
|
60
|
Chris@436
|
61 m_tabs = new QTabWidget;
|
Chris@436
|
62 grid->addWidget(m_tabs, 0, 0);
|
Chris@0
|
63
|
Chris@436
|
64 m_tabs->setTabPosition(QTabWidget::North);
|
Chris@0
|
65
|
Chris@0
|
66 // Create this first, as slots that get called from the ctor will
|
Chris@0
|
67 // refer to it
|
Chris@0
|
68 m_applyButton = new QPushButton(tr("Apply"));
|
Chris@0
|
69
|
Chris@180
|
70 // Create all the preference widgets first, then create the
|
Chris@180
|
71 // individual tab widgets and place the preferences in their
|
Chris@180
|
72 // appropriate places in one go afterwards
|
Chris@180
|
73
|
Chris@114
|
74 int min, max, deflt, i;
|
Chris@0
|
75
|
Chris@9
|
76 m_windowType = WindowType(prefs->getPropertyRangeAndValue
|
Chris@114
|
77 ("Window Type", &min, &max, &deflt));
|
Chris@9
|
78 m_windowTypeSelector = new WindowTypeSelector(m_windowType);
|
Chris@0
|
79
|
Chris@9
|
80 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)),
|
Chris@9
|
81 this, SLOT(windowTypeChanged(WindowType)));
|
Chris@0
|
82
|
Chris@1275
|
83 QCheckBox *vampProcessSeparation = new QCheckBox;
|
Chris@1275
|
84 m_runPluginsInProcess = prefs->getRunPluginsInProcess();
|
Chris@1275
|
85 vampProcessSeparation->setCheckState(m_runPluginsInProcess ? Qt::Unchecked :
|
Chris@1275
|
86 Qt::Checked);
|
Chris@1275
|
87 connect(vampProcessSeparation, SIGNAL(stateChanged(int)),
|
Chris@1275
|
88 this, SLOT(vampProcessSeparationChanged(int)));
|
Chris@1275
|
89
|
Chris@115
|
90 QComboBox *smoothing = new QComboBox;
|
Chris@115
|
91
|
Chris@299
|
92 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max,
|
Chris@115
|
93 &deflt);
|
Chris@115
|
94 m_spectrogramSmoothing = sm;
|
Chris@0
|
95
|
Chris@115
|
96 for (i = min; i <= max; ++i) {
|
Chris@299
|
97 smoothing->addItem(prefs->getPropertyValueLabel("Spectrogram Y Smoothing", i));
|
Chris@115
|
98 }
|
Chris@115
|
99
|
Chris@115
|
100 smoothing->setCurrentIndex(sm);
|
Chris@115
|
101
|
Chris@115
|
102 connect(smoothing, SIGNAL(currentIndexChanged(int)),
|
Chris@115
|
103 this, SLOT(spectrogramSmoothingChanged(int)));
|
Chris@0
|
104
|
Chris@299
|
105 QComboBox *xsmoothing = new QComboBox;
|
Chris@299
|
106
|
Chris@299
|
107 int xsm = prefs->getPropertyRangeAndValue("Spectrogram X Smoothing", &min, &max,
|
Chris@299
|
108 &deflt);
|
Chris@299
|
109 m_spectrogramXSmoothing = xsm;
|
Chris@299
|
110
|
Chris@299
|
111 for (i = min; i <= max; ++i) {
|
Chris@299
|
112 xsmoothing->addItem(prefs->getPropertyValueLabel("Spectrogram X Smoothing", i));
|
Chris@299
|
113 }
|
Chris@299
|
114
|
Chris@299
|
115 xsmoothing->setCurrentIndex(xsm);
|
Chris@299
|
116
|
Chris@299
|
117 connect(xsmoothing, SIGNAL(currentIndexChanged(int)),
|
Chris@299
|
118 this, SLOT(spectrogramXSmoothingChanged(int)));
|
Chris@299
|
119
|
Chris@0
|
120 QComboBox *propertyLayout = new QComboBox;
|
Chris@114
|
121 int pl = prefs->getPropertyRangeAndValue("Property Box Layout", &min, &max,
|
Chris@115
|
122 &deflt);
|
Chris@0
|
123 m_propertyLayout = pl;
|
Chris@0
|
124
|
Chris@0
|
125 for (i = min; i <= max; ++i) {
|
Chris@0
|
126 propertyLayout->addItem(prefs->getPropertyValueLabel("Property Box Layout", i));
|
Chris@0
|
127 }
|
Chris@0
|
128
|
Chris@0
|
129 propertyLayout->setCurrentIndex(pl);
|
Chris@0
|
130
|
Chris@0
|
131 connect(propertyLayout, SIGNAL(currentIndexChanged(int)),
|
Chris@0
|
132 this, SLOT(propertyLayoutChanged(int)));
|
Chris@0
|
133
|
Chris@1096
|
134 QSettings settings;
|
Chris@1096
|
135 settings.beginGroup("Preferences");
|
Chris@1096
|
136 m_spectrogramGColour = (settings.value("spectrogram-colour",
|
Chris@1096
|
137 int(ColourMapper::Green)).toInt());
|
Chris@1096
|
138 m_spectrogramMColour = (settings.value("spectrogram-melodic-colour",
|
Chris@1096
|
139 int(ColourMapper::Sunset)).toInt());
|
Chris@1097
|
140 m_colour3DColour = (settings.value("colour-3d-plot-colour",
|
Chris@1097
|
141 int(ColourMapper::Green)).toInt());
|
Chris@1096
|
142 settings.endGroup();
|
Chris@1096
|
143 QComboBox *spectrogramGColour = new QComboBox;
|
Chris@1096
|
144 QComboBox *spectrogramMColour = new QComboBox;
|
Chris@1097
|
145 QComboBox *colour3DColour = new QComboBox;
|
Chris@1096
|
146 for (i = 0; i < ColourMapper::getColourMapCount(); ++i) {
|
Chris@1096
|
147 spectrogramGColour->addItem(ColourMapper::getColourMapName(i));
|
Chris@1096
|
148 spectrogramMColour->addItem(ColourMapper::getColourMapName(i));
|
Chris@1097
|
149 colour3DColour->addItem(ColourMapper::getColourMapName(i));
|
Chris@1096
|
150 if (i == m_spectrogramGColour) spectrogramGColour->setCurrentIndex(i);
|
Chris@1096
|
151 if (i == m_spectrogramMColour) spectrogramMColour->setCurrentIndex(i);
|
Chris@1097
|
152 if (i == m_colour3DColour) colour3DColour->setCurrentIndex(i);
|
Chris@1096
|
153 }
|
Chris@1096
|
154 connect(spectrogramGColour, SIGNAL(currentIndexChanged(int)),
|
Chris@1096
|
155 this, SLOT(spectrogramGColourChanged(int)));
|
Chris@1096
|
156 connect(spectrogramMColour, SIGNAL(currentIndexChanged(int)),
|
Chris@1096
|
157 this, SLOT(spectrogramMColourChanged(int)));
|
Chris@1097
|
158 connect(colour3DColour, SIGNAL(currentIndexChanged(int)),
|
Chris@1097
|
159 this, SLOT(colour3DColourChanged(int)));
|
Chris@702
|
160
|
Chris@0
|
161 m_tuningFrequency = prefs->getTuningFrequency();
|
Chris@0
|
162
|
Chris@0
|
163 QDoubleSpinBox *frequency = new QDoubleSpinBox;
|
Chris@0
|
164 frequency->setMinimum(100.0);
|
Chris@0
|
165 frequency->setMaximum(5000.0);
|
Chris@0
|
166 frequency->setSuffix(" Hz");
|
Chris@0
|
167 frequency->setSingleStep(1);
|
Chris@0
|
168 frequency->setValue(m_tuningFrequency);
|
Chris@0
|
169 frequency->setDecimals(2);
|
Chris@0
|
170
|
Chris@0
|
171 connect(frequency, SIGNAL(valueChanged(double)),
|
Chris@0
|
172 this, SLOT(tuningFrequencyChanged(double)));
|
Chris@0
|
173
|
Chris@702
|
174 QComboBox *octaveSystem = new QComboBox;
|
Chris@702
|
175 int oct = prefs->getPropertyRangeAndValue
|
Chris@702
|
176 ("Octave Numbering System", &min, &max, &deflt);
|
Chris@702
|
177 m_octaveSystem = oct;
|
Chris@702
|
178 for (i = min; i <= max; ++i) {
|
Chris@702
|
179 octaveSystem->addItem(prefs->getPropertyValueLabel
|
Chris@702
|
180 ("Octave Numbering System", i));
|
Chris@702
|
181 }
|
Chris@702
|
182 octaveSystem->setCurrentIndex(oct);
|
Chris@702
|
183
|
Chris@702
|
184 connect(octaveSystem, SIGNAL(currentIndexChanged(int)),
|
Chris@702
|
185 this, SLOT(octaveSystemChanged(int)));
|
Chris@702
|
186
|
Chris@1035
|
187 /*!!! restore
|
Chris@263
|
188 QComboBox *audioDevice = new QComboBox;
|
Chris@263
|
189 std::vector<QString> devices =
|
Chris@263
|
190 AudioTargetFactory::getInstance()->getCallbackTargetNames();
|
Chris@263
|
191
|
Chris@263
|
192 settings.beginGroup("Preferences");
|
Chris@263
|
193 QString targetName = settings.value("audio-target", "").toString();
|
Chris@263
|
194 settings.endGroup();
|
Chris@263
|
195
|
Chris@658
|
196 for (int i = 0; i < (int)devices.size(); ++i) {
|
Chris@263
|
197 audioDevice->addItem(AudioTargetFactory::getInstance()
|
Chris@263
|
198 ->getCallbackTargetDescription(devices[i]));
|
Chris@263
|
199 if (targetName == devices[i]) audioDevice->setCurrentIndex(i);
|
Chris@263
|
200 }
|
Chris@263
|
201
|
Chris@263
|
202 connect(audioDevice, SIGNAL(currentIndexChanged(int)),
|
Chris@263
|
203 this, SLOT(audioDeviceChanged(int)));
|
Chris@1035
|
204 */
|
Chris@32
|
205 QComboBox *resampleQuality = new QComboBox;
|
Chris@32
|
206
|
Chris@114
|
207 int rsq = prefs->getPropertyRangeAndValue("Resample Quality", &min, &max,
|
Chris@114
|
208 &deflt);
|
Chris@32
|
209 m_resampleQuality = rsq;
|
Chris@32
|
210
|
Chris@32
|
211 for (i = min; i <= max; ++i) {
|
Chris@32
|
212 resampleQuality->addItem(prefs->getPropertyValueLabel("Resample Quality", i));
|
Chris@32
|
213 }
|
Chris@32
|
214
|
Chris@32
|
215 resampleQuality->setCurrentIndex(rsq);
|
Chris@32
|
216
|
Chris@32
|
217 connect(resampleQuality, SIGNAL(currentIndexChanged(int)),
|
Chris@32
|
218 this, SLOT(resampleQualityChanged(int)));
|
Chris@32
|
219
|
Chris@180
|
220 QCheckBox *resampleOnLoad = new QCheckBox;
|
Chris@180
|
221 m_resampleOnLoad = prefs->getResampleOnLoad();
|
Chris@180
|
222 resampleOnLoad->setCheckState(m_resampleOnLoad ? Qt::Checked :
|
Chris@180
|
223 Qt::Unchecked);
|
Chris@180
|
224 connect(resampleOnLoad, SIGNAL(stateChanged(int)),
|
Chris@180
|
225 this, SLOT(resampleOnLoadChanged(int)));
|
Chris@180
|
226
|
Chris@1379
|
227 QCheckBox *gaplessMode = new QCheckBox;
|
Chris@1379
|
228 m_gapless = prefs->getUseGaplessMode();
|
Chris@1379
|
229 gaplessMode->setCheckState(m_gapless ? Qt::Checked : Qt::Unchecked);
|
Chris@1379
|
230 connect(gaplessMode, SIGNAL(stateChanged(int)),
|
Chris@1379
|
231 this, SLOT(gaplessModeChanged(int)));
|
Chris@1379
|
232
|
Chris@180
|
233 m_tempDirRootEdit = new QLineEdit;
|
Chris@180
|
234 QString dir = prefs->getTemporaryDirectoryRoot();
|
Chris@180
|
235 m_tempDirRoot = dir;
|
Chris@180
|
236 dir.replace("$HOME", tr("<home directory>"));
|
Chris@180
|
237 m_tempDirRootEdit->setText(dir);
|
Chris@180
|
238 m_tempDirRootEdit->setReadOnly(true);
|
Chris@180
|
239 QPushButton *tempDirButton = new QPushButton;
|
Chris@180
|
240 tempDirButton->setIcon(IconLoader().load("fileopen"));
|
Chris@180
|
241 connect(tempDirButton, SIGNAL(clicked()),
|
Chris@180
|
242 this, SLOT(tempDirButtonClicked()));
|
Chris@180
|
243 tempDirButton->setFixedSize(QSize(24, 24));
|
Chris@180
|
244
|
Chris@237
|
245 QCheckBox *showSplash = new QCheckBox;
|
Chris@237
|
246 m_showSplash = prefs->getShowSplash();
|
Chris@237
|
247 showSplash->setCheckState(m_showSplash ? Qt::Checked : Qt::Unchecked);
|
Chris@237
|
248 connect(showSplash, SIGNAL(stateChanged(int)),
|
Chris@237
|
249 this, SLOT(showSplashChanged(int)));
|
Chris@237
|
250
|
Chris@1092
|
251 #ifdef NOT_DEFINED // This no longer works correctly on any platform AFAICS
|
Chris@180
|
252 QComboBox *bgMode = new QComboBox;
|
Chris@180
|
253 int bg = prefs->getPropertyRangeAndValue("Background Mode", &min, &max,
|
Chris@180
|
254 &deflt);
|
Chris@180
|
255 m_backgroundMode = bg;
|
Chris@180
|
256 for (i = min; i <= max; ++i) {
|
Chris@180
|
257 bgMode->addItem(prefs->getPropertyValueLabel("Background Mode", i));
|
Chris@180
|
258 }
|
Chris@180
|
259 bgMode->setCurrentIndex(bg);
|
Chris@180
|
260
|
Chris@180
|
261 connect(bgMode, SIGNAL(currentIndexChanged(int)),
|
Chris@180
|
262 this, SLOT(backgroundModeChanged(int)));
|
Chris@237
|
263 #endif
|
Chris@180
|
264
|
Chris@658
|
265 settings.beginGroup("Preferences");
|
Chris@686
|
266
|
Chris@950
|
267 #ifdef Q_OS_MAC
|
Chris@950
|
268 m_retina = settings.value("scaledHiDpi", true).toBool();
|
Chris@950
|
269 QCheckBox *retina = new QCheckBox;
|
Chris@950
|
270 retina->setCheckState(m_retina ? Qt::Checked : Qt::Unchecked);
|
Chris@950
|
271 connect(retina, SIGNAL(stateChanged(int)), this, SLOT(retinaChanged(int)));
|
Chris@950
|
272 #else
|
Chris@950
|
273 m_retina = false;
|
Chris@950
|
274 #endif
|
Chris@950
|
275
|
Chris@658
|
276 QString userLocale = settings.value("locale", "").toString();
|
Chris@658
|
277 m_currentLocale = userLocale;
|
Chris@686
|
278
|
Chris@686
|
279 QString permishTag = QString("network-permission-%1").arg(SV_VERSION);
|
Chris@686
|
280 m_networkPermission = settings.value(permishTag, false).toBool();
|
Chris@686
|
281
|
Chris@658
|
282 settings.endGroup();
|
Chris@658
|
283
|
Chris@658
|
284 QComboBox *locale = new QComboBox;
|
Chris@658
|
285 QStringList localeFiles = QDir(":i18n").entryList(QStringList() << "*.qm");
|
Chris@658
|
286 locale->addItem(tr("Follow system locale"));
|
Chris@658
|
287 m_locales.push_back("");
|
Chris@658
|
288 if (userLocale == "") {
|
Chris@658
|
289 locale->setCurrentIndex(0);
|
Chris@658
|
290 }
|
Chris@658
|
291 foreach (QString f, localeFiles) {
|
Chris@658
|
292 QString f0 = f;
|
Chris@658
|
293 f.replace("sonic-visualiser_", "").replace(".qm", "");
|
Chris@658
|
294 if (f == f0) { // our expectations about filename format were not met
|
Chris@665
|
295 cerr << "INFO: Unexpected filename " << f << " in i18n resource directory" << endl;
|
Chris@658
|
296 } else {
|
Chris@658
|
297 m_locales.push_back(f);
|
Chris@658
|
298 QString displayText;
|
Chris@658
|
299 // Add new translations here
|
Chris@658
|
300 if (f == "ru") displayText = tr("Russian");
|
Chris@658
|
301 else if (f == "en_GB") displayText = tr("British English");
|
Chris@658
|
302 else if (f == "en_US") displayText = tr("American English");
|
Chris@658
|
303 else if (f == "cs_CZ") displayText = tr("Czech");
|
Chris@658
|
304 else displayText = f;
|
Chris@658
|
305 locale->addItem(QString("%1 [%2]").arg(displayText).arg(f));
|
Chris@658
|
306 if (userLocale == f) {
|
Chris@658
|
307 locale->setCurrentIndex(locale->count() - 1);
|
Chris@658
|
308 }
|
Chris@658
|
309 }
|
Chris@658
|
310 }
|
Chris@658
|
311 connect(locale, SIGNAL(currentIndexChanged(int)),
|
Chris@658
|
312 this, SLOT(localeChanged(int)));
|
Chris@658
|
313
|
Chris@686
|
314 QCheckBox *networkPermish = new QCheckBox;
|
Chris@686
|
315 networkPermish->setCheckState(m_networkPermission ? Qt::Checked : Qt::Unchecked);
|
Chris@686
|
316 connect(networkPermish, SIGNAL(stateChanged(int)),
|
Chris@686
|
317 this, SLOT(networkPermissionChanged(int)));
|
Chris@686
|
318
|
Chris@225
|
319 QSpinBox *fontSize = new QSpinBox;
|
Chris@225
|
320 int fs = prefs->getPropertyRangeAndValue("View Font Size", &min, &max,
|
Chris@225
|
321 &deflt);
|
Chris@234
|
322 m_viewFontSize = fs;
|
Chris@225
|
323 fontSize->setMinimum(min);
|
Chris@225
|
324 fontSize->setMaximum(max);
|
Chris@225
|
325 fontSize->setSuffix(" pt");
|
Chris@225
|
326 fontSize->setSingleStep(1);
|
Chris@225
|
327 fontSize->setValue(fs);
|
Chris@225
|
328
|
Chris@225
|
329 connect(fontSize, SIGNAL(valueChanged(int)),
|
Chris@225
|
330 this, SLOT(viewFontSizeChanged(int)));
|
Chris@225
|
331
|
Chris@337
|
332 QComboBox *ttMode = new QComboBox;
|
Chris@337
|
333 int tt = prefs->getPropertyRangeAndValue("Time To Text Mode", &min, &max,
|
Chris@337
|
334 &deflt);
|
Chris@337
|
335 m_timeToTextMode = tt;
|
Chris@337
|
336 for (i = min; i <= max; ++i) {
|
Chris@337
|
337 ttMode->addItem(prefs->getPropertyValueLabel("Time To Text Mode", i));
|
Chris@337
|
338 }
|
Chris@337
|
339 ttMode->setCurrentIndex(tt);
|
Chris@337
|
340
|
Chris@337
|
341 connect(ttMode, SIGNAL(currentIndexChanged(int)),
|
Chris@337
|
342 this, SLOT(timeToTextModeChanged(int)));
|
Chris@337
|
343
|
Chris@906
|
344 QCheckBox *hms = new QCheckBox;
|
Chris@906
|
345 int showHMS = prefs->getPropertyRangeAndValue
|
Chris@906
|
346 ("Show Hours And Minutes", &min, &max, &deflt);
|
Chris@906
|
347 m_showHMS = (showHMS != 0);
|
Chris@906
|
348 hms->setCheckState(m_showHMS ? Qt::Checked : Qt::Unchecked);
|
Chris@906
|
349 connect(hms, SIGNAL(stateChanged(int)),
|
Chris@906
|
350 this, SLOT(showHMSChanged(int)));
|
Chris@906
|
351
|
Chris@180
|
352 // General tab
|
Chris@180
|
353
|
Chris@180
|
354 QFrame *frame = new QFrame;
|
Chris@180
|
355
|
Chris@180
|
356 QGridLayout *subgrid = new QGridLayout;
|
Chris@180
|
357 frame->setLayout(subgrid);
|
Chris@180
|
358
|
Chris@0
|
359 int row = 0;
|
Chris@0
|
360
|
Chris@658
|
361 subgrid->addWidget(new QLabel(tr("%1:").arg(tr("User interface language"))),
|
Chris@658
|
362 row, 0);
|
Chris@658
|
363 subgrid->addWidget(locale, row++, 1, 1, 1);
|
Chris@658
|
364
|
Chris@686
|
365 subgrid->addWidget(new QLabel(tr("%1:").arg(tr("Allow network usage"))),
|
Chris@686
|
366 row, 0);
|
Chris@686
|
367 subgrid->addWidget(networkPermish, row++, 1, 1, 1);
|
Chris@686
|
368
|
Chris@0
|
369 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@263
|
370 ("Temporary Directory Root"))),
|
Chris@263
|
371 row, 0);
|
Chris@263
|
372 subgrid->addWidget(m_tempDirRootEdit, row, 1, 1, 1);
|
Chris@263
|
373 subgrid->addWidget(tempDirButton, row, 2, 1, 1);
|
Chris@263
|
374 row++;
|
Chris@263
|
375
|
Chris@263
|
376 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@263
|
377 ("Resample On Load"))),
|
Chris@263
|
378 row, 0);
|
Chris@263
|
379 subgrid->addWidget(resampleOnLoad, row++, 1, 1, 1);
|
Chris@263
|
380
|
Chris@1379
|
381 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@1379
|
382 ("Use Gapless Mode"))),
|
Chris@1379
|
383 row, 0);
|
Chris@1379
|
384 subgrid->addWidget(gaplessMode, row++, 1, 1, 1);
|
Chris@1379
|
385
|
Chris@1035
|
386 //!!! subgrid->addWidget(new QLabel(tr("Playback audio device:")), row, 0);
|
Chris@1035
|
387 //!!! subgrid->addWidget(audioDevice, row++, 1, 1, 2);
|
Chris@263
|
388
|
Chris@263
|
389 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@263
|
390 ("Resample Quality"))),
|
Chris@263
|
391 row, 0);
|
Chris@263
|
392 subgrid->addWidget(resampleQuality, row++, 1, 1, 2);
|
Chris@263
|
393
|
Chris@263
|
394 subgrid->setRowStretch(row, 10);
|
Chris@263
|
395
|
Chris@436
|
396 m_tabOrdering[GeneralTab] = m_tabs->count();
|
Chris@436
|
397 m_tabs->addTab(frame, tr("&General"));
|
Chris@263
|
398
|
Chris@263
|
399 // Appearance tab
|
Chris@263
|
400
|
Chris@263
|
401 frame = new QFrame;
|
Chris@263
|
402 subgrid = new QGridLayout;
|
Chris@263
|
403 frame->setLayout(subgrid);
|
Chris@263
|
404 row = 0;
|
Chris@263
|
405
|
Chris@263
|
406 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@906
|
407 ("Show Splash Screen"))),
|
Chris@906
|
408 row, 0);
|
Chris@906
|
409 subgrid->addWidget(showSplash, row++, 1, 1, 1);
|
Chris@906
|
410
|
Chris@950
|
411 #ifdef Q_OS_MAC
|
Chris@950
|
412 if (devicePixelRatio() > 1) {
|
Chris@950
|
413 subgrid->addWidget(new QLabel(tr("Draw layers at Retina resolution:")), row, 0);
|
Chris@950
|
414 subgrid->addWidget(retina, row++, 1, 1, 1);
|
Chris@950
|
415 }
|
Chris@950
|
416 #endif
|
Chris@950
|
417
|
Chris@906
|
418 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@0
|
419 ("Property Box Layout"))),
|
Chris@0
|
420 row, 0);
|
Chris@0
|
421 subgrid->addWidget(propertyLayout, row++, 1, 1, 2);
|
Chris@0
|
422
|
Chris@1098
|
423 subgrid->addWidget(new QLabel(tr("Default spectrogram colour:")),
|
Chris@1096
|
424 row, 0);
|
Chris@1096
|
425 subgrid->addWidget(spectrogramGColour, row++, 1, 1, 2);
|
Chris@1096
|
426
|
Chris@1098
|
427 subgrid->addWidget(new QLabel(tr("Default melodic spectrogram colour:")),
|
Chris@1096
|
428 row, 0);
|
Chris@1096
|
429 subgrid->addWidget(spectrogramMColour, row++, 1, 1, 2);
|
Chris@1096
|
430
|
Chris@1098
|
431 subgrid->addWidget(new QLabel(tr("Default colour 3D plot colour:")),
|
Chris@1097
|
432 row, 0);
|
Chris@1097
|
433 subgrid->addWidget(colour3DColour, row++, 1, 1, 2);
|
Chris@1097
|
434
|
Chris@1092
|
435 #ifdef NOT_DEFINED // see earlier
|
Chris@0
|
436 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@180
|
437 ("Background Mode"))),
|
Chris@0
|
438 row, 0);
|
Chris@180
|
439 subgrid->addWidget(bgMode, row++, 1, 1, 2);
|
Chris@242
|
440 #endif
|
Chris@180
|
441
|
Chris@180
|
442 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@225
|
443 ("View Font Size"))),
|
Chris@225
|
444 row, 0);
|
Chris@225
|
445 subgrid->addWidget(fontSize, row++, 1, 1, 2);
|
Chris@225
|
446
|
Chris@225
|
447 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@337
|
448 ("Time To Text Mode"))),
|
Chris@337
|
449 row, 0);
|
Chris@337
|
450 subgrid->addWidget(ttMode, row++, 1, 1, 2);
|
Chris@337
|
451
|
Chris@337
|
452 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@906
|
453 ("Show Hours And Minutes"))),
|
Chris@237
|
454 row, 0);
|
Chris@906
|
455 subgrid->addWidget(hms, row++, 1, 1, 1);
|
Chris@237
|
456
|
Chris@180
|
457 subgrid->setRowStretch(row, 10);
|
Chris@180
|
458
|
Chris@436
|
459 m_tabOrdering[AppearanceTab] = m_tabs->count();
|
Chris@436
|
460 m_tabs->addTab(frame, tr("&Appearance"));
|
Chris@180
|
461
|
Chris@180
|
462 // Analysis tab
|
Chris@180
|
463
|
Chris@180
|
464 frame = new QFrame;
|
Chris@180
|
465 subgrid = new QGridLayout;
|
Chris@180
|
466 frame->setLayout(subgrid);
|
Chris@180
|
467 row = 0;
|
Chris@180
|
468
|
Chris@180
|
469 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@180
|
470 ("Tuning Frequency"))),
|
Chris@180
|
471 row, 0);
|
Chris@180
|
472 subgrid->addWidget(frequency, row++, 1, 1, 2);
|
Chris@180
|
473
|
Chris@702
|
474 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@702
|
475 ("Octave Numbering System"))),
|
Chris@702
|
476 row, 0);
|
Chris@702
|
477 subgrid->addWidget(octaveSystem, row++, 1, 1, 2);
|
Chris@702
|
478
|
Chris@0
|
479 subgrid->addWidget(new QLabel(prefs->getPropertyLabel
|
Chris@299
|
480 ("Spectrogram Y Smoothing")),
|
Chris@115
|
481 row, 0);
|
Chris@115
|
482 subgrid->addWidget(smoothing, row++, 1, 1, 2);
|
Chris@0
|
483
|
Chris@299
|
484 subgrid->addWidget(new QLabel(prefs->getPropertyLabel
|
Chris@299
|
485 ("Spectrogram X Smoothing")),
|
Chris@299
|
486 row, 0);
|
Chris@299
|
487 subgrid->addWidget(xsmoothing, row++, 1, 1, 2);
|
Chris@299
|
488
|
Chris@0
|
489 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
|
Chris@0
|
490 ("Window Type"))),
|
Chris@0
|
491 row, 0);
|
Chris@9
|
492 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2);
|
Chris@1275
|
493
|
Chris@9
|
494 subgrid->setRowStretch(row, 10);
|
Chris@9
|
495 row++;
|
Chris@1275
|
496
|
Chris@1275
|
497 subgrid->addWidget(new QLabel(tr("Run Vamp plugins in separate process:")),
|
Chris@1275
|
498 row, 0);
|
Chris@1275
|
499 subgrid->addWidget(vampProcessSeparation, row++, 1, 1, 1);
|
Chris@0
|
500
|
Chris@180
|
501 subgrid->setRowStretch(row, 10);
|
Chris@180
|
502
|
Chris@436
|
503 m_tabOrdering[AnalysisTab] = m_tabs->count();
|
Chris@436
|
504 m_tabs->addTab(frame, tr("Anal&ysis"));
|
Chris@436
|
505
|
Chris@436
|
506 // Template tab
|
Chris@436
|
507
|
Chris@436
|
508 frame = new QFrame;
|
Chris@436
|
509 subgrid = new QGridLayout;
|
Chris@436
|
510 frame->setLayout(subgrid);
|
Chris@436
|
511 row = 0;
|
Chris@436
|
512
|
Chris@436
|
513 subgrid->addWidget(new QLabel(tr("Default session template for audio files:")), row++, 0);
|
Chris@436
|
514
|
Chris@436
|
515 QListWidget *lw = new QListWidget();
|
Chris@436
|
516 subgrid->addWidget(lw, row, 0);
|
Chris@436
|
517 subgrid->setRowStretch(row, 10);
|
Chris@436
|
518 row++;
|
Chris@436
|
519
|
Chris@436
|
520 settings.beginGroup("MainWindow");
|
Chris@436
|
521 m_currentTemplate = settings.value("sessiontemplate", "").toString();
|
Chris@436
|
522 settings.endGroup();
|
Chris@436
|
523
|
Chris@455
|
524 lw->addItem(tr("Standard Waveform"));
|
Chris@436
|
525 if (m_currentTemplate == "" || m_currentTemplate == "default") {
|
Chris@436
|
526 lw->setCurrentRow(lw->count()-1);
|
Chris@436
|
527 }
|
Chris@436
|
528 m_templates.push_back("");
|
Chris@436
|
529
|
Chris@436
|
530 QStringList templates = ResourceFinder().getResourceFiles("templates", "svt");
|
Chris@436
|
531
|
Chris@436
|
532 std::set<QString> byName;
|
Chris@436
|
533 foreach (QString t, templates) {
|
Chris@436
|
534 byName.insert(QFileInfo(t).baseName());
|
Chris@436
|
535 }
|
Chris@436
|
536
|
Chris@436
|
537 foreach (QString t, byName) {
|
Chris@436
|
538 if (t.toLower() == "default") continue;
|
Chris@436
|
539 m_templates.push_back(t);
|
Chris@436
|
540 lw->addItem(t);
|
Chris@436
|
541 if (m_currentTemplate == t) {
|
Chris@436
|
542 lw->setCurrentRow(lw->count()-1);
|
Chris@436
|
543 }
|
Chris@436
|
544 }
|
Chris@436
|
545
|
Chris@436
|
546 connect(lw, SIGNAL(currentRowChanged(int)), this, SLOT(defaultTemplateChanged(int)));
|
Chris@436
|
547
|
Chris@436
|
548 m_tabOrdering[TemplateTab] = m_tabs->count();
|
Chris@436
|
549 m_tabs->addTab(frame, tr("Session &Template"));
|
Chris@180
|
550
|
Chris@163
|
551 QDialogButtonBox *bb = new QDialogButtonBox(Qt::Horizontal);
|
Chris@163
|
552 grid->addWidget(bb, 1, 0);
|
Chris@0
|
553
|
Chris@0
|
554 QPushButton *ok = new QPushButton(tr("OK"));
|
Chris@0
|
555 QPushButton *cancel = new QPushButton(tr("Cancel"));
|
Chris@163
|
556 bb->addButton(ok, QDialogButtonBox::AcceptRole);
|
Chris@163
|
557 bb->addButton(m_applyButton, QDialogButtonBox::ApplyRole);
|
Chris@163
|
558 bb->addButton(cancel, QDialogButtonBox::RejectRole);
|
Chris@0
|
559 connect(ok, SIGNAL(clicked()), this, SLOT(okClicked()));
|
Chris@0
|
560 connect(m_applyButton, SIGNAL(clicked()), this, SLOT(applyClicked()));
|
Chris@0
|
561 connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
|
Chris@0
|
562
|
Chris@0
|
563 m_applyButton->setEnabled(false);
|
Chris@0
|
564 }
|
Chris@0
|
565
|
Chris@0
|
566 PreferencesDialog::~PreferencesDialog()
|
Chris@0
|
567 {
|
Chris@438
|
568 SVDEBUG << "PreferencesDialog::~PreferencesDialog()" << endl;
|
Chris@0
|
569 }
|
Chris@0
|
570
|
Chris@0
|
571 void
|
Chris@436
|
572 PreferencesDialog::switchToTab(Tab t)
|
Chris@436
|
573 {
|
Chris@436
|
574 if (m_tabOrdering.contains(t)) {
|
Chris@436
|
575 m_tabs->setCurrentIndex(m_tabOrdering[t]);
|
Chris@436
|
576 }
|
Chris@436
|
577 }
|
Chris@436
|
578
|
Chris@436
|
579 void
|
Chris@9
|
580 PreferencesDialog::windowTypeChanged(WindowType type)
|
Chris@0
|
581 {
|
Chris@0
|
582 m_windowType = type;
|
Chris@0
|
583 m_applyButton->setEnabled(true);
|
Chris@0
|
584 }
|
Chris@0
|
585
|
Chris@0
|
586 void
|
Chris@115
|
587 PreferencesDialog::spectrogramSmoothingChanged(int smoothing)
|
Chris@0
|
588 {
|
Chris@115
|
589 m_spectrogramSmoothing = smoothing;
|
Chris@0
|
590 m_applyButton->setEnabled(true);
|
Chris@0
|
591 }
|
Chris@0
|
592
|
Chris@0
|
593 void
|
Chris@299
|
594 PreferencesDialog::spectrogramXSmoothingChanged(int smoothing)
|
Chris@299
|
595 {
|
Chris@299
|
596 m_spectrogramXSmoothing = smoothing;
|
Chris@299
|
597 m_applyButton->setEnabled(true);
|
Chris@299
|
598 }
|
Chris@299
|
599
|
Chris@299
|
600 void
|
Chris@1096
|
601 PreferencesDialog::spectrogramGColourChanged(int colour)
|
Chris@1096
|
602 {
|
Chris@1096
|
603 m_spectrogramGColour = colour;
|
Chris@1096
|
604 m_applyButton->setEnabled(true);
|
Chris@1096
|
605 }
|
Chris@1096
|
606
|
Chris@1096
|
607 void
|
Chris@1096
|
608 PreferencesDialog::spectrogramMColourChanged(int colour)
|
Chris@1096
|
609 {
|
Chris@1096
|
610 m_spectrogramMColour = colour;
|
Chris@1096
|
611 m_applyButton->setEnabled(true);
|
Chris@1096
|
612 }
|
Chris@1096
|
613
|
Chris@1096
|
614 void
|
Chris@1097
|
615 PreferencesDialog::colour3DColourChanged(int colour)
|
Chris@1097
|
616 {
|
Chris@1097
|
617 m_colour3DColour = colour;
|
Chris@1097
|
618 m_applyButton->setEnabled(true);
|
Chris@1097
|
619 }
|
Chris@1097
|
620
|
Chris@1097
|
621 void
|
Chris@0
|
622 PreferencesDialog::propertyLayoutChanged(int layout)
|
Chris@0
|
623 {
|
Chris@0
|
624 m_propertyLayout = layout;
|
Chris@0
|
625 m_applyButton->setEnabled(true);
|
Chris@0
|
626 }
|
Chris@0
|
627
|
Chris@0
|
628 void
|
Chris@0
|
629 PreferencesDialog::tuningFrequencyChanged(double freq)
|
Chris@0
|
630 {
|
Chris@0
|
631 m_tuningFrequency = freq;
|
Chris@0
|
632 m_applyButton->setEnabled(true);
|
Chris@0
|
633 }
|
Chris@0
|
634
|
Chris@0
|
635 void
|
Chris@263
|
636 PreferencesDialog::audioDeviceChanged(int s)
|
Chris@263
|
637 {
|
Chris@263
|
638 m_audioDevice = s;
|
Chris@263
|
639 m_applyButton->setEnabled(true);
|
Chris@263
|
640 m_changesOnRestart = true;
|
Chris@263
|
641 }
|
Chris@263
|
642
|
Chris@263
|
643 void
|
Chris@32
|
644 PreferencesDialog::resampleQualityChanged(int q)
|
Chris@32
|
645 {
|
Chris@32
|
646 m_resampleQuality = q;
|
Chris@32
|
647 m_applyButton->setEnabled(true);
|
Chris@32
|
648 }
|
Chris@32
|
649
|
Chris@32
|
650 void
|
Chris@180
|
651 PreferencesDialog::resampleOnLoadChanged(int state)
|
Chris@180
|
652 {
|
Chris@180
|
653 m_resampleOnLoad = (state == Qt::Checked);
|
Chris@180
|
654 m_applyButton->setEnabled(true);
|
Chris@180
|
655 m_changesOnRestart = true;
|
Chris@180
|
656 }
|
Chris@180
|
657
|
Chris@180
|
658 void
|
Chris@1379
|
659 PreferencesDialog::gaplessModeChanged(int state)
|
Chris@1379
|
660 {
|
Chris@1379
|
661 m_gapless = (state == Qt::Checked);
|
Chris@1379
|
662 m_applyButton->setEnabled(true);
|
Chris@1379
|
663 }
|
Chris@1379
|
664
|
Chris@1379
|
665 void
|
Chris@1275
|
666 PreferencesDialog::vampProcessSeparationChanged(int state)
|
Chris@1275
|
667 {
|
Chris@1275
|
668 m_runPluginsInProcess = (state == Qt::Unchecked);
|
Chris@1275
|
669 m_applyButton->setEnabled(true);
|
Chris@1275
|
670 m_changesOnRestart = true;
|
Chris@1275
|
671 }
|
Chris@1275
|
672
|
Chris@1275
|
673 void
|
Chris@686
|
674 PreferencesDialog::networkPermissionChanged(int state)
|
Chris@686
|
675 {
|
Chris@686
|
676 m_networkPermission = (state == Qt::Checked);
|
Chris@686
|
677 m_applyButton->setEnabled(true);
|
Chris@686
|
678 m_changesOnRestart = true;
|
Chris@686
|
679 }
|
Chris@686
|
680
|
Chris@686
|
681 void
|
Chris@950
|
682 PreferencesDialog::retinaChanged(int state)
|
Chris@950
|
683 {
|
Chris@950
|
684 m_retina = (state == Qt::Checked);
|
Chris@950
|
685 m_applyButton->setEnabled(true);
|
Chris@950
|
686 // Does not require a restart
|
Chris@950
|
687 }
|
Chris@950
|
688
|
Chris@950
|
689 void
|
Chris@237
|
690 PreferencesDialog::showSplashChanged(int state)
|
Chris@237
|
691 {
|
Chris@237
|
692 m_showSplash = (state == Qt::Checked);
|
Chris@237
|
693 m_applyButton->setEnabled(true);
|
Chris@237
|
694 m_changesOnRestart = true;
|
Chris@237
|
695 }
|
Chris@237
|
696
|
Chris@237
|
697 void
|
Chris@436
|
698 PreferencesDialog::defaultTemplateChanged(int i)
|
Chris@436
|
699 {
|
Chris@436
|
700 m_currentTemplate = m_templates[i];
|
Chris@436
|
701 m_applyButton->setEnabled(true);
|
Chris@436
|
702 }
|
Chris@436
|
703
|
Chris@436
|
704 void
|
Chris@658
|
705 PreferencesDialog::localeChanged(int i)
|
Chris@658
|
706 {
|
Chris@658
|
707 m_currentLocale = m_locales[i];
|
Chris@658
|
708 m_applyButton->setEnabled(true);
|
Chris@658
|
709 m_changesOnRestart = true;
|
Chris@658
|
710 }
|
Chris@658
|
711
|
Chris@658
|
712 void
|
Chris@180
|
713 PreferencesDialog::tempDirRootChanged(QString r)
|
Chris@180
|
714 {
|
Chris@180
|
715 m_tempDirRoot = r;
|
Chris@180
|
716 m_applyButton->setEnabled(true);
|
Chris@180
|
717 }
|
Chris@180
|
718
|
Chris@180
|
719 void
|
Chris@180
|
720 PreferencesDialog::tempDirButtonClicked()
|
Chris@180
|
721 {
|
Chris@180
|
722 QString dir = QFileDialog::getExistingDirectory
|
Chris@180
|
723 (this, tr("Select a directory to create cache subdirectory in"),
|
Chris@180
|
724 m_tempDirRoot);
|
Chris@180
|
725 if (dir == "") return;
|
Chris@180
|
726 m_tempDirRootEdit->setText(dir);
|
Chris@180
|
727 tempDirRootChanged(dir);
|
Chris@180
|
728 m_changesOnRestart = true;
|
Chris@180
|
729 }
|
Chris@180
|
730
|
Chris@180
|
731 void
|
Chris@180
|
732 PreferencesDialog::backgroundModeChanged(int mode)
|
Chris@180
|
733 {
|
Chris@180
|
734 m_backgroundMode = mode;
|
Chris@180
|
735 m_applyButton->setEnabled(true);
|
Chris@180
|
736 m_changesOnRestart = true;
|
Chris@180
|
737 }
|
Chris@180
|
738
|
Chris@180
|
739 void
|
Chris@337
|
740 PreferencesDialog::timeToTextModeChanged(int mode)
|
Chris@337
|
741 {
|
Chris@337
|
742 m_timeToTextMode = mode;
|
Chris@337
|
743 m_applyButton->setEnabled(true);
|
Chris@337
|
744 }
|
Chris@337
|
745
|
Chris@337
|
746 void
|
Chris@906
|
747 PreferencesDialog::showHMSChanged(int state)
|
Chris@906
|
748 {
|
Chris@906
|
749 m_showHMS = (state == Qt::Checked);
|
Chris@906
|
750 m_applyButton->setEnabled(true);
|
Chris@906
|
751 }
|
Chris@906
|
752
|
Chris@906
|
753 void
|
Chris@702
|
754 PreferencesDialog::octaveSystemChanged(int system)
|
Chris@702
|
755 {
|
Chris@702
|
756 m_octaveSystem = system;
|
Chris@702
|
757 m_applyButton->setEnabled(true);
|
Chris@702
|
758 }
|
Chris@702
|
759
|
Chris@702
|
760 void
|
Chris@225
|
761 PreferencesDialog::viewFontSizeChanged(int sz)
|
Chris@225
|
762 {
|
Chris@225
|
763 m_viewFontSize = sz;
|
Chris@225
|
764 m_applyButton->setEnabled(true);
|
Chris@225
|
765 }
|
Chris@225
|
766
|
Chris@225
|
767 void
|
Chris@0
|
768 PreferencesDialog::okClicked()
|
Chris@0
|
769 {
|
Chris@0
|
770 applyClicked();
|
Chris@0
|
771 accept();
|
Chris@0
|
772 }
|
Chris@0
|
773
|
Chris@0
|
774 void
|
Chris@0
|
775 PreferencesDialog::applyClicked()
|
Chris@0
|
776 {
|
Chris@0
|
777 Preferences *prefs = Preferences::getInstance();
|
Chris@0
|
778 prefs->setWindowType(WindowType(m_windowType));
|
Chris@115
|
779 prefs->setSpectrogramSmoothing(Preferences::SpectrogramSmoothing
|
Chris@115
|
780 (m_spectrogramSmoothing));
|
Chris@299
|
781 prefs->setSpectrogramXSmoothing(Preferences::SpectrogramXSmoothing
|
Chris@299
|
782 (m_spectrogramXSmoothing));
|
Chris@0
|
783 prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout
|
Chris@0
|
784 (m_propertyLayout));
|
Chris@0
|
785 prefs->setTuningFrequency(m_tuningFrequency);
|
Chris@32
|
786 prefs->setResampleQuality(m_resampleQuality);
|
Chris@180
|
787 prefs->setResampleOnLoad(m_resampleOnLoad);
|
Chris@1379
|
788 prefs->setUseGaplessMode(m_gapless);
|
Chris@1276
|
789 prefs->setRunPluginsInProcess(m_runPluginsInProcess);
|
Chris@237
|
790 prefs->setShowSplash(m_showSplash);
|
Chris@180
|
791 prefs->setTemporaryDirectoryRoot(m_tempDirRoot);
|
Chris@180
|
792 prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode));
|
Chris@337
|
793 prefs->setTimeToTextMode(Preferences::TimeToTextMode(m_timeToTextMode));
|
Chris@906
|
794 prefs->setShowHMS(m_showHMS);
|
Chris@225
|
795 prefs->setViewFontSize(m_viewFontSize);
|
Chris@263
|
796
|
Chris@702
|
797 prefs->setProperty("Octave Numbering System", m_octaveSystem);
|
Chris@702
|
798
|
Chris@1035
|
799 //!!! std::vector<QString> devices =
|
Chris@1035
|
800 //!!! AudioTargetFactory::getInstance()->getCallbackTargetNames();
|
Chris@263
|
801
|
Chris@263
|
802 QSettings settings;
|
Chris@263
|
803 settings.beginGroup("Preferences");
|
Chris@686
|
804 QString permishTag = QString("network-permission-%1").arg(SV_VERSION);
|
Chris@686
|
805 settings.setValue(permishTag, m_networkPermission);
|
Chris@1035
|
806 //!!! settings.setValue("audio-target", devices[m_audioDevice]);
|
Chris@686
|
807 settings.setValue("locale", m_currentLocale);
|
Chris@950
|
808 #ifdef Q_OS_MAC
|
Chris@950
|
809 settings.setValue("scaledHiDpi", m_retina);
|
Chris@950
|
810 #endif
|
Chris@1096
|
811 settings.setValue("spectrogram-colour", m_spectrogramGColour);
|
Chris@1096
|
812 settings.setValue("spectrogram-melodic-colour", m_spectrogramMColour);
|
Chris@1097
|
813 settings.setValue("colour-3d-plot-colour", m_colour3DColour);
|
Chris@263
|
814 settings.endGroup();
|
Chris@180
|
815
|
Chris@436
|
816 settings.beginGroup("MainWindow");
|
Chris@436
|
817 settings.setValue("sessiontemplate", m_currentTemplate);
|
Chris@436
|
818 settings.endGroup();
|
Chris@436
|
819
|
Chris@0
|
820 m_applyButton->setEnabled(false);
|
Chris@180
|
821
|
Chris@180
|
822 if (m_changesOnRestart) {
|
Chris@180
|
823 QMessageBox::information(this, tr("Preferences"),
|
Chris@255
|
824 tr("<b>Restart required</b><p>One or more of the application preferences you have changed may not take full effect until Sonic Visualiser is restarted.</p><p>Please exit and restart the application now if you want these changes to take effect immediately.</p>"));
|
Chris@180
|
825 m_changesOnRestart = false;
|
Chris@180
|
826 }
|
Chris@0
|
827 }
|
Chris@0
|
828
|
Chris@0
|
829 void
|
Chris@0
|
830 PreferencesDialog::cancelClicked()
|
Chris@0
|
831 {
|
Chris@0
|
832 reject();
|
Chris@0
|
833 }
|
Chris@0
|
834
|
Chris@163
|
835 void
|
Chris@163
|
836 PreferencesDialog::applicationClosing(bool quickly)
|
Chris@163
|
837 {
|
Chris@163
|
838 if (quickly) {
|
Chris@163
|
839 reject();
|
Chris@163
|
840 return;
|
Chris@163
|
841 }
|
Chris@163
|
842
|
Chris@163
|
843 if (m_applyButton->isEnabled()) {
|
Chris@163
|
844 int rv = QMessageBox::warning
|
Chris@163
|
845 (this, tr("Preferences Changed"),
|
Chris@163
|
846 tr("Some preferences have been changed but not applied.\n"
|
Chris@163
|
847 "Apply them before closing?"),
|
Chris@163
|
848 QMessageBox::Apply | QMessageBox::Discard,
|
Chris@163
|
849 QMessageBox::Discard);
|
Chris@163
|
850 if (rv == QMessageBox::Apply) {
|
Chris@163
|
851 applyClicked();
|
Chris@163
|
852 accept();
|
Chris@163
|
853 } else {
|
Chris@163
|
854 reject();
|
Chris@163
|
855 }
|
Chris@163
|
856 } else {
|
Chris@163
|
857 accept();
|
Chris@163
|
858 }
|
Chris@163
|
859 }
|
Chris@163
|
860
|