提交 4ba291d4 authored 作者: João Mesquita's avatar João Mesquita

Start persisting settings. Portaudio devices are persisted.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16164 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 f6ed8b27
...@@ -8,11 +8,11 @@ ...@@ -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) ...@@ -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) : ...@@ -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() ...@@ -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 @@ ...@@ -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: ...@@ -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,317 +6,301 @@ ...@@ -6,317 +6,301 @@
<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"> <widget class="QListWidget" name="listSections">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::NoDragDrop</enum>
</property>
<property name="iconSize">
<size>
<width>96</width>
<height>84</height>
</size>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="spacing">
<number>12</number>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<item> <item>
<widget class="QListWidget" name="listSections"> <property name="text">
<property name="minimumSize"> <string>Sofia</string>
<size> </property>
<width>120</width> <property name="icon">
<height>0</height> <iconset resource="resources.qrc">
</size> <normaloff>:/images/pref_sip.png</normaloff>:/images/pref_sip.png</iconset>
</property> </property>
<property name="maximumSize"> </item>
<size> <item>
<width>120</width> <property name="text">
<height>16777215</height> <string>PortAudio</string>
</size> </property>
</property> <property name="icon">
<property name="showDropIndicator" stdset="0"> <iconset resource="resources.qrc">
<bool>false</bool> <normaloff>:/images/pref_audio.gif</normaloff>:/images/pref_audio.gif</iconset>
</property> </property>
<property name="dragDropMode"> </item>
<enum>QAbstractItemView::NoDragDrop</enum> <item>
</property> <property name="text">
<property name="iconSize"> <string>General</string>
<size> </property>
<width>96</width> <property name="icon">
<height>84</height> <iconset resource="resources.qrc">
</size> <normaloff>:/images/pref_general.jpg</normaloff>:/images/pref_general.jpg</iconset>
</property> </property>
<property name="movement"> </item>
<enum>QListView::Static</enum> </widget>
</property> </item>
<property name="flow"> <item row="0" column="1">
<enum>QListView::LeftToRight</enum> <widget class="QStackedWidget" name="stackedWidget">
</property> <property name="currentIndex">
<property name="isWrapping" stdset="0"> <number>1</number>
<bool>true</bool> </property>
</property> <widget class="QWidget" name="page">
<property name="spacing"> <layout class="QVBoxLayout" name="verticalLayout_2">
<number>12</number>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<item> <item>
<property name="text"> <widget class="QGroupBox" name="groupBox">
<string>Sofia</string> <property name="title">
</property> <string>Global Settings</string>
<property name="icon"> </property>
<iconset resource="resources.qrc"> <layout class="QFormLayout" name="formLayout">
<normaloff>:/images/pref_sip.png</normaloff>:/images/pref_sip.png</iconset> <item row="0" column="0">
</property> <widget class="QLabel" name="label">
<property name="text">
<string>log-level</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="logLevelSpin"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>auto-restart</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="autoRestartCombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>debug-presence</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="debugPresenceSpin"/>
</item>
</layout>
</widget>
</item> </item>
<item> <item>
<property name="text"> <widget class="QGroupBox" name="groupBox_2">
<string>PortAudio</string> <property name="title">
</property> <string>Softphone Profile</string>
<property name="icon"> </property>
<iconset resource="resources.qrc"> <layout class="QFormLayout" name="formLayout_2">
<normaloff>:/images/pref_audio.gif</normaloff>:/images/pref_audio.gif</iconset> <item row="0" column="0">
</property> <widget class="QLabel" name="label_4">
<property name="text">
<string>user-agent-string</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="userAgentStringEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>debug</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="debugSpin"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>sip-trace</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="sipTraceCombo"/>
</item>
</layout>
</widget>
</item> </item>
</widget> </layout>
</item> </widget>
<item> <widget class="QWidget" name="page_2">
<widget class="QStackedWidget" name="stackedWidget"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="currentIndex"> <item>
<number>1</number> <widget class="QGroupBox" name="groupBox_3">
</property> <property name="title">
<widget class="QWidget" name="page"> <string>Devices</string>
<layout class="QVBoxLayout" name="verticalLayout_2"> </property>
<item> <layout class="QFormLayout" name="formLayout_3">
<widget class="QGroupBox" name="groupBox"> <item row="0" column="0">
<property name="title">
<string>Global Settings</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>log-level</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>auto-restart</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>debug-presence</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBox_2"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Softphone Profile</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>user-agent-string</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>debug</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_3"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>sip-trace</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_2"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Devices</string>
</property>
<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> <widget class="QLabel" name="label_8">
<height>26</height> <property name="text">
</rect> <string>outdev</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_8"> </item>
<property name="geometry"> <item row="1" column="1">
<rect> <widget class="QComboBox" name="PaOutdevCombo"/>
<x>63</x> </item>
<y>64</y> <item row="2" column="0">
<width>43</width> <widget class="QLabel" name="label_9">
<height>17</height> <property name="text">
</rect> <string>rindgev</string>
</property> </property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="PaRingdevCombo"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Files</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>outdev</string> <string>ring-file</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="PaOutdevCombo"> </item>
<property name="geometry"> <item row="0" column="1">
<rect> <widget class="QLineEdit" name="PaRingFileEdit">
<x>111</x> <property name="text">
<y>62</y> <string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string>
<width>111</width>
<height>26</height>
</rect>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_9"> </item>
<property name="geometry"> <item row="1" column="0">
<rect> <widget class="QLabel" name="label_12">
<x>59</x> <property name="text">
<y>94</y> <string>ring-interval</string>
<width>47</width>
<height>17</height>
</rect>
</property> </property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="PaRingIntervalSpin"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>rindgev</string> <string>hold-file</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="PaRingdevCombo"> </item>
<property name="geometry"> <item row="2" column="1">
<rect> <widget class="QLineEdit" name="PaHoldFileEdit"/>
<x>111</x> </item>
<y>92</y> </layout>
<width>111</width> </widget>
<height>26</height> </item>
</rect> </layout>
</widget>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>User Information</string>
</property>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>CallerID Name:</string>
</property> </property>
</widget> </widget>
</widget> </item>
</item> <item row="0" column="1">
<item> <widget class="QLineEdit" name="PaCallerIdNameEdit"/>
<widget class="QGroupBox" name="groupBox_4"> </item>
<property name="title"> <item row="1" column="0">
<string>Files</string> <widget class="QLabel" name="label_14">
</property> <property name="text">
<layout class="QFormLayout" name="formLayout_3"> <string>CallerID Number:</string>
<item row="0" column="0"> </property>
<widget class="QLabel" name="label_10"> </widget>
<property name="text"> </item>
<string>ring-file</string> <item row="1" column="1">
</property> <widget class="QLineEdit" name="PaCallerIdNumEdit"/>
</widget> </item>
</item> </layout>
<item row="0" column="1"> </widget>
<widget class="QLineEdit" name="lineEdit_2"> </item>
<property name="text"> </layout>
<string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string> </widget>
</property> </widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>ring-interval</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_4"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>hold-file</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_3"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item> </item>
<item> <item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QDialogButtonBox" name="buttonBox">
<item> <property name="orientation">
<spacer name="horizontalSpacer"> <enum>Qt::Horizontal</enum>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> <property name="standardButtons">
</property> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<property name="sizeHint" stdset="0"> </property>
<size> </widget>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
......
...@@ -3,6 +3,7 @@ ...@@ -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>
......
This diff was suppressed by a .gitattributes entry.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论