1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-03-03 01:13:30 +00:00

Start persisting settings. Portaudio devices are persisted.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16164 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
João Mesquita 2010-01-05 22:16:46 +00:00
parent f6ed8b27c1
commit 4ba291d413
7 changed files with 303 additions and 289 deletions

@ -8,11 +8,11 @@
<!--<param name="ringdev" value="${ringdev}"/>--> <!--<param name="ringdev" value="${ringdev}"/>-->
<param name="ring-file" value="${ring-file}"/> <param name="ring-file" value="${ring-file}"/>
<param name="ring-interval" value="${ring-interval}"/> <param name="ring-interval" value="${ring-interval}"/>
<param name="hold-file" value="$${hold_music}"/> <param name="hold-file" value="${hold-file}"/>
<!--<param name="timer-name" value="soft"/>--> <!--<param name="timer-name" value="soft"/>-->
<param name="dialplan" value="XML"/> <param name="dialplan" value="XML"/>
<param name="cid-name" value="$${outbound_caller_name}"/> <param name="cid-name" value="${cid-name}"/>
<param name="cid-num" value="$${outbound_caller_number}"/> <param name="cid-num" value="${cid-num}"/>
<param name="sample-rate" value="48000"/> <param name="sample-rate" value="48000"/>
<param name="codec-ms" value="10"/> <param name="codec-ms" value="10"/>
</settings> </settings>

@ -66,12 +66,15 @@ switch_xml_t XMLBinding::getConfigXML(QString tmpl)
/* Open template file and expand all strings based on QSettings */ /* Open template file and expand all strings based on QSettings */
QByteArray tmplContents(tmplFile.readAll()); QByteArray tmplContents(tmplFile.readAll());
tmplFile.close(); tmplFile.close();
_settings->beginGroup("FreeSIWTCH/conf");
_settings->beginGroup("FreeSWITCH/conf");
_settings->beginGroup(tmpl); _settings->beginGroup(tmpl);
foreach(QString k, _settings->childKeys()) foreach(QString k, _settings->childKeys())
{ {
switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData()); switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData());
} }
_settings->endGroup();
_settings->endGroup();
char *res = switch_event_expand_headers(e, tmplContents.data()); char *res = switch_event_expand_headers(e, tmplContents.data());
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template %s as follows:\n%s", tmpl.toAscii().constData(), res); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template %s as follows:\n%s", tmpl.toAscii().constData(), res);

