Add OSS and Solaris config pages

This commit is contained in:
Chris Robinson 2016-03-02 12:08:22 -08:00
parent 9fdca9e29f
commit 71d927333f
3 changed files with 193 additions and 0 deletions

View File

@ -317,6 +317,14 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->alsaResamplerCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->alsaMmapCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->ossDefaultDeviceLine, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(ui->ossPlaybackPushButton, SIGNAL(pressed()), this, SLOT(selectOSSPlayback()));
connect(ui->ossDefaultCaptureLine, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(ui->ossCapturePushButton, SIGNAL(pressed()), this, SLOT(selectOSSCapture()));
connect(ui->solarisDefaultDeviceLine, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(ui->solarisPlaybackPushButton, SIGNAL(pressed()), this, SLOT(selectSolarisPlayback()));
ui->backendListWidget->setCurrentRow(0);
ui->tabWidget->setCurrentIndex(0);
@ -694,6 +702,11 @@ void MainWindow::loadConfig(const QString &fname)
ui->alsaResamplerCheckBox->setChecked(settings.value("alsa/allow-resampler", false).toBool());
ui->alsaMmapCheckBox->setChecked(settings.value("alsa/mmap", true).toBool());
ui->ossDefaultDeviceLine->setText(settings.value("oss/device", QString()).toString());
ui->ossDefaultCaptureLine->setText(settings.value("oss/capture", QString()).toString());
ui->solarisDefaultDeviceLine->setText(settings.value("solaris/device", QString()).toString());
ui->applyButton->setEnabled(false);
ui->closeCancelButton->setText(tr("Close"));
mNeedsSave = false;
@ -906,6 +919,11 @@ void MainWindow::saveConfig(const QString &fname) const
ui->alsaMmapCheckBox->isChecked() ? QString(/*"true"*/) : QString("false")
);
settings.setValue("oss/device", ui->ossDefaultDeviceLine->text());
settings.setValue("oss/capture", ui->ossDefaultCaptureLine->text());
settings.setValue("solaris/device", ui->solarisDefaultDeviceLine->text());
/* Remove empty keys
* FIXME: Should only remove keys whose value matches the globally-specified value.
*/
@ -1079,3 +1097,33 @@ void MainWindow::showDisabledBackendMenu(QPoint pt)
enableApplyButton();
}
}
void MainWindow::selectOSSPlayback()
{
QString fname = QFileDialog::getOpenFileName(this, tr("Select Playback Device"));
if(!fname.isEmpty())
{
ui->ossDefaultDeviceLine->setText(fname);
enableApplyButton();
}
}
void MainWindow::selectOSSCapture()
{
QString fname = QFileDialog::getOpenFileName(this, tr("Select Capture Device"));
if(!fname.isEmpty())
{
ui->ossDefaultCaptureLine->setText(fname);
enableApplyButton();
}
}
void MainWindow::selectSolarisPlayback()
{
QString fname = QFileDialog::getOpenFileName(this, tr("Select Playback Device"));
if(!fname.isEmpty())
{
ui->solarisDefaultDeviceLine->setText(fname);
enableApplyButton();
}
}

View File

@ -41,6 +41,11 @@ private slots:
void showEnabledBackendMenu(QPoint pt);
void showDisabledBackendMenu(QPoint pt);
void selectOSSPlayback();
void selectOSSCapture();
void selectSolarisPlayback();
private:
Ui::MainWindow *ui;

View File

@ -787,6 +787,16 @@ application or system to determine if it should be used.</string>
<string>ALSA</string>
</property>
</item>
<item>
<property name="text">
<string>OSS</string>
</property>
</item>
<item>
<property name="text">
<string>Solaris</string>
</property>
</item>
</widget>
<widget class="QStackedWidget" name="backendStackedWidget">
<property name="geometry">
@ -1035,6 +1045,136 @@ during updates.</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_4">
<widget class="QLabel" name="label_20">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Default Playback Device:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="ossDefaultDeviceLine">
<property name="geometry">
<rect>
<x>160</x>
<y>30</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="placeholderText">
<string>/dev/dsp</string>
</property>
</widget>
<widget class="QLabel" name="label_21">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Default Capture Device:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="ossDefaultCaptureLine">
<property name="geometry">
<rect>
<x>160</x>
<y>60</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="placeholderText">
<string>/dev/dsp</string>
</property>
</widget>
<widget class="QPushButton" name="ossPlaybackPushButton">
<property name="geometry">
<rect>
<x>320</x>
<y>30</y>
<width>91</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Browse...</string>
</property>
</widget>
<widget class="QPushButton" name="ossCapturePushButton">
<property name="geometry">
<rect>
<x>320</x>
<y>60</y>
<width>91</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Browse...</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_5">
<widget class="QLineEdit" name="solarisDefaultDeviceLine">
<property name="geometry">
<rect>
<x>160</x>
<y>30</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="placeholderText">
<string>/dev/audio</string>
</property>
</widget>
<widget class="QLabel" name="label_22">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Default Playback Device:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QPushButton" name="solarisPlaybackPushButton">
<property name="geometry">
<rect>
<x>320</x>
<y>30</y>
<width>91</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Browse...</string>
</property>
</widget>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab_2">