]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Quite a big commit that might break a lot of things. Will fix tomorrow if it does...
authorJoão Mesquita <jmesquita@freeswitch.org>
Thu, 14 Jan 2010 02:32:20 +0000 (02:32 +0000)
committerJoão Mesquita <jmesquita@freeswitch.org>
Thu, 14 Jan 2010 02:32:20 +0000 (02:32 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16297 d0543943-73ff-0310-b7d9-9358b9ac24b2

19 files changed:
fscomm/FSComm.pro
fscomm/conf/account.conf.xml [deleted file]
fscomm/conf/event_socket.conf.xml [deleted file]
fscomm/conf/freeswitch.xml
fscomm/conf/portaudio.conf.xml [deleted file]
fscomm/conf/sofia.conf.xml [deleted file]
fscomm/fshost.cpp
fscomm/mod_qsettings/mod_qsettings.cpp
fscomm/mod_qsettings/mod_qsettings.h
fscomm/preferences/accountdialog.cpp
fscomm/preferences/accountdialog.h
fscomm/preferences/prefaccounts.cpp
fscomm/preferences/prefaccounts.h
fscomm/preferences/prefdialog.cpp
fscomm/preferences/prefdialog.h
fscomm/preferences/prefdialog.ui
fscomm/preferences/prefportaudio.cpp
fscomm/preferences/prefsofia.cpp
fscomm/resources.qrc

index 0efa1cc0b67d241a89c1a9253a9e59c8a55a29b9..52291ee8dca59c50a0e1283c9a5c418288466d04 100644 (file)
@@ -1,7 +1,7 @@
 # #####################################
 # version check qt
 # #####################################
-contains(QT_VERSION, ^4\.[0-4]\..*) {
+contains(QT_VERSION, ^4\.[0-4]\..*) { 
     message("Cannot build FsGui with Qt version $$QT_VERSION.")
     error("Use at least Qt 4.5.")
 }
@@ -38,13 +38,10 @@ HEADERS += mainwindow.h \
     preferences/prefdialog.h \
     preferences/prefportaudio.h \
     preferences/prefsofia.h \
-    preferences/accountdialog.h
+    preferences/accountdialog.h \
+    preferences/prefaccounts.h
 FORMS += mainwindow.ui \
     preferences/prefdialog.ui \
     preferences/accountdialog.ui
 RESOURCES += resources.qrc
-OTHER_FILES += conf/portaudio.conf.xml \
-    conf/event_socket.conf.xml \
-    conf/freeswitch.xml \
-    conf/sofia.conf.xml \
-    conf/account.conf.xml
+OTHER_FILES += conf/freeswitch.xml
diff --git a/fscomm/conf/account.conf.xml b/fscomm/conf/account.conf.xml
deleted file mode 100644 (file)
index 4d65e8e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<gateway name="${name}">
-  <param name="username" value="${username}"/>
-  <param name="realm" value="${realm}"/>
-  <param name="from-user" value="${from-user}"/>
-  <param name="from-domain" value="${from-domain}"/>
-  <param name="password" value="${password}"/>
-  <param name="extension" value="${extension}"/>
-  <param name="proxy" value="${proxy}"/>
-  <param name="register-proxy" value="${register-proxy}"/>
-  <param name="expire-seconds" value="${expire-seconds}"/>
-  <param name="register" value="${register}"/>
-  <param name="register-transport" value="${register-transport}"/>
-  <param name="retry-seconds" value="${retry-seconds}"/>
-  <param name="caller-id-in-from" value="${caller-id-in-from}"/>
-  <param name="contact-params" value="${contact-params}"/>
-  <param name="ping" value="${ping}"/>
-</gateway>
diff --git a/fscomm/conf/event_socket.conf.xml b/fscomm/conf/event_socket.conf.xml
deleted file mode 100644 (file)
index 613bfc6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<document type="freeswitch/xml">
-    <section name="configuration">
-<configuration name="event_socket.conf" description="Socket Client">
-         <settings>
-               <param name="nat-map" value="false"/>
-               <param name="listen-ip" value="127.0.0.1"/>
-               <param name="listen-port" value="8021"/>
-               <param name="password" value="ClueCon"/>
-         </settings>
-    </configuration>
-  </section>
-</document>
index a1bbbc5681eab3d8b444f57d3081b24b73989b28..c11c8a536504cc1bd21b064df72e56933233e57e 100644 (file)
                        </modules>
                </configuration>
 
+                <configuration name="portaudio.conf" description="Soundcard Endpoint">
+                  <settings>
+                    <param name="indev" value=""/>
+                    <!-- device to use for output -->
+                    <param name="outdev" value=""/>
+                    <!--<param name="ringdev" value=""/>-->
+                    <param name="ring-file" value="tone_stream://%(2000,4000,440.0,480.0);loops=20"/>
+                    <param name="ring-interval" value="5"/>
+                    <param name="hold-file" value="$${hold_music}"/>
+                    <!--<param name="timer-name" value="soft"/>-->
+                    <param name="dialplan" value="XML"/>
+                    <param name="cid-name" value="$${outbound_caller_name}"/>
+                    <param name="cid-num" value="$${outbound_caller_number}"/>
+                    <param name="sample-rate" value="48000"/>
+                    <param name="codec-ms" value="10"/>
+                  </settings>
+                </configuration>
+
+                <configuration name="event_socket.conf" description="Socket Client">
+                      <settings>
+                            <param name="nat-map" value="false"/>
+                            <param name="listen-ip" value="127.0.0.1"/>
+                            <param name="listen-port" value="8022"/>
+                            <param name="password" value="ClueCon"/>
+                      </settings>
+                </configuration>
+
                <configuration name="post_load_modules.conf" description="Modules">
                        <modules>
                        </modules>
diff --git a/fscomm/conf/portaudio.conf.xml b/fscomm/conf/portaudio.conf.xml
deleted file mode 100644 (file)
index 8bffb84..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<document type="freeswitch/xml">
-    <section name="configuration">
-        <configuration name="portaudio.conf" description="Soundcard Endpoint">
-            <settings>
-                <!-- DO NOT take the # off the devices config -->
-                <param name="indev" value="#${indev}"/>
-                <!-- device to use for output -->
-                <param name="outdev" value="#${outdev}"/>
-                <param name="ringdev" value="#${ringdev}"/>
-                <param name="ring-file" value="${ring-file}"/>
-                <param name="ring-interval" value="${ring-interval}"/>
-                <param name="hold-file" value="${hold-file}"/>
-                <!--<param name="timer-name" value="soft"/>-->
-                <param name="dialplan" value="XML"/>
-                <param name="cid-name" value="${cid-name}"/>
-                <param name="cid-num" value="${cid-num}"/>
-                <param name="sample-rate" value="48000"/>
-                <param name="codec-ms" value="10"/>
-            </settings>
-        </configuration>
-    </section>
-</document>
-
diff --git a/fscomm/conf/sofia.conf.xml b/fscomm/conf/sofia.conf.xml
deleted file mode 100644 (file)
index 2dde03d..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<document type="freeswitch/xml">
-       <section name="configuration">
-               <configuration name="sofia.conf" description="sofia Endpoint">
-                       <global_settings>
-                               <param name="log-level" value="${log-level}"/>
-                               <param name="auto-restart" value="${auto-restart}"/>
-                               <param name="debug-presence" value="${debug-presence}"/>
-                               <param name="rewrite-multicasted-fs-path" value="${rewrite-multicasted-fs-path}"/>
-                       </global_settings>
-                       <profiles>
-                               <profile name="softphone">
-                                        <gateways>
-                                        </gateways>
-                                       <settings>
-                                         <param name="user-agent-string" value="${user-agent-string)"/>
-                                         <param name="debug" value="${debug}"/>
-                                         <param name="sip-trace" value="${sip-trace}"/>
-                                         <param name="context" value="${context}"/>
-                                         <param name="rfc2833-pt" value="${rfc2833-pt}"/>
-                                         <param name="sip-port" value="${sip-port}"/>
-                                         <param name="dialplan" value="${dialplan}"/>
-                                         <param name="dtmf-duration" value="${dtmf-duration}"/>
-                                         <param name="codec-prefs" value="${codec_prefs}"/>
-                                         <param name="use-rtp-timer" value="${use-rtp-timer}"/>
-                                         <param name="rtp-timer-name" value="${rtp-timer-name}"/>
-                                         <param name="rtp-ip" value="${rtp-ip}"/>
-                                         <param name="sip-ip" value="${sip-ip}"/>
-                                         <param name="hold-music" value="${hold-music}"/>
-                                         <param name="apply-nat-acl" value="${apply-nat-acl}"/>
-                                         <param name="manage-presence" value="${manage-presence}"/>
-                                         <param name="max-proceeding" value="${max-proceeding}"/>
-                                         <param name="inbound-codec-negotiation" value="${inbound-codec-negotiation}"/>
-                                         <param name="nonce-ttl" value="${nonce-ttl}"/>
-                                         <param name="auth-calls" value="${auth-calls}"/>
-                                         <param name="auth-all-packets" value="${auth-all-packets}"/>
-                                         <param name="ext-rtp-ip" value="${ext-rtp-ip}"/>
-                                         <param name="ext-sip-ip" value="${ext-sip-ip}"/>
-                                         <param name="rtp-timeout-sec" value="${rtp-timeout-sec}"/>
-                                         <param name="rtp-hold-timeout-sec" value="${rtp-hold-timeout-sec}"/>
-                                         <param name="disable-register" value="${disable-register}"/>
-                                         <param name="challenge-realm" value="${challenge-realm}"/>
-                                       </settings>
-                               </profile>
-                       </profiles>
-               </configuration>
-       </section>
-</document>
index 5d58dae278a444eead8c02a98974762bedc5eb4d..a6b79ac91f691d246880ad8086e50432f666cc3d 100644 (file)
@@ -56,7 +56,6 @@ void FSHost::createFolders()
         conf_dir.mkpath(".fscomm/conf/accounts");
         conf_dir.mkpath(".fscomm/sounds");
         QFile::copy(":/sounds/test.wav", QString("%1/.fscomm/sounds/test.wav").arg(QDir::homePath()));
-        conf_dir.mkpath(".fscomm/templates");
         QFile rootXML(":/confs/freeswitch.xml");
         QString dest = QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath());
         rootXML.copy(dest);
index 30e3fa5d175092b126e92dee5c2f614f35f0c8f7..84d577f2b858b6362a97060b425fe546b64b0d86 100644 (file)
 #include <QString>
 #include <QtGui>
 #include <QDir>
-#include <QDomDocument>
-#include <QDomNodeList>
+#include <QXmlStreamWriter>
 #include "mod_qsettings/mod_qsettings.h"
 
 switch_xml_t XMLBinding::getConfigXML(QString tmpl)
 {
-    switch_event_t *e;
-    switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS);
-    switch_assert(e);
-
-    if (QFile::exists(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl))) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
-                          "Using template %s.xml on .fscomm/.\n",
-                          tmpl.toAscii().constData());
-    }
-    else if(QFile::exists(QString(":/confs/%1.xml").arg(tmpl)))
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
-                          "Template %s.xml, doesn't exist on directory, copying embedded template.\n",
-                          tmpl.toAscii().constData());
-        QString dest = QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl);
-        QString orig = QString(":/confs/%1.xml").arg(tmpl);
-        QFile::copy(orig, dest);
-    }
-
-    QFile tmplFile(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl));
-    if (!tmplFile.open(QIODevice::ReadOnly | QIODevice::Text))
+    _settings->beginGroup("FreeSWITCH/conf");
+    if (!_settings->childGroups().contains(tmpl))
     {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template %s could not be read!\n", tmpl.toAscii().constData());
+        _settings->endGroup();
         return NULL;
     }
