<rect>
<x>0</x>
<y>0</y>
- <width>661</width>
+ <width>711</width>
<height>437</height>
</rect>
</property>
</widget>
</item>
<item row="1" column="1">
- <widget class="QComboBox" name="PaOutdevCombo"/>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QComboBox" name="PaOutdevCombo"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="PaOutdevTestBtn">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>86</width>
+ <height>27</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Test</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
</widget>
</item>
<item row="2" column="1">
- <widget class="QComboBox" name="PaRingdevCombo"/>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QComboBox" name="PaRingdevCombo"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="PaRingdevTestBtn">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>86</width>
+ <height>27</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Test</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
<property name="title">
<string>Files</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
+ <layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
</widget>
</item>
<item row="0" column="1">
- <widget class="QLineEdit" name="PaRingFileEdit">
- <property name="text">
- <string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLineEdit" name="PaRingFileEdit">
+ <property name="text">
+ <string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="PaRingFileBtn">
+ <property name="text">
+ <string>Open</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
</widget>
</item>
<item row="1" column="1">
- <widget class="QSpinBox" name="PaRingIntervalSpin"/>
+ <widget class="QSpinBox" name="PaRingIntervalSpin">
+ <property name="value">
+ <number>5</number>
+ </property>
+ </widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
</widget>
</item>
<item row="2" column="1">
- <widget class="QLineEdit" name="PaHoldFileEdit"/>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="PaHoldFileEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="PaHoldFileBtn">
+ <property name="text">
+ <string>Open</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
_ui(ui)
{
_settings = new QSettings();
+ connect(_ui->PaRingFileBtn, SIGNAL(clicked()), this, SLOT(ringFileChoose()));
+ connect(_ui->PaHoldFileBtn, SIGNAL(clicked()), this, SLOT(holdFileChoose()));
+ connect(_ui->PaOutdevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(outdevChangeDev(int)));
+ connect(_ui->PaRingdevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(ringdevChangeDev(int)));
+}
+
+void PrefPortaudio::ringdevChangeDev(int dev)
+{
+ QString result;
+ if (g_FSHost.sendCmd("pa", QString("ringdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev to #%d on mod_portaudio!\n", dev);
+ QMessageBox::critical(0, tr("Unable to change device."),
+ tr("There was an error changing the ringdev.\nPlease report this bug."),
+ QMessageBox::Ok);
+
+ }
+}
+
+void PrefPortaudio::outdevChangeDev(int dev)
+{
+ QString result;
+ if (g_FSHost.sendCmd("pa", QString("outdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting outdev to #%d on mod_portaudio!\n", dev);
+ QMessageBox::critical(0, tr("Unable to change device."),
+ tr("There was an error changing the outdev.\nPlease report this bug."),
+ QMessageBox::Ok);
+ }
+}
+
+void PrefPortaudio::holdFileChoose()
+{
+ QString fileName = QFileDialog::getOpenFileName(0,
+ tr("Select file"),
+ QDir::homePath(),
+ NULL);
+ if (!fileName.isNull())
+ _ui->PaHoldFileEdit->setText(fileName);
+}
+
+void PrefPortaudio::ringFileChoose()
+{
+ QString fileName = QFileDialog::getOpenFileName(0,
+ tr("Select file"),
+ QDir::homePath(),
+ NULL);
+ if (!fileName.isNull())
+ _ui->PaRingFileEdit->setText(fileName);
}
void PrefPortaudio::writeConfig()
if (noutdev!= outdev)
{
- if (g_FSHost.sendCmd("pa", QString("outdev #%1").arg(noutdev).toAscii().constData(), &result) == SWITCH_STATUS_SUCCESS)
- {
- _settings->setValue("outdev", noutdev);
- }
- else
- {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting outdev from #%d to #%d on mod_portaudio!\n",
- outdev, noutdev);
- QMessageBox::critical(0, tr("Unable to save settings"),
- tr("There was an error changing the outdev.\nPlease report this bug."),
- QMessageBox::Ok);
- }
+ _settings->setValue("outdev", noutdev);
}
if (nringdev != ringdev)
{
- if (g_FSHost.sendCmd("pa", QString("ringdev #%1").arg(nringdev).toAscii().constData(), &result) == SWITCH_STATUS_SUCCESS)
- {
- _settings->setValue("ringdev", nringdev);
- }
- else
- {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev from #%d to #%d on mod_portaudio!\n",
- nringdev, nringdev);
- QMessageBox::critical(0, tr("Unable to save settings"),
- tr("There was an error changing the ringdev.\nPlease report this bug."),
- QMessageBox::Ok);
- }
+ _settings->setValue("ringdev", nringdev);
}
_settings->endGroup();