]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
A couple of more changes to the portaudio configuration.
authorJoão Mesquita <jmesquita@freeswitch.org>
Wed, 6 Jan 2010 03:45:00 +0000 (03:45 +0000)
committerJoão Mesquita <jmesquita@freeswitch.org>
Wed, 6 Jan 2010 03:45:00 +0000 (03:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16168 d0543943-73ff-0310-b7d9-9358b9ac24b2

fscomm/prefdialog.ui
fscomm/prefportaudio.cpp
fscomm/prefportaudio.h

index 9ffe34bdede89aa3d679975ac987da0d22cc7835..1f228692c0d98456fc7f6c448e2b62e7428f0e32 100644 (file)
@@ -6,7 +6,7 @@
    <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>
index 36de76f06cfa8c8c81fec48e781670d38199a3ab..ecd1c603b9201a22dd08a1e255216619c1751db0 100644 (file)
@@ -7,6 +7,55 @@ PrefPortaudio::PrefPortaudio(Ui::PrefDialog *ui, QObject *parent) :
         _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()
@@ -79,33 +128,11 @@ 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();
index 84b8a29079ff86bd2532a011bb2802f990d9efa6..d427121629260e304a67e864a1c1c5e3e3f78626 100644 (file)
@@ -15,6 +15,12 @@ public:
     void writeConfig();
     void readConfig();
 
+private slots:
+    void ringFileChoose();
+    void holdFileChoose();
+    void outdevChangeDev(int);
+    void ringdevChangeDev(int);
+
 private:
     void getPaDevlist(void);
     QSettings *_settings;