+    _settings->beginGroup(tmpl);
 
-    /* Open template file and expand all strings based on QSettings */
-    QByteArray tmplContents(tmplFile.readAll());
-    tmplFile.close();
+    QByteArray *finalXML = new QByteArray();
+    QXmlStreamWriter streamWriter(finalXML);
 
-    _settings->beginGroup("FreeSWITCH/conf");
-    _settings->beginGroup(tmpl);
-    foreach(QString k, _settings->childKeys())
+    streamWriter.setAutoFormatting(true);
+    streamWriter.writeStartElement("document");
+    streamWriter.writeAttribute("type", "freeswitch/xml");
+
+    streamWriter.writeStartElement("section");
+    streamWriter.writeAttribute("name", "configuration");
+
+    streamWriter.writeStartElement("configuration");
+    streamWriter.writeAttribute("name", tmpl);
+    streamWriter.writeAttribute("description", "Configuration generated by QSettings");
+
+    foreach (QString group, _settings->childGroups())
     {
-        switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData());
+        parseGroup(&streamWriter, group);
     }
+
+    streamWriter.writeEndElement();
+    streamWriter.writeEndElement();
+    streamWriter.writeEndElement();
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config for %s requested. Providing the following XML:\n%s\n",
+                      tmpl.toAscii().constData(), finalXML->data());
+
     _settings->endGroup();
     _settings->endGroup();
 