@ -7,6 +7,8 @@ PrefDialog::PrefDialog(QWidget *parent) :
ui(new Ui::PrefDialog) ui(new Ui::PrefDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
_settings = new QSettings();
connect(this, SIGNAL(accepted()), this, SLOT(configAccepted()));
getPaDevlist(); getPaDevlist();
} }
@ -15,6 +17,25 @@ PrefDialog::~PrefDialog()
delete ui; delete ui;
} }
void PrefDialog::configAccepted()
{
_settings->beginGroup("FreeSWITCH/conf");
_settings->beginGroup("portaudio.conf");
_settings->setValue("cid-name", ui->PaCallerIdNameEdit->text());
_settings->setValue("cid-num", ui->PaCallerIdNumEdit->text());
_settings->setValue("indev", ui->PaIndevCombo->currentIndex());
_settings->setValue("outdev", ui->PaOutdevCombo->currentIndex());
_settings->setValue("ringdev", ui->PaRingdevCombo->currentIndex());
_settings->setValue("ring-file", ui->PaRingFileEdit->text());
_settings->setValue("ring-interval", ui->PaRingIntervalSpin->value());
_settings->setValue("hold-file", ui->PaHoldFileEdit->text());
_settings->endGroup();
_settings->endGroup();
}
void PrefDialog::getPaDevlist() void PrefDialog::getPaDevlist()
{ {
QString result; QString result;

@ -3,6 +3,7 @@
#include <QDialog> #include <QDialog>
#include <QDomDocument> #include <QDomDocument>
#include <QSettings>
#include <fshost.h> #include <fshost.h>
namespace Ui { namespace Ui {
@ -18,10 +19,14 @@ public:
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
private slots:
void configAccepted();
private: private:
void getPaDevlist(void); void getPaDevlist(void);
Ui::PrefDialog *ui; Ui::PrefDialog *ui;
QDomDocument _xmlPaDevList; QDomDocument _xmlPaDevList;
QSettings *_settings;
}; };
#endif // PREFDIALOG_H #endif // PREFDIALOG_H

@ -6,17 +6,15 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>477</width> <width>661</width>
<height>356</height> <height>437</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Preferences</string> <string>Preferences</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QGridLayout" name="gridLayout_2">
<item> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="listSections"> <widget class="QListWidget" name="listSections">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -75,9 +73,18 @@
<normaloff>:/images/pref_audio.gif</normaloff>:/images/pref_audio.gif</iconset> <normaloff>:/images/pref_audio.gif</normaloff>:/images/pref_audio.gif</iconset>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>General</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/images/pref_general.jpg</normaloff>:/images/pref_general.jpg</iconset>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>1</number>
@ -98,7 +105,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinBox"/> <widget class="QSpinBox" name="logLevelSpin"/>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
@ -108,7 +115,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="comboBox"/> <widget class="QComboBox" name="autoRestartCombo"/>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
@ -118,7 +125,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QSpinBox" name="spinBox_2"/> <widget class="QSpinBox" name="debugPresenceSpin"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -137,7 +144,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="lineEdit"/> <widget class="QLineEdit" name="userAgentStringEdit"/>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
@ -147,7 +154,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBox_3"/> <widget class="QSpinBox" name="debugSpin"/>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
@ -157,7 +164,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QComboBox" name="comboBox_2"/> <widget class="QComboBox" name="sipTraceCombo"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -171,75 +178,38 @@
<property name="title"> <property name="title">
<string>Devices</string> <string>Devices</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>72</x>
<y>34</y>
<width>34</width>
<height>17</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>indev</string> <string>indev</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="PaIndevCombo"> </item>
<property name="geometry"> <item row="0" column="1">
<rect> <widget class="QComboBox" name="PaIndevCombo"/>
<x>111</x> </item>
<y>32</y> <item row="1" column="0">
<width>111</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>63</x>
<y>64</y>
<width>43</width>
<height>17</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>outdev</string> <string>outdev</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="PaOutdevCombo"> </item>
<property name="geometry"> <item row="1" column="1">
<rect> <widget class="QComboBox" name="PaOutdevCombo"/>
<x>111</x> </item>
<y>62</y> <item row="2" column="0">
<width>111</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>59</x>
<y>94</y>
<width>47</width>
<height>17</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>rindgev</string> <string>rindgev</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="PaRingdevCombo"> </item>
<property name="geometry"> <item row="2" column="1">
<rect> <widget class="QComboBox" name="PaRingdevCombo"/>
<x>111</x> </item>
<y>92</y> </layout>
<width>111</width>
<height>26</height>
</rect>
</property>
</widget>
</widget> </widget>
</item> </item>
<item> <item>
@ -247,7 +217,7 @@
<property name="title"> <property name="title">
<string>Files</string> <string>Files</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_3"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
@ -256,7 +226,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_2"> <widget class="QLineEdit" name="PaRingFileEdit">
<property name="text"> <property name="text">
<string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string> <string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string>
</property> </property>
@ -270,7 +240,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBox_4"/> <widget class="QSpinBox" name="PaRingIntervalSpin"/>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
@ -280,33 +250,49 @@
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_3"/> <widget class="QLineEdit" name="PaHoldFileEdit"/>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget> <widget class="QWidget" name="page_3">
</item> <layout class="QVBoxLayout" name="verticalLayout_3">
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QGroupBox" name="groupBox_5">
<item> <property name="title">
<spacer name="horizontalSpacer"> <string>User Information</string>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <layout class="QFormLayout" name="formLayout_4">
<size> <item row="0" column="0">
<width>40</width> <widget class="QLabel" name="label_13">
<height>20</height> <property name="text">
</size> <string>CallerID Name:</string>
</property> </property>
</spacer> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QLineEdit" name="PaCallerIdNameEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>CallerID Number:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="PaCallerIdNumEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -317,8 +303,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<resources> <resources>
<include location="resources.qrc"/> <include location="resources.qrc"/>

@ -3,6 +3,7 @@
<file alias="splash.png">resources/splash.png</file> <file alias="splash.png">resources/splash.png</file>
<file alias="pref_sip.png">resources/pref_sip.png</file> <file alias="pref_sip.png">resources/pref_sip.png</file>
<file alias="pref_audio.gif">resources/pref_audio.gif</file> <file alias="pref_audio.gif">resources/pref_audio.gif</file>
<file alias="pref_general.jpg">resources/pref_general.jpg</file>
</qresource> </qresource>
<qresource prefix="/confs"> <qresource prefix="/confs">
<file alias="freeswitch.xml">conf/freeswitch.xml</file> <file alias="freeswitch.xml">conf/freeswitch.xml</file>

Binary file not shown.

After

(image error) Size: 49 KiB