<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14262] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14262">14262</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-07-15 17:20:13 -0500 (Wed, 15 Jul 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Added the ability to store server configurations</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguiresourcesserver_managerui">freeswitch/trunk/contrib/jmesquita/fsgui/resources/server_manager.ui</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcincludeserver_managerh">freeswitch/trunk/contrib/jmesquita/fsgui/src/include/server_manager.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcserver_managercpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribjmesquitafsguiresourcesserver_managerui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/resources/server_manager.ui (14261 => 14262)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/resources/server_manager.ui        2009-07-15 20:31:12 UTC (rev 14261)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/resources/server_manager.ui        2009-07-15 22:20:13 UTC (rev 14262)
</span><span class="lines">@@ -19,131 +19,174 @@
</span><span class="cx"> <property name="windowTitle">
</span><span class="cx"> <string>Server Manager</string>
</span><span class="cx"> </property>
</span><del>- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QTreeView" name="treeView"/>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Server Settings</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
</del><ins>+ <widget class="QWidget" name="">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>9</y>
+ <width>500</width>
+ <height>232</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeWidget" name="serverTreeWidget">
+ <column>
+ <property name="text">
+ <string>Servers</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Server Settings</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Host</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="host">
+ <property name="text">
+ <string>localhost</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="pass">
+ <property name="text">
+ <string>ClueCon</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="port">
+ <property name="text">
+ <string>8021</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QPushButton" name="btnSave">
+ <property name="text">
+ <string>Save</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="btnDelete">
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>308</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="btnConnect">
</ins><span class="cx"> <property name="text">
</span><del>- <string>Host</string>
</del><ins>+ <string>Connect</string>
</ins><span class="cx"> </property>
</span><del>- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="host">
- <property name="text">
- <string>localhost</string>
</del><ins>+ <property name="default">
+ <bool>true</bool>
</ins><span class="cx"> </property>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><del>- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
</del><ins>+ <item>
+ <widget class="QPushButton" name="btnCancel">
</ins><span class="cx"> <property name="text">
</span><del>- <string>Password</string>
</del><ins>+ <string>Cancel</string>
</ins><span class="cx"> </property>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><del>- <item row="1" column="1">
- <widget class="QLineEdit" name="pass">
- <property name="text">
- <string>ClueCon</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Port</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="port">
- <property name="text">
- <string>8021</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QPushButton" name="pushButton">
- <property name="text">
- <string>Save</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QPushButton" name="pushButton_2">
- <property name="text">
- <string>Delete</string>
- </property>
- </widget>
- </item>
</del><span class="cx"> </layout>
</span><del>- </widget>
- </item>
- </layout>
- </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>
</del><ins>+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
</ins><span class="cx"> </widget>
</span><span class="cx"> <tabstops>
</span><span class="cx"> <tabstop>host</tabstop>
</span><span class="cx"> <tabstop>pass</tabstop>
</span><span class="cx"> <tabstop>port</tabstop>
</span><del>- <tabstop>treeView</tabstop>
- <tabstop>pushButton</tabstop>
- <tabstop>pushButton_2</tabstop>
- <tabstop>buttonBox</tabstop>
</del><ins>+ <tabstop>serverTreeWidget</tabstop>
+ <tabstop>btnSave</tabstop>
+ <tabstop>btnDelete</tabstop>
</ins><span class="cx"> </tabstops>
</span><span class="cx"> <resources/>
</span><span class="cx"> <connections>
</span><span class="cx"> <connection>
</span><del>- <sender>buttonBox</sender>
- <signal>accepted()</signal>
</del><ins>+ <sender>btnConnect</sender>
+ <signal>clicked(bool)</signal>
</ins><span class="cx"> <receiver>CserverManager</receiver>
</span><span class="cx"> <slot>accept()</slot>
</span><span class="cx"> <hints>
</span><span class="cx"> <hint type="sourcelabel">
</span><del>- <x>248</x>
- <y>254</y>
</del><ins>+ <x>383</x>
+ <y>224</y>
</ins><span class="cx"> </hint>
</span><span class="cx"> <hint type="destinationlabel">
</span><del>- <x>157</x>
- <y>274</y>
</del><ins>+ <x>257</x>
+ <y>124</y>
</ins><span class="cx"> </hint>
</span><span class="cx"> </hints>
</span><span class="cx"> </connection>
</span><span class="cx"> <connection>
</span><del>- <sender>buttonBox</sender>
- <signal>rejected()</signal>
</del><ins>+ <sender>btnCancel</sender>
+ <signal>clicked(bool)</signal>
</ins><span class="cx"> <receiver>CserverManager</receiver>
</span><span class="cx"> <slot>reject()</slot>
</span><span class="cx"> <hints>
</span><span class="cx"> <hint type="sourcelabel">
</span><del>- <x>316</x>
- <y>260</y>
</del><ins>+ <x>460</x>
+ <y>228</y>
</ins><span class="cx"> </hint>
</span><span class="cx"> <hint type="destinationlabel">
</span><del>- <x>286</x>
- <y>274</y>
</del><ins>+ <x>292</x>
+ <y>224</y>
</ins><span class="cx"> </hint>
</span><span class="cx"> </hints>
</span><span class="cx"> </connection>
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcincludeserver_managerh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/server_manager.h (14261 => 14262)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/server_manager.h        2009-07-15 20:31:12 UTC (rev 14261)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/server_manager.h        2009-07-15 22:20:13 UTC (rev 14262)
</span><span class="lines">@@ -54,10 +54,19 @@
</span><span class="cx"> QString getHost();
</span><span class="cx"> QString getPass();
</span><span class="cx"> QString getPort();
</span><ins>+ void readSettings();
+ void writeSettings();
+ void addChildSettings(QSettings &, QTreeWidgetItem *, const QString &);
</ins><span class="cx"> protected:
</span><span class="cx"> virtual void changeEvent(QEvent *e);
</span><span class="cx"> private:
</span><span class="cx"> Ui::CserverManager *m_ui;
</span><ins>+ QString settingsApplication;
+ QString settingsOrganization;
+private slots:
+ void addNewServer();
+ void deleteServer();
+ void serverSelected(QTreeWidgetItem *, int);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // SERVER_MANAGER_H
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcserver_managercpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp (14261 => 14262)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp        2009-07-15 20:31:12 UTC (rev 14261)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp        2009-07-15 22:20:13 UTC (rev 14262)
</span><span class="lines">@@ -44,8 +44,18 @@
</span><span class="cx"> m_ui(new Ui::CserverManager)
</span><span class="cx"> {
</span><span class="cx"> m_ui->setupUi(this);
</span><ins>+
+ settingsApplication = "FsGUI";
+ settingsOrganization = "FreeSWITCH";
+ readSettings();
+ connect(m_ui->btnSave, SIGNAL(clicked()),
+ this, SLOT(addNewServer()));
+ connect(m_ui->btnDelete, SIGNAL(clicked()),
+ this, SLOT(deleteServer()));
+
+ connect(m_ui->serverTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
+ this, SLOT(serverSelected(QTreeWidgetItem*,int)));
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> CserverManager::~CserverManager()
</span><span class="cx"> {
</span><span class="cx"> delete m_ui;
</span><span class="lines">@@ -62,7 +72,6 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> QString CserverManager::getHost()
</span><span class="cx"> {
</span><span class="cx"> return m_ui->host->text();
</span><span class="lines">@@ -75,3 +84,73 @@
</span><span class="cx"> {
</span><span class="cx"> return m_ui->pass->text();
</span><span class="cx"> }
</span><ins>+void CserverManager::readSettings()
+{
+ QSettings settings(settingsOrganization, settingsApplication);
+ m_ui->serverTreeWidget->clear();
+ m_ui->serverTreeWidget->setFocus();
+ addChildSettings(settings, 0, "servers");
+}
+void CserverManager::writeSettings()
+{
+}
+void CserverManager::addChildSettings(QSettings &settings, QTreeWidgetItem *parent, const QString &group)
+{
+ if(!parent)
+ parent = m_ui->serverTreeWidget->invisibleRootItem();
+ QTreeWidgetItem *item;
+
+
+
+ settings.beginGroup(group);
+
+ foreach(QString group, settings.childGroups())
+ {
+ item = new QTreeWidgetItem(parent);
+ item->setText(0, group);
+ }
+ settings.endGroup();
+}
+void CserverManager::addNewServer()
+{
+ QSettings settings(settingsOrganization, settingsApplication);
+
+ settings.beginGroup("servers");
+ settings.beginGroup(m_ui->host->text());
+ settings.setValue("password", m_ui->pass->text());
+ settings.setValue("port", m_ui->port->text());
+ settings.endGroup();
+ settings.endGroup();
+
+ m_ui->serverTreeWidget->clear();
+ addChildSettings(settings, 0, "servers");
+}
+void CserverManager::deleteServer()
+{
+ QTreeWidgetItem *item = m_ui->serverTreeWidget->currentItem();
+ if (item)
+ {
+ QSettings settings(settingsOrganization, settingsApplication);
+ settings.beginGroup("servers");
+ settings.remove(item->text(0));
+ settings.endGroup();
+ readSettings();
+ m_ui->host->clear();
+ m_ui->pass->clear();
+ m_ui->port->clear();
+ }
+}
+void CserverManager::serverSelected(QTreeWidgetItem *item, int col)
+{
+ QSettings settings(settingsOrganization, settingsApplication);
+
+ settings.beginGroup("servers");
+ settings.beginGroup(item->text(col));
+
+ m_ui->host->setText(item->text(col));
+ m_ui->port->setText(settings.value("port").toString());
+ m_ui->pass->setText(settings.value("password").toString());
+
+ settings.endGroup();
+ settings.endGroup();
+}
</ins></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>