-    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_safe_free(e);
-    if (tmpl == "sofia.conf")
-    {
-        return proccessAccounts(tmpl, res);
-    }
-    return switch_xml_parse_str(res, strlen(res));
+    return switch_xml_parse_str(finalXML->data(), strlen(finalXML->data()));
 }
 
-switch_xml_t XMLBinding::proccessAccounts(QString tmpl, QByteArray xml)
+void XMLBinding::parseGroup(QXmlStreamWriter *streamWriter, QString group)
 {
-    char *res = NULL;
-
-    QDomDocument xmlDom;
-
-    /* Process sofia accounts */
-    if (tmpl == "sofia.conf")
+    if (group == "attrs")
     {
-        int errorLine, errorColumn;
-        QString errorMsg;
-
-        if (!xmlDom.setContent(xml, &errorMsg, &errorLine, &errorColumn))
+        _settings->beginGroup(group);
+        foreach (QString k, _settings->childKeys())
         {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not parse the xml template from sofia.conf.xml to add the accounts!\n");
+            streamWriter->writeAttribute(k, _settings->value(k).toString());
         }
-        QDomNodeList gatewaysNodeList = xmlDom.elementsByTagName("gateways");
-        if (gatewaysNodeList.isEmpty() || gatewaysNodeList.count() > 1)
+        _settings->endGroup();
+        return;
+    }
+
+    if (group == "params")
+    {
+        _settings->beginGroup(group);
+        foreach(QString param, _settings->childKeys())
         {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Where is my gateways tag? Or do we have more then one match?\n");
+            streamWriter->writeStartElement("param");
+            streamWriter->writeAttribute("name", param);
+            streamWriter->writeAttribute("value", _settings->value(param).toString());
+            streamWriter->writeEndElement();
         }
+        _settings->endGroup();
+        return;
+    }
 
-        QDomNode gatewaysNode = gatewaysNodeList.at(0);
-
-        _settings->beginGroup("FreeSWITCH/conf/accounts");
-        foreach (QString account, _settings->childGroups())
+    if (group == "gateways")
+    {
+        streamWriter->writeStartElement(group);
+        _settings->beginGroup(group);
+        foreach (QString gw, _settings->childGroups())
         {
-            switch_event_t *e;
-            switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS);
-            switch_assert(e);
-
-            _settings->beginGroup(account);
-            switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, "name", account.toAscii().data());
-            foreach (QString k, _settings->childKeys())
+            _settings->beginGroup(gw);
+            foreach(QString g, _settings->childGroups())
             {
-                switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData());
+                parseGroup(streamWriter, g);
             }
             _settings->endGroup();
