19 #include <QDialogButtonBox> 21 #include <QFileDialog> 22 #include <QNetworkInterface> 23 #include <QPushButton> 24 #include <QStandardPaths> 27 #include "ui_macsynthsettingsdialog.h" 38 MacSynthSettingsDialog::MacSynthSettingsDialog(QWidget *parent) :
40 ui(new Ui::MacSynthSettingsDialog)
43 connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::pressed,
44 this, &MacSynthSettingsDialog::restoreDefaults);
45 connect(ui->btn_soundfont, &QToolButton::pressed,
this, &MacSynthSettingsDialog::showFileDialog);
48 MacSynthSettingsDialog::~MacSynthSettingsDialog()
53 void MacSynthSettingsDialog::accept()
59 void MacSynthSettingsDialog::showEvent(QShowEvent *event)
65 void MacSynthSettingsDialog::readSettings()
68 SettingsFactory settings;
69 settings->beginGroup(
"DLS Synth");
70 bool reverb = settings->value(
"reverb_dls",
false).toBool();
71 bool def = settings->value(
"default_dls",
true).toBool();
72 QString soundfont = settings->value(
"soundfont_dls").toString();
75 ui->reverb_dls->setChecked(reverb);
76 ui->default_dls->setChecked(def);
77 ui->soundfont_dls->setText(soundfont);
80 void MacSynthSettingsDialog::writeSettings()
82 SettingsFactory settings;
84 QString soundfont = ui->soundfont_dls->text();
85 bool reverb = ui->reverb_dls->isChecked();
86 bool def = ui->default_dls->isChecked();
88 settings->beginGroup(
"DLS Synth");
89 settings->setValue(
"soundfont_dls", soundfont);
90 settings->setValue(
"reverb_dls", reverb);
91 settings->setValue(
"default_dls", def);
96 void MacSynthSettingsDialog::restoreDefaults()
98 ui->reverb_dls->setChecked(
false);
99 ui->default_dls->setChecked(
true);
100 ui->soundfont_dls->clear();
106 ui->soundfont_dls->setText(fileName);
110 void MacSynthSettingsDialog::showFileDialog()
112 QDir dir = (QDir::homePath() +
"/Library/Audio/Sounds/Banks/");
113 QString fileName = QFileDialog::getOpenFileName(
this, tr(
"Select SoundFont"), dir.absolutePath(), tr(
"SoundFont Files (*.sf2 *.dls)"));
114 if (!fileName.isEmpty()) {
115 ui->soundfont_dls->setText(fileName);
Declaration of the Mac Synth configuration dialog.
SettingsFactory class declaration.