diff options
author | Chris Robinson <[email protected]> | 2016-02-28 21:55:58 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-02-28 21:55:58 -0800 |
commit | c89511b95e6e6920c3be3086c98463284090de65 (patch) | |
tree | d0648c0926adca5856a4ed3a6ac1260a0f3872b1 /utils/alsoft-config | |
parent | abf6a9260a18bc5d4e69e9c7b8bce35509ade816 (diff) |
Properly remove empty config values
Diffstat (limited to 'utils/alsoft-config')
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index f072773a..1fd6f81e 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -887,6 +887,25 @@ void MainWindow::saveConfig(const QString &fname) const strlist.append("dedicated"); settings.setValue("excludefx", strlist.join(QChar(','))); + settings.setValue("pulse/spawn-server", + ui->pulseAutospawnCheckBox->isChecked() ? QString(/*"true"*/) : QString("false") + ); + settings.setValue("pulse/allow-moves", + ui->pulseAllowMovesCheckBox->isChecked() ? QString("true") : QString(/*"false"*/) + ); + settings.setValue("pulse/fix-rate", + ui->pulseFixRateCheckBox->isChecked() ? QString("true") : QString(/*"false"*/) + ); + + settings.setValue("alsa/device", ui->alsaDefaultDeviceLine->text()); + settings.setValue("alsa/capture", ui->alsaDefaultCaptureLine->text()); + settings.setValue("alsa/allow-resampler", + ui->alsaResamplerCheckBox->isChecked() ? QString("true") : QString(/*"false"*/) + ); + settings.setValue("alsa/mmap", + ui->alsaMmapCheckBox->isChecked() ? QString(/*"true"*/) : QString("false") + ); + /* Remove empty keys * FIXME: Should only remove keys whose value matches the globally-specified value. */ @@ -897,36 +916,6 @@ void MainWindow::saveConfig(const QString &fname) const if(str == QString()) settings.remove(key); } - - if(ui->pulseAutospawnCheckBox->isChecked()) - settings.remove("pulse/spawn-server"/*, "true"*/); - else - settings.setValue("pulse/spawn-server", "false"); - if(ui->pulseAllowMovesCheckBox->isChecked()) - settings.setValue("pulse/allow-moves", "true"); - else - settings.remove("pulse/allow-moves"/*, "false"*/); - if(ui->pulseFixRateCheckBox->isChecked()) - settings.setValue("pulse/fix-rate", "true"); - else - settings.remove("pulse/fix-rate"/*, "false"*/); - - str = ui->alsaDefaultDeviceLine->text(); - if(str.isEmpty()) settings.remove("alsa/device"); - else settings.setValue("alsa/device", str); - - str = ui->alsaDefaultCaptureLine->text(); - if(str.isEmpty()) settings.remove("alsa/capture"); - else settings.setValue("alsa/capture", str); - - if(ui->alsaResamplerCheckBox->isChecked()) - settings.setValue("alsa/allow-resampler", "true"); - else - settings.remove("alsa/allow-resampler"); - if(ui->alsaMmapCheckBox->isChecked()) - settings.remove("alsa/mmap"); - else - settings.setValue("alsa/mmap", "false"); } |