-
-            /* Open template file and expand all strings based on QSettings */
-            QFile tmplFile(QString("%1/.fscomm/templates/account.conf.xml").arg(QDir::homePath()));
-            if (!tmplFile.open(QIODevice::ReadOnly | QIODevice::Text))
-            {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template for accounts could not be read!\n");
-                return NULL;
-            }
-
-            QByteArray tmplContents(tmplFile.readAll());
-            tmplFile.close();
-
-            res = switch_event_expand_headers(e, tmplContents.data());
-
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template of account %s as follows:\n%s", account.toAscii().data(), res);
-
-            QDomDocument gatewayXML;
-            if (!gatewayXML.setContent(QByteArray(res), &errorMsg, &errorLine, &errorColumn))
-            {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We could not parse the XML for the account!\n");
-            }
-
-            gatewaysNode.appendChild(gatewayXML);
-            switch_safe_free(e);
         }
         _settings->endGroup();
+        streamWriter->writeEndElement();
+        return;
     }
 
-    return switch_xml_parse_str(xmlDom.toByteArray().data(), strlen(xmlDom.toByteArray().data()));
+    _settings->beginGroup(group);
+    streamWriter->writeStartElement(group);
+
+    foreach (QString group2, _settings->childGroups())
+    {
+        parseGroup(streamWriter, group2);
+    }
+
+    streamWriter->writeEndElement();
+    _settings->endGroup();
 }
 
 static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
