comparison main/PreferencesDialog.cpp @ 634:ba338234c001 imaf_enc

IMAF load code from Jesus Corral Garcia
author Chris Cannam
date Mon, 04 Nov 2013 17:15:52 +0000
parents e5e6625deb85
children bfd68cc71a25
comparison
equal deleted inserted replaced
633:a8da6db5a2c9 634:ba338234c001
3 /* 3 /*
4 Sonic Visualiser 4 Sonic Visualiser
5 An audio file viewer and annotation editor. 5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London. 6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam. 7 This file copyright 2006 Chris Cannam.
8 8
9 This program is free software; you can redistribute it and/or 9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as 10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
54 QGridLayout *grid = new QGridLayout; 54 QGridLayout *grid = new QGridLayout;
55 setLayout(grid); 55 setLayout(grid);
56 56
57 m_tabs = new QTabWidget; 57 m_tabs = new QTabWidget;
58 grid->addWidget(m_tabs, 0, 0); 58 grid->addWidget(m_tabs, 0, 0);
59 59
60 m_tabs->setTabPosition(QTabWidget::North); 60 m_tabs->setTabPosition(QTabWidget::North);
61 61
62 // Create this first, as slots that get called from the ctor will 62 // Create this first, as slots that get called from the ctor will
63 // refer to it 63 // refer to it
64 m_applyButton = new QPushButton(tr("Apply")); 64 m_applyButton = new QPushButton(tr("Apply"));
75 75
76 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)), 76 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)),
77 this, SLOT(windowTypeChanged(WindowType))); 77 this, SLOT(windowTypeChanged(WindowType)));
78 78
79 QComboBox *smoothing = new QComboBox; 79 QComboBox *smoothing = new QComboBox;
80 80
81 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max, 81 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max,
82 &deflt); 82 &deflt);
83 m_spectrogramSmoothing = sm; 83 m_spectrogramSmoothing = sm;
84 84
85 for (i = min; i <= max; ++i) { 85 for (i = min; i <= max; ++i) {
90 90
91 connect(smoothing, SIGNAL(currentIndexChanged(int)), 91 connect(smoothing, SIGNAL(currentIndexChanged(int)),
92 this, SLOT(spectrogramSmoothingChanged(int))); 92 this, SLOT(spectrogramSmoothingChanged(int)));
93 93
94 QComboBox *xsmoothing = new QComboBox; 94 QComboBox *xsmoothing = new QComboBox;
95 95
96 int xsm = prefs->getPropertyRangeAndValue("Spectrogram X Smoothing", &min, &max, 96 int xsm = prefs->getPropertyRangeAndValue("Spectrogram X Smoothing", &min, &max,
97 &deflt); 97 &deflt);
98 m_spectrogramXSmoothing = xsm; 98 m_spectrogramXSmoothing = xsm;
99 99
100 for (i = min; i <= max; ++i) { 100 for (i = min; i <= max; ++i) {
134 this, SLOT(tuningFrequencyChanged(double))); 134 this, SLOT(tuningFrequencyChanged(double)));
135 135
136 QComboBox *audioDevice = new QComboBox; 136 QComboBox *audioDevice = new QComboBox;
137 std::vector<QString> devices = 137 std::vector<QString> devices =
138 AudioTargetFactory::getInstance()->getCallbackTargetNames(); 138 AudioTargetFactory::getInstance()->getCallbackTargetNames();
139 139
140 QSettings settings; 140 QSettings settings;
141 settings.beginGroup("Preferences"); 141 settings.beginGroup("Preferences");
142 QString targetName = settings.value("audio-target", "").toString(); 142 QString targetName = settings.value("audio-target", "").toString();
143 settings.endGroup(); 143 settings.endGroup();
144 144
231 this, SLOT(timeToTextModeChanged(int))); 231 this, SLOT(timeToTextModeChanged(int)));
232 232
233 // General tab 233 // General tab
234 234
235 QFrame *frame = new QFrame; 235 QFrame *frame = new QFrame;
236 236
237 QGridLayout *subgrid = new QGridLayout; 237 QGridLayout *subgrid = new QGridLayout;
238 frame->setLayout(subgrid); 238 frame->setLayout(subgrid);
239 239
240 int row = 0; 240 int row = 0;
241 241
258 ("Resample Quality"))), 258 ("Resample Quality"))),
259 row, 0); 259 row, 0);
260 subgrid->addWidget(resampleQuality, row++, 1, 1, 2); 260 subgrid->addWidget(resampleQuality, row++, 1, 1, 2);
261 261
262 subgrid->setRowStretch(row, 10); 262 subgrid->setRowStretch(row, 10);
263 263
264 m_tabOrdering[GeneralTab] = m_tabs->count(); 264 m_tabOrdering[GeneralTab] = m_tabs->count();
265 m_tabs->addTab(frame, tr("&General")); 265 m_tabs->addTab(frame, tr("&General"));
266 266
267 // Appearance tab 267 // Appearance tab
268 268
297 ("Show Splash Screen"))), 297 ("Show Splash Screen"))),
298 row, 0); 298 row, 0);
299 subgrid->addWidget(showSplash, row++, 1, 1, 1); 299 subgrid->addWidget(showSplash, row++, 1, 1, 1);
300 300
301 subgrid->setRowStretch(row, 10); 301 subgrid->setRowStretch(row, 10);
302 302
303 m_tabOrdering[AppearanceTab] = m_tabs->count(); 303 m_tabOrdering[AppearanceTab] = m_tabs->count();
304 m_tabs->addTab(frame, tr("&Appearance")); 304 m_tabs->addTab(frame, tr("&Appearance"));
305 305
306 // Analysis tab 306 // Analysis tab
307 307
329 ("Window Type"))), 329 ("Window Type"))),
330 row, 0); 330 row, 0);
331 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2); 331 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2);
332 subgrid->setRowStretch(row, 10); 332 subgrid->setRowStretch(row, 10);
333 row++; 333 row++;
334 334
335 subgrid->setRowStretch(row, 10); 335 subgrid->setRowStretch(row, 10);
336 336
337 m_tabOrdering[AnalysisTab] = m_tabs->count(); 337 m_tabOrdering[AnalysisTab] = m_tabs->count();
338 m_tabs->addTab(frame, tr("Anal&ysis")); 338 m_tabs->addTab(frame, tr("Anal&ysis"));
339 339
340 // Template tab 340 // Template tab
341 341
342 frame = new QFrame; 342 frame = new QFrame;
343 subgrid = new QGridLayout; 343 subgrid = new QGridLayout;
344 frame->setLayout(subgrid); 344 frame->setLayout(subgrid);
345 row = 0; 345 row = 0;
346 346
347 subgrid->addWidget(new QLabel(tr("Default session template for audio files:")), row++, 0); 347 subgrid->addWidget(new QLabel(tr("Default session template for audio files:")), row++, 0);
348 348
349 QListWidget *lw = new QListWidget(); 349 QListWidget *lw = new QListWidget();
350 subgrid->addWidget(lw, row, 0); 350 subgrid->addWidget(lw, row, 0);
351 subgrid->setRowStretch(row, 10); 351 subgrid->setRowStretch(row, 10);
382 m_tabOrdering[TemplateTab] = m_tabs->count(); 382 m_tabOrdering[TemplateTab] = m_tabs->count();
383 m_tabs->addTab(frame, tr("Session &Template")); 383 m_tabs->addTab(frame, tr("Session &Template"));
384 384
385 QDialogButtonBox *bb = new QDialogButtonBox(Qt::Horizontal); 385 QDialogButtonBox *bb = new QDialogButtonBox(Qt::Horizontal);
386 grid->addWidget(bb, 1, 0); 386 grid->addWidget(bb, 1, 0);
387 387
388 QPushButton *ok = new QPushButton(tr("OK")); 388 QPushButton *ok = new QPushButton(tr("OK"));
389 QPushButton *cancel = new QPushButton(tr("Cancel")); 389 QPushButton *cancel = new QPushButton(tr("Cancel"));
390 bb->addButton(ok, QDialogButtonBox::AcceptRole); 390 bb->addButton(ok, QDialogButtonBox::AcceptRole);
391 bb->addButton(m_applyButton, QDialogButtonBox::ApplyRole); 391 bb->addButton(m_applyButton, QDialogButtonBox::ApplyRole);
392 bb->addButton(cancel, QDialogButtonBox::RejectRole); 392 bb->addButton(cancel, QDialogButtonBox::RejectRole);
548 prefs->setShowSplash(m_showSplash); 548 prefs->setShowSplash(m_showSplash);
549 prefs->setTemporaryDirectoryRoot(m_tempDirRoot); 549 prefs->setTemporaryDirectoryRoot(m_tempDirRoot);
550 prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode)); 550 prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode));
551 prefs->setTimeToTextMode(Preferences::TimeToTextMode(m_timeToTextMode)); 551 prefs->setTimeToTextMode(Preferences::TimeToTextMode(m_timeToTextMode));
552 prefs->setViewFontSize(m_viewFontSize); 552 prefs->setViewFontSize(m_viewFontSize);
553 553
554 std::vector<QString> devices = 554 std::vector<QString> devices =
555 AudioTargetFactory::getInstance()->getCallbackTargetNames(); 555 AudioTargetFactory::getInstance()->getCallbackTargetNames();
556 556
557 QSettings settings; 557 QSettings settings;
558 558
569 if (m_changesOnRestart) { 569 if (m_changesOnRestart) {
570 QMessageBox::information(this, tr("Preferences"), 570 QMessageBox::information(this, tr("Preferences"),
571 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>")); 571 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>"));
572 m_changesOnRestart = false; 572 m_changesOnRestart = false;
573 } 573 }
574 } 574 }
575 575
576 void 576 void
577 PreferencesDialog::cancelClicked() 577 PreferencesDialog::cancelClicked()
578 { 578 {
579 reject(); 579 reject();