aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-09-13 23:12:40 -0700
committerChris Robinson <[email protected]>2014-09-13 23:12:40 -0700
commit57623741f6971320e4febdc81b27dce2d5700f86 (patch)
tree5193f7f4267a1659416aa75bfd3fa9a69c70f821
parent4e66224d6c14cffa2d6108bd0845f2dc35baec89 (diff)
Show prettier names in the alsoft-config sample format combo boxes
-rw-r--r--utils/alsoft-config/mainwindow.cpp85
-rw-r--r--utils/alsoft-config/mainwindow.ui91
2 files changed, 80 insertions, 96 deletions
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp
index 1d5a3dcd..099c74f9 100644
--- a/utils/alsoft-config/mainwindow.cpp
+++ b/utils/alsoft-config/mainwindow.cpp
@@ -33,6 +33,32 @@ static const struct {
{ "", "" }
};
+static const struct {
+ const char name[32];
+ const char value[16];
+} speakerModeList[] = {
+ { "Autodetect", "" },
+ { "Mono", "mono" },
+ { "Stereo", "stereo" },
+ { "Quadrophonic", "quad" },
+ { "5.1 Surround Sound", "surround51" },
+ { "6.1 Surround Sound", "surround61" },
+ { "7.1 Surround Sound", "surround71" },
+
+ { "", "" }
+}, sampleTypeList[] = {
+ { "Autodetect", "" },
+ { "8-bit int", "int8" },
+ { "8-bit uint", "uint8" },
+ { "16-bit int", "int16" },
+ { "16-bit uint", "uint16" },
+ { "32-bit int", "int32" },
+ { "32-bit uint", "uint32" },
+ { "32-bit float", "float32" },
+
+ { "", "" }
+};
+
static QString getDefaultConfigName()
{
#ifdef Q_OS_WIN32
@@ -109,6 +135,13 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
+ for(int i = 0;speakerModeList[i].name[0];i++)
+ ui->channelConfigCombo->addItem(speakerModeList[i].name);
+ ui->channelConfigCombo->adjustSize();
+ for(int i = 0;sampleTypeList[i].name[0];i++)
+ ui->sampleFormatCombo->addItem(sampleTypeList[i].name);
+ ui->sampleFormatCombo->adjustSize();
+
mPeriodSizeValidator = new QIntValidator(64, 8192, this);
ui->periodSizeEdit->setValidator(mPeriodSizeValidator);
mPeriodCountValidator = new QIntValidator(2, 16, this);
@@ -179,12 +212,19 @@ void MainWindow::loadConfig(const QString &fname)
ui->sampleFormatCombo->setCurrentIndex(0);
if(sampletype.isEmpty() == false)
{
- for(int i = 1;i < ui->sampleFormatCombo->count();i++)
+ for(int i = 0;sampleTypeList[i].name[i];i++)
{
- QString item = ui->sampleFormatCombo->itemText(i);
- if(item.startsWith(sampletype))
+ if(sampletype == sampleTypeList[i].value)
{
- ui->sampleFormatCombo->setCurrentIndex(i);
+ for(int j = 1;j < ui->sampleFormatCombo->count();j++)
+ {
+ QString item = ui->sampleFormatCombo->itemText(j);
+ if(item == sampleTypeList[i].name)
+ {
+ ui->sampleFormatCombo->setCurrentIndex(j);
+ break;
+ }
+ }
break;
}
}
@@ -194,12 +234,19 @@ void MainWindow::loadConfig(const QString &fname)
ui->channelConfigCombo->setCurrentIndex(0);
if(channelconfig.isEmpty() == false)
{
- for(int i = 1;i < ui->channelConfigCombo->count();i++)
+ for(int i = 0;speakerModeList[i].name[i];i++)
{
- QString item = ui->channelConfigCombo->itemText(i);
- if(item.startsWith(channelconfig))
+ if(channelconfig == speakerModeList[i].value)
{
- ui->channelConfigCombo->setCurrentIndex(i);
+ for(int j = 1;j < ui->channelConfigCombo->count();j++)
+ {
+ QString item = ui->channelConfigCombo->itemText(j);
+ if(item == speakerModeList[i].name)
+ {
+ ui->channelConfigCombo->setCurrentIndex(j);
+ break;
+ }
+ }
break;
}
}
@@ -371,15 +418,27 @@ void MainWindow::saveConfig(const QString &fname) const
}
QString str = ui->sampleFormatCombo->currentText();
- str.truncate(str.indexOf('-'));
- settings.setValue("sample-type", str.trimmed());
+ for(int i = 0;sampleTypeList[i].name[0];i++)
+ {
+ if(str == sampleTypeList[i].name)
+ {
+ settings.setValue("sample-type", sampleTypeList[i].value);
+ break;
+ }
+ }
str = ui->channelConfigCombo->currentText();
- str.truncate(str.indexOf('-'));
- settings.setValue("channels", str.trimmed());
+ for(int i = 0;speakerModeList[i].name[0];i++)
+ {
+ if(str == speakerModeList[i].name)
+ {
+ settings.setValue("channels", speakerModeList[i].value);
+ break;
+ }
+ }
uint rate = ui->sampleRateCombo->currentText().toUInt();
- if(rate == 0)
+ if(!(rate > 0))
settings.setValue("frequency", QString());
else
settings.setValue("frequency", rate);
diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui
index 3c92abf6..54bae81c 100644
--- a/utils/alsoft-config/mainwindow.ui
+++ b/utils/alsoft-config/mainwindow.ui
@@ -57,8 +57,8 @@
<property name="geometry">
<rect>
<x>120</x>
- <y>20</y>
- <width>188</width>
+ <y>50</y>
+ <width>78</width>
<height>22</height>
</rect>
</property>
@@ -69,52 +69,12 @@ float and converted to the output sample type as needed.</string>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
- <item>
- <property name="text">
- <string>- Autodetect -</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>int8 - signed 8-bit int</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>uint8 - unsigned 8-bit int</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>int16 - signed 16-bit int</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>uint16 - unsigned 16-bit int</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>int32 - signed 32-bit int</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>uint32 - unsigned 32-bit int</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>float32 - 32-bit float</string>
- </property>
- </item>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
- <y>20</y>
+ <y>50</y>
<width>101</width>
<height>21</height>
</rect>
@@ -130,7 +90,7 @@ float and converted to the output sample type as needed.</string>
<property name="geometry">
<rect>
<x>10</x>
- <y>50</y>
+ <y>20</y>
<width>101</width>
<height>21</height>
</rect>
@@ -146,8 +106,8 @@ float and converted to the output sample type as needed.</string>
<property name="geometry">
<rect>
<x>120</x>
- <y>50</y>
- <width>227</width>
+ <y>20</y>
+ <width>78</width>
<height>22</height>
</rect>
</property>
@@ -159,48 +119,13 @@ to stereo output.</string>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
- <item>
- <property name="text">
- <string>- Autodetect -</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>mono - 1-channel Mono</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>stereo - 2-channel Stereo</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>quad - 4-channel Quadraphonic</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>surround51 - 5.1 Surround Sound</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>surround61 - 6.1 Surround Sound</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>surround71 - 7.1 Surround Sound</string>
- </property>
- </item>
</widget>
<widget class="QComboBox" name="sampleRateCombo">
<property name="geometry">
<rect>
<x>120</x>
<y>80</y>
- <width>111</width>
+ <width>96</width>
<height>22</height>
</rect>
</property>
@@ -218,7 +143,7 @@ to stereo output.</string>
</property>
<item>
<property name="text">
- <string>- Autodetect -</string>
+ <string>Autodetect</string>
</property>
</item>
<item>