diff options
author | Chris Robinson <[email protected]> | 2014-09-26 20:45:46 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-09-26 20:45:46 -0700 |
commit | 4955824c2df321755bfc1b1d8142a969ffc61b08 (patch) | |
tree | cc8977c4aad5844fd757228c89da2e8c1ef8880d /utils/alsoft-config/mainwindow.cpp | |
parent | 57623741f6971320e4febdc81b27dce2d5700f86 (diff) |
Use better GUI item names for the resampler option
Diffstat (limited to 'utils/alsoft-config/mainwindow.cpp')
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 099c74f9..9eaf14ed 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -57,6 +57,13 @@ static const struct { { "32-bit float", "float32" }, { "", "" } +}, resamplerList[] = { + { "Default", "" }, + { "Point (low quality, fast)", "point" }, + { "Linear (basic quality, fast)", "linear" }, + { "Cubic Spline (good quality)", "cubic" }, + + { "", "" } }; static QString getDefaultConfigName() @@ -141,6 +148,9 @@ MainWindow::MainWindow(QWidget *parent) : for(int i = 0;sampleTypeList[i].name[0];i++) ui->sampleFormatCombo->addItem(sampleTypeList[i].name); ui->sampleFormatCombo->adjustSize(); + for(int i = 0;resamplerList[i].name[0];i++) + ui->resamplerComboBox->addItem(resamplerList[i].name); + ui->resamplerComboBox->adjustSize(); mPeriodSizeValidator = new QIntValidator(64, 8192, this); ui->periodSizeEdit->setValidator(mPeriodSizeValidator); @@ -269,18 +279,22 @@ void MainWindow::loadConfig(const QString &fname) ui->srcSendLineEdit->insert(settings.value("sends").toString()); QString resampler = settings.value("resampler").toString().trimmed(); - if(resampler.isEmpty()) - ui->resamplerComboBox->setCurrentIndex(0); - else + ui->resamplerComboBox->setCurrentIndex(0); + if(resampler.isEmpty() == false) { - for(int i = 1;i < ui->resamplerComboBox->count();i++) + for(int i = 0;resamplerList[i].name[i];i++) { - QString item = ui->resamplerComboBox->itemText(i); - int end = item.indexOf(' '); - if(end < 0) end = item.size(); - if(resampler.size() == end && resampler.compare(item.leftRef(end), Qt::CaseInsensitive) == 0) + if(resampler == resamplerList[i].value) { - ui->resamplerComboBox->setCurrentIndex(i); + for(int j = 1;j < ui->resamplerComboBox->count();j++) + { + QString item = ui->resamplerComboBox->itemText(j); + if(item == resamplerList[i].name) + { + ui->resamplerComboBox->setCurrentIndex(j); + break; + } + } break; } } @@ -449,12 +463,14 @@ void MainWindow::saveConfig(const QString &fname) const settings.setValue("sources", ui->srcCountLineEdit->text()); settings.setValue("slots", ui->effectSlotLineEdit->text()); - if(ui->resamplerComboBox->currentIndex() == 0) - settings.setValue("resampler", QString()); - else + str = ui->resamplerComboBox->currentText(); + for(int i = 0;resamplerList[i].name[0];i++) { - str = ui->resamplerComboBox->currentText(); - settings.setValue("resampler", str.split(' ').first().toLower()); + if(str == resamplerList[i].name) + { + settings.setValue("resampler", resamplerList[i].value); + break; + } } QStringList strlist; |