comparison main/PreferencesDialog.cpp @ 1150:5e6e1e074080 3.0-plus-imaf

Merge branches 3.0-integration and imaf_enc to 3.0-plus-imaf
author Chris Cannam
date Wed, 20 Apr 2016 12:06:28 +0100
parents bd3cb9d6db66 bfd68cc71a25
children
comparison
equal deleted inserted replaced
1149:3ba5bee2ace0 1150:5e6e1e074080
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.
58 QGridLayout *grid = new QGridLayout; 58 QGridLayout *grid = new QGridLayout;
59 setLayout(grid); 59 setLayout(grid);
60 60
61 m_tabs = new QTabWidget; 61 m_tabs = new QTabWidget;
62 grid->addWidget(m_tabs, 0, 0); 62 grid->addWidget(m_tabs, 0, 0);
63 63
64 m_tabs->setTabPosition(QTabWidget::North); 64 m_tabs->setTabPosition(QTabWidget::North);
65 65
66 // Create this first, as slots that get called from the ctor will 66 // Create this first, as slots that get called from the ctor will
67 // refer to it 67 // refer to it
68 m_applyButton = new QPushButton(tr("Apply")); 68 m_applyButton = new QPushButton(tr("Apply"));
79 79
80 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)), 80 connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)),
81 this, SLOT(windowTypeChanged(WindowType))); 81 this, SLOT(windowTypeChanged(WindowType)));
82 82
83 QComboBox *smoothing = new QComboBox; 83 QComboBox *smoothing = new QComboBox;
84 84
85 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max, 85 int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max,
86 &deflt); 86 &deflt);
87 m_spectrogramSmoothing = sm; 87 m_spectrogramSmoothing = sm;
88 88
89 for (i = min; i <= max; ++i) { 89 for (i = min; i <= max; ++i) {
94 94
95 connect(smoothing, SIGNAL(currentIndexChanged(int)), 95 connect(smoothing, SIGNAL(currentIndexChanged(int)),
96 this, SLOT(spectrogramSmoothingChanged(int))); 96 this, SLOT(spectrogramSmoothingChanged(int)));
97 97
98 QComboBox *xsmoothing = new QComboBox; 98 QComboBox *xsmoothing = new QComboBox;
99 99
100 int xsm = prefs->getPropertyRangeAndValue("Spectrogram X Smoothing", &min, &max, 100 int xsm = prefs->getPropertyRangeAndValue("Spectrogram X Smoothing", &min, &max,
101 &deflt); 101 &deflt);
102 m_spectrogramXSmoothing = xsm; 102 m_spectrogramXSmoothing = xsm;
103 103
104 for (i = min; i <= max; ++i) { 104 for (i = min; i <= max; ++i) {
179 179
180 /*!!! restore 180 /*!!! restore
181 QComboBox *audioDevice = new QComboBox; 181 QComboBox *audioDevice = new QComboBox;
182 std::vector<QString> devices = 182 std::vector<QString> devices =
183 AudioTargetFactory::getInstance()->getCallbackTargetNames(); 183 AudioTargetFactory::getInstance()->getCallbackTargetNames();
184 184
185 QSettings settings;
185 settings.beginGroup("Preferences"); 186 settings.beginGroup("Preferences");
186 QString targetName = settings.value("audio-target", "").toString(); 187 QString targetName = settings.value("audio-target", "").toString();
187 settings.endGroup(); 188 settings.endGroup();
188 189
189 for (int i = 0; i < (int)devices.size(); ++i) { 190 for (int i = 0; i < (int)devices.size(); ++i) {
337 this, SLOT(showHMSChanged(int))); 338 this, SLOT(showHMSChanged(int)));
338 339
339 // General tab 340 // General tab
340 341
341 QFrame *frame = new QFrame; 342 QFrame *frame = new QFrame;
342 343
343 QGridLayout *subgrid = new QGridLayout; 344 QGridLayout *subgrid = new QGridLayout;
344 frame->setLayout(subgrid); 345 frame->setLayout(subgrid);
345 346
346 int row = 0; 347 int row = 0;
347 348
372 ("Resample Quality"))), 373 ("Resample Quality"))),
373 row, 0); 374 row, 0);
374 subgrid->addWidget(resampleQuality, row++, 1, 1, 2); 375 subgrid->addWidget(resampleQuality, row++, 1, 1, 2);
375 376
376 subgrid->setRowStretch(row, 10); 377 subgrid->setRowStretch(row, 10);
377 378
378 m_tabOrdering[GeneralTab] = m_tabs->count(); 379 m_tabOrdering[GeneralTab] = m_tabs->count();
379 m_tabs->addTab(frame, tr("&General")); 380 m_tabs->addTab(frame, tr("&General"));
380 381
381 // Appearance tab 382 // Appearance tab
382 383
435 ("Show Hours And Minutes"))), 436 ("Show Hours And Minutes"))),
436 row, 0); 437 row, 0);
437 subgrid->addWidget(hms, row++, 1, 1, 1); 438 subgrid->addWidget(hms, row++, 1, 1, 1);
438 439
439 subgrid->setRowStretch(row, 10); 440 subgrid->setRowStretch(row, 10);
440 441
441 m_tabOrdering[AppearanceTab] = m_tabs->count(); 442 m_tabOrdering[AppearanceTab] = m_tabs->count();
442 m_tabs->addTab(frame, tr("&Appearance")); 443 m_tabs->addTab(frame, tr("&Appearance"));
443 444
444 // Analysis tab 445 // Analysis tab
445 446
472 ("Window Type"))), 473 ("Window Type"))),
473 row, 0); 474 row, 0);
474 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2); 475 subgrid->addWidget(m_windowTypeSelector, row++, 1, 2, 2);
475 subgrid->setRowStretch(row, 10); 476 subgrid->setRowStretch(row, 10);
476 row++; 477 row++;
477 478
478 subgrid->setRowStretch(row, 10); 479 subgrid->setRowStretch(row, 10);
479 480
480 m_tabOrdering[AnalysisTab] = m_tabs->count(); 481 m_tabOrdering[AnalysisTab] = m_tabs->count();
481 m_tabs->addTab(frame, tr("Anal&ysis")); 482 m_tabs->addTab(frame, tr("Anal&ysis"));
482 483
483 // Template tab 484 // Template tab
484 485
485 frame = new QFrame; 486 frame = new QFrame;
486 subgrid = new QGridLayout; 487 subgrid = new QGridLayout;
487 frame->setLayout(subgrid); 488 frame->setLayout(subgrid);
488 row = 0; 489 row = 0;
489 490
490 subgrid->addWidget(new QLabel(tr("Default session template for audio files:")), row++, 0); 491 subgrid->addWidget(new QLabel(tr("Default session template for audio files:")), row++, 0);
491 492
492 QListWidget *lw = new QListWidget(); 493 QListWidget *lw = new QListWidget();
493 subgrid->addWidget(lw, row, 0); 494 subgrid->addWidget(lw, row, 0);
494 subgrid->setRowStretch(row, 10); 495 subgrid->setRowStretch(row, 10);
525 m_tabOrdering[TemplateTab] = m_tabs->count(); 526 m_tabOrdering[TemplateTab] = m_tabs->count();
526 m_tabs->addTab(frame, tr("Session &Template")); 527 m_tabs->addTab(frame, tr("Session &Template"));
527 528
528 QDialogButtonBox *bb = new QDialogButtonBox(Qt::Horizontal); 529 QDialogButtonBox *bb = new QDialogButtonBox(Qt::Horizontal);
529 grid->addWidget(bb, 1, 0); 530 grid->addWidget(bb, 1, 0);
530 531
531 QPushButton *ok = new QPushButton(tr("OK")); 532 QPushButton *ok = new QPushButton(tr("OK"));
532 QPushButton *cancel = new QPushButton(tr("Cancel")); 533 QPushButton *cancel = new QPushButton(tr("Cancel"));
533 bb->addButton(ok, QDialogButtonBox::AcceptRole); 534 bb->addButton(ok, QDialogButtonBox::AcceptRole);
534 bb->addButton(m_applyButton, QDialogButtonBox::ApplyRole); 535 bb->addButton(m_applyButton, QDialogButtonBox::ApplyRole);
535 bb->addButton(cancel, QDialogButtonBox::RejectRole); 536 bb->addButton(cancel, QDialogButtonBox::RejectRole);
782 if (m_changesOnRestart) { 783 if (m_changesOnRestart) {
783 QMessageBox::information(this, tr("Preferences"), 784 QMessageBox::information(this, tr("Preferences"),
784 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>")); 785 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>"));
785 m_changesOnRestart = false; 786 m_changesOnRestart = false;
786 } 787 }
787 } 788 }
788 789
789 void 790 void
790 PreferencesDialog::cancelClicked() 791 PreferencesDialog::cancelClicked()
791 { 792 {
792 reject(); 793 reject();