index e6947ac242c8eedc246a024c8cc587c08a6a8e2c..ba0c2eb447b1fd851f6620ac91f1eee57f688525 100644 (file)
@@ -43,7 +43,7 @@ public:
     QString getBinding(void) { return _binding; }
     switch_xml_t getConfigXML(QString);
 private:
-    switch_xml_t proccessAccounts(QString, QByteArray);
+    void parseGroup(QXmlStreamWriter *,QString);
     QString _binding;
     QSettings* _settings;
 };
index a4095f7debe33e5efa62d4da985ab4fef470ace4..3acb284d7ef203201b7a13880f127c26fbdfb761 100644 (file)
@@ -2,9 +2,11 @@
 #include <QtGui>
 #include "accountdialog.h"
 #include "ui_accountdialog.h"
+#include "fshost.h"
 
-AccountDialog::AccountDialog(QWidget *parent) :
+AccountDialog::AccountDialog(int accId, QWidget *parent) :
     QDialog(parent),
+    _accId(accId),
     ui(new Ui::AccountDialog)
 {
     ui->setupUi(this);
@@ -57,9 +59,16 @@ void AccountDialog::addExtraParam()
 
 void AccountDialog::writeConfig()
 {
-    _settings->beginGroup("FreeSWITCH/conf/accounts");
+    _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
 
-    _settings->beginGroup(ui->sofiaGwNameEdit->text());
+    _settings->beginGroup(QString::number(_accId));
+    
+    _settings->beginGroup("gateway/attrs");
+    _settings->setValue("name", ui->sofiaGwNameEdit->text());
+    _settings->endGroup();
+
+
+    _settings->beginGroup("gateway/params");
     _settings->setValue("username", ui->sofiaGwUsernameEdit->text());
     _settings->setValue("realm", ui->sofiaGwRealmEdit->text());
     _settings->setValue("password", ui->sofiaGwPasswordEdit->text());
@@ -67,9 +76,7 @@ void AccountDialog::writeConfig()
     _settings->setValue("expire-seconds", ui->sofiaGwExpireSecondsSpin->value());
     _settings->setValue("register", ui->sofiaGwRegisterCombo->currentText());
     _settings->setValue("register-transport", ui->sofiaGwRegisterTransportCombo->currentText());
-    _settings->setValue("retry-seconds", ui->sofiaGwRetrySecondsSpin->value());
-
-    _settings->beginGroup("customParams");
+    _settings->setValue("retry-seconds", ui->sofiaGwRetrySecondsSpin->value());    
     for (int i = 0; i< ui->sofiaExtraParamTable->rowCount(); i++)
     {
         _settings->setValue(ui->sofiaExtraParamTable->item(i, 0)->text(),
@@ -80,6 +87,14 @@ void AccountDialog::writeConfig()
     _settings->endGroup();
 
     _settings->endGroup();
+
+    QString res;
+    if (g_FSHost.sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
+        return;
+    }
+    emit gwAdded();
 }
 
 void AccountDialog::changeEvent(QEvent *e)
index f229a4459a0de40f499dd23535f20c35620edc59..21ca7cffe03a53e24aeb1320a35323a2380eb235 100644 (file)
@@ -12,9 +12,12 @@ class QSettings;
 class AccountDialog : public QDialog {
     Q_OBJECT
 public:
-    AccountDialog(QWidget *parent = 0);
+    AccountDialog(int accId, QWidget *parent = 0);
     ~AccountDialog();
 
+signals:
+    void gwAdded();
+
 private slots:
     void writeConfig();
     void addExtraParam();
@@ -24,6 +27,7 @@ protected:
     void changeEvent(QEvent *e);
 
 private:
+    int _accId;
     Ui::AccountDialog *ui;
     QSettings *_settings;
 };
index d4695f07889ebaaac2670434089fbaa75dcb802e..0f7da804fff111bef1695ceb1746776fcc331b72 100644 (file)
@@ -1,10 +1,26 @@
 #include <QtGui>
 #include "prefaccounts.h"
+#include "accountdialog.h"
 
 PrefAccounts::PrefAccounts(Ui::PrefDialog *ui) :
         _ui(ui)
 {
     _settings = new QSettings();
+    _accDlg = NULL;
+    connect(_ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
+}
+
+void PrefAccounts::addAccountBtnClicked()
+{
+    if (!_accDlg)
+    {
+        _accDlg = new AccountDialog(_ui->accountsTable->rowCount());
+        connect(_accDlg, SIGNAL(gwAdded()), this, SLOT(readConfig()));
+    }
+
+    _accDlg->show();
+    _accDlg->raise();
+    _accDlg->activateWindow();
 }
 
 void PrefAccounts::writeConfig()
@@ -14,13 +30,22 @@ void PrefAccounts::writeConfig()
 
 void PrefAccounts::readConfig()
 {
-    _settings->beginGroup("FreeSWITCH/conf/accounts");
-    foreach(QString accountName, _settings->childGroups())
+
+    _ui->accountsTable->clearContents();
+    _ui->accountsTable->setRowCount(0);
+
+    _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
+    
+    foreach(QString accId, _settings->childGroups())
     {
-        _settings->beginGroup(accountName);
-        QTableWidgetItem *item0 = new QTableWidgetItem(accountName);
+        _settings->beginGroup(accId);
+        _settings->beginGroup("gateway/attrs");
+        QTableWidgetItem *item0 = new QTableWidgetItem(_settings->value("name").toString());
+        _settings->endGroup();
+        _settings->beginGroup("gateway/params");
         QTableWidgetItem *item1 = new QTableWidgetItem(_settings->value("username").toString());
         _settings->endGroup();
+        _settings->endGroup();
         _ui->accountsTable->setRowCount(_ui->accountsTable->rowCount()+1);
         _ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 0, item0);
         _ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 1, item1);
index aa4206ca061872889e99c30f38a9331b4f65a969..2fbd6aa4efab29df574e63ea1128a56a771ca801 100644 (file)
@@ -5,16 +5,23 @@
 #include "ui_prefdialog.h"
 
 class QSettings;
+class AccountDialog;
 
-class PrefAccounts
-{
+class PrefAccounts : public QObject {
+    Q_OBJECT
 public:
     explicit PrefAccounts(Ui::PrefDialog *ui);
-    void readConfig();
     void writeConfig();
 
+public slots:
+    void readConfig();
+
+private slots:
+    void addAccountBtnClicked();
+
 private:
     Ui::PrefDialog *_ui;
+    AccountDialog *_accDlg;
     QSettings *_settings;
 };
 
index 483377462b757a3530f447c6476974add072bd24..3edb4c8bdf03a2200d3da9939a95de2a519478aa 100644 (file)
@@ -3,7 +3,6 @@
 #include "ui_prefdialog.h"
 #include "prefportaudio.h"
 #include "prefsofia.h"
-#include "accountdialog.h"
 #include "prefaccounts.h"
 
 PrefDialog::PrefDialog(QWidget *parent) :
@@ -13,12 +12,10 @@ PrefDialog::PrefDialog(QWidget *parent) :
     ui->setupUi(this);
     _settings = new QSettings();
     connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
-    connect(ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
 
-    _accDlg = NULL;
-    /*_pref_accounts = new PrefAccounts(ui);*/
+    _pref_accounts = new PrefAccounts(ui);
     _mod_portaudio = new PrefPortaudio(ui, this);
-    /*_mod_sofia = new PrefSofia(ui, this);*/
+    _mod_sofia = new PrefSofia(ui, this);
     readConfig();
 }
 
@@ -27,20 +24,10 @@ PrefDialog::~PrefDialog()
     delete ui;
 }
 
-void PrefDialog::addAccountBtnClicked()
-{
-    if (!_accDlg)
-        _accDlg = new AccountDialog();
-
-    _accDlg->show();
-    _accDlg->raise();
-    _accDlg->activateWindow();
-}
-
 void PrefDialog::writeConfig()
 {    
     _mod_portaudio->writeConfig();
-    /*_mod_sofia->writeConfig();*/
+    _mod_sofia->writeConfig();
 }
 
 void PrefDialog::changeEvent(QEvent *e)
@@ -57,7 +44,7 @@ void PrefDialog::changeEvent(QEvent *e)
 
 void PrefDialog::readConfig()
 {
-    /*_pref_accounts->readConfig();*/
+    _pref_accounts->readConfig();
     _mod_portaudio->readConfig();
-    /*_mod_sofia->readConfig();*/
+    _mod_sofia->readConfig();
 }
index 794131bb8939ec775edfc5279d710d94bc175f87..7c9907f5c295208d81595f3acd672062e0f614ea 100644 (file)
@@ -9,7 +9,6 @@
 class PrefPortaudio;
 class PrefSofia;
 class PrefAccounts;
-class AccountDialog;
 
 namespace Ui {
     class PrefDialog;
@@ -25,17 +24,15 @@ protected:
     void changeEvent(QEvent *e);
 
 private slots:
-    void addAccountBtnClicked();
     void writeConfig();
 
 private:
     void readConfig();
     QSettings *_settings;
-    AccountDialog *_accDlg;
-/*    PrefAccounts *_pref_accounts;*/
+    PrefAccounts *_pref_accounts;
     Ui::PrefDialog *ui;
     PrefPortaudio *_mod_portaudio;
-/*    PrefSofia *_mod_sofia;*/
+    PrefSofia *_mod_sofia;
 };
 
 
index 8ac862430a7ff0ffb94634f59440f825abb07387..e3aec50a936df49da24146092f2725709c154b05 100644 (file)
@@ -72,9 +72,6 @@
        <iconset resource="../resources.qrc">
         <normaloff>:/images/pref_accounts.jpg</normaloff>:/images/pref_accounts.jpg</iconset>
       </property>
-      <property name="flags">
-       <set>ItemIsSelectable|ItemIsDragEnabled|ItemIsUserCheckable</set>
-      </property>
      </item>
      <item>
       <property name="text">
@@ -84,9 +81,6 @@
        <iconset resource="../resources.qrc">
         <normaloff>:/images/pref_sip.png</normaloff>:/images/pref_sip.png</iconset>
       </property>
-      <property name="flags">
-       <set>ItemIsSelectable|ItemIsDragEnabled|ItemIsUserCheckable</set>
-      </property>
      </item>
      <item>
       <property name="text">
index 822d94f77c8e9a7370d4ae58ef08ff1f7c9b5770..44da76332cc74499e9d5ef0ab29ec622e1064b3e 100644 (file)
@@ -72,7 +72,7 @@ void PrefPortaudio::ringFileChoose()
 void PrefPortaudio::writeConfig()
 {
     _settings->beginGroup("FreeSWITCH/conf");
-    _settings->beginGroup("portaudio.conf");
+    _settings->beginGroup("portaudio.conf/settings/params");
 
     QString cid_name = _settings->value("cid-name").toString();
     QString ncid_name = _ui->PaCallerIdNameEdit->text();
@@ -155,7 +155,7 @@ void PrefPortaudio::readConfig()
     getPaDevlist();
     _settings->beginGroup("FreeSWITCH/conf");
 
-    _settings->beginGroup("portaudio.conf");
+    _settings->beginGroup("portaudio.conf/settings/params");
     _ui->PaCallerIdNameEdit->setText(_settings->value("cid-name").toString());
     _ui->PaCallerIdNumEdit->setText(_settings->value("cid-num").toString());
     _ui->PaHoldFileEdit->setText(_settings->value("hold-file").toString());
index a1b7ebc41fbcc206404d7ba15ca2ff7b23de2a88..c86981e6df27d384ef8f70c7b8e5634995de45f3 100644 (file)
@@ -24,12 +24,22 @@ void PrefSofia::writeConfig()
     _settings->beginGroup("sofia.conf");
 
     /* General Settings */
+    _settings->beginGroup("global_settings/params");
     _settings->setValue("log-level", _ui->sofiaLogLevelSpin->value());
     _settings->setValue("auto-restart", _ui->sofiaAutoRestartCombo->currentText());
     _settings->setValue("debug-presence", _ui->sofiaDebugPresenceSpin->value());
     _settings->setValue("rewrite-multicasted-fs-path", _ui->sofiaRewriteMulticastedFsPathCombo->currentText());
+    _settings->endGroup();
 
     /* Profile settings */
+    _settings->beginGroup("profiles");
+    _settings->beginGroup("profile");
+
+    _settings->beginGroup("attrs");
+    _settings->setValue("name", "softphone");
+    _settings->endGroup();
+
+    _settings->beginGroup("settings/params");
     _settings->setValue("user-agent-string", _ui->sofiaUserAgentStringEdit->text());
     _settings->setValue("debug", _ui->sofiaDebugSpin->value());
     _settings->setValue("sip-trace", _ui->sofiaSipTraceCombo->currentText());
@@ -57,7 +67,7 @@ void PrefSofia::writeConfig()
     _settings->setValue("rtp-hold-timeout-sec", _ui->sofiaRtpHoldTimeoutSecSpin->value());
     _settings->setValue("disable-register", _ui->sofiaDisableRegisterCombo->currentText());
     _settings->setValue("challenge-realm", _ui->sofiaChallengeRealmCombo->currentText());
-
+    _settings->endGroup();
 
     _settings->endGroup();
     _settings->endGroup();
index bd71ace46243e0468d7bf100f92f5d392d33b500..483fa2528daf5479007468e8bbb72c8d14e979a0 100644 (file)
@@ -8,11 +8,6 @@
     </qresource>
     <qresource prefix="/confs">
         <file alias="freeswitch.xml">conf/freeswitch.xml</file>
-        <file alias="example.xml">conf/accounts/example.xml</file>
-        <file alias="event_socket.conf.xml">conf/event_socket.conf.xml</file>
-        <file alias="portaudio.conf.xml">conf/portaudio.conf.xml</file>
-        <file alias="sofia.conf.xml">conf/sofia.conf.xml</file>
-        <file alias="account.conf.xml">conf/account.conf.xml</file>
     </qresource>
     <qresource prefix="/sounds">
         <file alias="test.wav">resources/test.wav</file>