<!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][14264] </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=14264">14264</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-07-15 19:49:41 -0500 (Wed, 15 Jul 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Yep, we now have multiple tabs.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguifsguipro">freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguiresourcesfs_guiui">freeswitch/trunk/contrib/jmesquita/fsgui/resources/fs_gui.ui</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcesl_connectioncpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcfs_guicpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/fs_gui.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcincludeesl_connectionh">freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcincludefs_guih">freeswitch/trunk/contrib/jmesquita/fsgui/src/include/fs_gui.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcserver_managercpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguiresourcesconsolepageui">freeswitch/trunk/contrib/jmesquita/fsgui/resources/consolepage.ui</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcconsolepagecpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcincludeconsolepageh">freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribjmesquitafsguifsguipro"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro (14263 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro        2009-07-16 00:46:35 UTC (rev 14263)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -1,27 +1,23 @@
</span><del>-
</del><span class="cx"> DESTDIR = ./bin/
</span><span class="cx"> message(The project will be installed in $$DESTDIR)
</span><span class="cx"> TARGET = fs_gui
</span><span class="cx"> TEMPLATE = app
</span><del>-
</del><span class="cx"> MOC_DIR = ./build/
</span><span class="cx"> OBJECTS_DIR = ./build/
</span><span class="cx"> UI_DIR = ./build/
</span><del>-
-SOURCES += ./src/main.cpp \
- ./src/fs_gui.cpp \
- ./src/server_manager.cpp \
- ./src/esl_connection.cpp
-
</del><ins>+SOURCES += src/main.cpp \
+ src/fs_gui.cpp \
+ src/server_manager.cpp \
+ src/esl_connection.cpp \
+ src/consolepage.cpp
</ins><span class="cx"> INCLUDEPATH += ../../../libs/esl/src/include \
</span><del>- ./src/include
-
-HEADERS += ./src/include/fs_gui.h \
- ./src/include/server_manager.h \
- ./src/include/esl_connection.h
-
-FORMS += ./resources/fs_gui.ui \
- ./resources/server_manager.ui
-
</del><ins>+ src/include
+HEADERS += src/include/fs_gui.h \
+ src/include/server_manager.h \
+ src/include/esl_connection.h \
+ src/include/consolepage.h
+FORMS += resources/fs_gui.ui \
+ resources/server_manager.ui \
+ resources/consolepage.ui
</ins><span class="cx"> LIBS += -L../../../libs/esl \
</span><span class="cx"> -lesl
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguiresourcesconsolepageui"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/resources/consolepage.ui (0 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/resources/consolepage.ui         (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/resources/consolepage.ui        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>consolePage</class>
+ <widget class="QWidget" name="consolePage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>274</width>
+ <height>244</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>consolePage</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTextEdit" name="textConsole"/>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="lineCmd"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnSend">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Send</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguiresourcesfs_guiui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/resources/fs_gui.ui (14263 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/resources/fs_gui.ui        2009-07-16 00:46:35 UTC (rev 14263)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/resources/fs_gui.ui        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -6,8 +6,8 @@
</span><span class="cx"> <rect>
</span><span class="cx"> <x>0</x>
</span><span class="cx"> <y>0</y>
</span><del>- <width>600</width>
- <height>400</height>
</del><ins>+ <width>296</width>
+ <height>303</height>
</ins><span class="cx"> </rect>
</span><span class="cx"> </property>
</span><span class="cx"> <property name="windowTitle">
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx"> <item>
</span><span class="cx"> <widget class="QTabWidget" name="tabWidget">
</span><span class="cx"> <property name="currentIndex">
</span><del>- <number>1</number>
</del><ins>+ <number>0</number>
</ins><span class="cx"> </property>
</span><span class="cx"> <property name="tabsClosable">
</span><span class="cx"> <bool>true</bool>
</span><span class="lines">@@ -53,36 +53,6 @@
</span><span class="cx"> </widget>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><del>- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLineEdit" name="lineCmd">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnSend">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Send</string>
- </property>
- <property name="shortcut">
- <string>Return</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</del><span class="cx"> </layout>
</span><span class="cx"> </widget>
</span><span class="cx"> <widget class="QMenuBar" name="menuBar">
</span><span class="lines">@@ -90,7 +60,7 @@
</span><span class="cx"> <rect>
</span><span class="cx"> <x>0</x>
</span><span class="cx"> <y>0</y>
</span><del>- <width>600</width>
</del><ins>+ <width>296</width>
</ins><span class="cx"> <height>26</height>
</span><span class="cx"> </rect>
</span><span class="cx"> </property>
</span><span class="lines">@@ -148,10 +118,6 @@
</span><span class="cx"> </action>
</span><span class="cx"> </widget>
</span><span class="cx"> <layoutdefault spacing="6" margin="11"/>
</span><del>- <tabstops>
- <tabstop>lineCmd</tabstop>
- <tabstop>btnSend</tabstop>
- </tabstops>
</del><span class="cx"> <resources/>
</span><span class="cx"> <connections>
</span><span class="cx"> <connection>
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcconsolepagecpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp (0 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp         (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -0,0 +1,204 @@
</span><ins>+/*
+ * Copyright (c) 2007, Anthony Minessale II
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita (at) gmail.com>
+ *
+ */
+#include <QtGui>
+#include "consolepage.h"
+#include "ui_consolepage.h"
+#include "esl_connection.h"
+#include "esl.h"
+
+consolePage::consolePage(QWidget *parent) :
+ QWidget(parent),
+ m_ui(new Ui::consolePage)
+{
+ m_ui->setupUi(this);
+}
+consolePage::~consolePage()
+{
+ delete m_ui;
+}
+void consolePage::init(QString host)
+{
+ this->host = host;
+ connect(m_ui->lineCmd, SIGNAL(textChanged(QString)),
+ this, SLOT(typedCommand()));
+ connect(m_ui->btnSend, SIGNAL(clicked()),
+ this, SLOT(sendCommand()));
+
+ QString settingsApplication = "FSGui";
+ QString settingsOrganization = "FreeSWITCH";
+
+ QSettings settings(settingsOrganization, settingsApplication);
+
+ settings.beginGroup("servers");
+ settings.beginGroup(host);
+ QString port = settings.value("port").toString();
+ QString pass = settings.value("password").toString();
+ settings.endGroup();
+ settings.endGroup();
+
+ qDebug() << settings.allKeys();
+ eslConnection = new ESLconnection(host.toAscii(),
+ port.toAscii(),
+ pass.toAscii());
+
+ /* Connect signals from eslConnection */
+ connect(eslConnection, SIGNAL(gotConnected(void)),
+ this, SLOT(gotConnectedSlot(void)));
+ connect(eslConnection, SIGNAL(gotDisconnected(void)),
+ this, SLOT(gotDisconnectedSlot(void)));
+ connect(eslConnection, SIGNAL(connectionFailed(QString)),
+ this, SLOT(connectionFailedSlot(QString)));
+ connect(eslConnection, SIGNAL(gotEvent(ESLevent*)),
+ this, SLOT(gotEventSlot(ESLevent*)));
+
+ eslConnection->doConnect();
+}
+void consolePage::changeEvent(QEvent *e)
+{
+ QWidget::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ m_ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+void consolePage::appendConsoleText(const QString text)
+{
+ m_ui->textConsole->append(text);
+}
+void consolePage::getDisconnectedSlot()
+{
+ eslConnection->disconnect();
+}
+void consolePage::typedCommand()
+{
+ m_ui->btnSend->setDisabled(m_ui->lineCmd->text().isEmpty());
+}
+void consolePage::sendCommand()
+{
+ QStringList cmdList = m_ui->lineCmd->text().split(" ");
+ QString args("");
+ for(int i = 1; i < cmdList.size(); i++)
+ {
+ args += cmdList[i];
+ if (i != cmdList.size()-1)
+ args += " ";
+ }
+ ESLevent *e = new ESLevent(eslConnection->api(cmdList[0].toAscii(), args.toAscii()));
+ gotEventSlot(e);
+ m_ui->lineCmd->clear();
+}
+void consolePage::gotConnectedSlot()
+{
+ appendConsoleText(tr("Connected!"));
+ m_ui->lineCmd->setEnabled(true);
+ m_ui->lineCmd->setFocus();
+}
+void consolePage::gotDisconnectedSlot()
+{
+ appendConsoleText(tr("Disconnected!"));
+ m_ui->lineCmd->setDisabled(true);
+ delete eslConnection;
+}
+void consolePage::connectionFailedSlot(QString msg)
+{
+ appendConsoleText("Connection Failed: "+msg);
+ m_ui->lineCmd->setDisabled(true);
+ delete eslConnection;
+}
+void consolePage::gotEventSlot(ESLevent * event)
+{
+ QString type (event->getHeader("Content-Type"));
+ if (QString::compare("log/data", type, Qt::CaseInsensitive) == 0)
+ {
+ switch (atoi(event->getHeader("log-level")))
+ {
+ case ESL_LOG_LEVEL_NOTICE:
+ {
+ m_ui->textConsole->setTextColor(Qt::cyan);
+ break;
+ }
+ case ESL_LOG_LEVEL_WARNING:
+ {
+ m_ui->textConsole->setTextColor(Qt::yellow);
+ break;
+ }
+ case ESL_LOG_LEVEL_ERROR:
+ case ESL_LOG_LEVEL_CRIT:
+ {
+ m_ui->textConsole->setTextColor(Qt::red);
+ break;
+ }
+ case ESL_LOG_LEVEL_ALERT:
+ case ESL_LOG_LEVEL_EMERG:
+ case ESL_LOG_LEVEL_INFO:
+ {
+ m_ui->textConsole->setTextColor(Qt::green);
+ break;
+ }
+ case ESL_LOG_LEVEL_DEBUG:
+ {
+ m_ui->textConsole->setTextColor(Qt::magenta);
+ break;
+ }
+ default:
+ {
+ m_ui->textConsole->setTextColor(Qt::black);
+ }
+ }
+ }
+ else
+ {
+ m_ui->textConsole->setTextColor(Qt::black);
+ }
+
+ if (event->getBody())
+ {
+ QString text = event->getBody();
+
+ if (text.endsWith("\r\n"))
+ text.chop(2);
+ if (text.endsWith("\n"))
+ text.chop(1);
+
+ appendConsoleText(text);
+ }
+ delete event;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcesl_connectioncpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp (14263 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp        2009-07-16 00:46:35 UTC (rev 14263)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -86,7 +86,6 @@
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> emit connectionFailed(QString(handle.err));
</span><del>- qDebug() << handle.err;
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -291,7 +290,6 @@
</span><span class="cx"> if (!connected())
</span><span class="cx"> {
</span><span class="cx"> emit gotDisconnected();
</span><del>- qDebug() << handle.err;
</del><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -387,7 +385,7 @@
</span><span class="cx"> return nextHeader();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-const char *ESLevent::serialize(const char *format)
</del><ins>+const char *ESLevent::serialize()
</ins><span class="cx"> {
</span><span class="cx"> this_check("");
</span><span class="cx">
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcfs_guicpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/fs_gui.cpp (14263 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fs_gui.cpp        2009-07-16 00:46:35 UTC (rev 14263)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fs_gui.cpp        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -38,8 +38,7 @@
</span><span class="cx">
</span><span class="cx"> #include "fs_gui.h"
</span><span class="cx"> #include "ui_fs_gui.h"
</span><del>-#include "esl_connection.h"
-#include "esl.h"
</del><ins>+#include "consolepage.h"
</ins><span class="cx">
</span><span class="cx"> Cfsgui::Cfsgui(QWidget *parent) :
</span><span class="cx"> QMainWindow(parent),
</span><span class="lines">@@ -55,24 +54,14 @@
</span><span class="cx"> this, SLOT(newConnectionFromDialog()));
</span><span class="cx"> connect(m_ui->actionAbout, SIGNAL(triggered()),
</span><span class="cx"> this, SLOT(showAbout()));
</span><del>- connect(m_ui->lineCmd, SIGNAL(textChanged(QString)),
- this, SLOT(typedCommand()));
- connect(m_ui->btnSend, SIGNAL(clicked()),
- this, SLOT(sendCommand()));
</del><span class="cx">
</span><del>- /* Why QtDesigner does not allow me to delete this? */
- m_ui->tabWidget->removeTab(1);
- delete m_ui->tab_2;
</del><ins>+ m_ui->tabWidget->clear();
</ins><span class="cx"> }
</span><span class="cx"> Cfsgui::~Cfsgui()
</span><span class="cx"> {
</span><span class="cx"> delete m_ui;
</span><span class="cx"> delete serverDialog;
</span><span class="cx"> }
</span><del>-void Cfsgui::appendConsoleText(const QString text)
-{
- m_ui->textConsole->append(text);
-}
</del><span class="cx"> void Cfsgui::showAbout()
</span><span class="cx"> {
</span><span class="cx"> QMessageBox::about(this, tr("About FSGui"),
</span><span class="lines">@@ -81,115 +70,7 @@
</span><span class="cx"> "<p>This is small application that will help you connect "
</span><span class="cx"> "to your FreeSWITCH&copy; installation."));
</span><span class="cx"> }
</span><del>-void Cfsgui::getDisconnectedSlot()
-{
- eslConnection->disconnect();
-}
-void Cfsgui::typedCommand()
-{
- m_ui->btnSend->setDisabled(m_ui->lineCmd->text().isEmpty());
-}
-void Cfsgui::sendCommand()
-{
- QStringList cmdList = m_ui->lineCmd->text().split(" ");
- QString args("");
- for(int i = 1; i < cmdList.size(); i++)
- {
- args += cmdList[i];
- if (i != cmdList.size()-1)
- args += " ";
- }
- ESLevent *e = new ESLevent(eslConnection->api(cmdList[0].toAscii(), args.toAscii()));
- gotEventSlot(e);
- m_ui->lineCmd->clear();
-}
-void Cfsgui::gotConnectedSlot()
-{
- m_ui->statusBar->showMessage(tr("Connected"));
- appendConsoleText(tr("Connected!"));
- m_ui->actionConnect->setDisabled(true);
- m_ui->actionDisconnect->setEnabled(true);
- m_ui->lineCmd->setEnabled(true);
- m_ui->lineCmd->setFocus();
-}
-void Cfsgui::gotDisconnectedSlot()
-{
- m_ui->statusBar->showMessage(tr("Disconnected"));
- appendConsoleText(tr("Disconnected!"));
- m_ui->actionConnect->setEnabled(true);
- m_ui->actionDisconnect->setDisabled(true);
- m_ui->lineCmd->setDisabled(true);
- delete eslConnection;
-}
-void Cfsgui::connectionFailedSlot(QString msg)
-{
- qDebug() << msg;
- m_ui->statusBar->showMessage("Connection Failed: "+msg);
- appendConsoleText("Connection Failed: "+msg);
- m_ui->actionConnect->setEnabled(true);
- m_ui->actionDisconnect->setDisabled(true);
- m_ui->lineCmd->setDisabled(true);
- delete eslConnection;
-}
-void Cfsgui::gotEventSlot(ESLevent * event)
-{
- QString type (event->getHeader("Content-Type"));
- if (QString::compare("log/data", type, Qt::CaseInsensitive) == 0)
- {
- switch (atoi(event->getHeader("log-level")))
- {
- case ESL_LOG_LEVEL_NOTICE:
- {
- m_ui->textConsole->setTextColor(Qt::cyan);
- break;
- }
- case ESL_LOG_LEVEL_WARNING:
- {
- m_ui->textConsole->setTextColor(Qt::yellow);
- break;
- }
- case ESL_LOG_LEVEL_ERROR:
- case ESL_LOG_LEVEL_CRIT:
- {
- m_ui->textConsole->setTextColor(Qt::red);
- break;
- }
- case ESL_LOG_LEVEL_ALERT:
- case ESL_LOG_LEVEL_EMERG:
- case ESL_LOG_LEVEL_INFO:
- {
- m_ui->textConsole->setTextColor(Qt::green);
- break;
- }
- case ESL_LOG_LEVEL_DEBUG:
- {
- m_ui->textConsole->setTextColor(Qt::magenta);
- break;
- }
- default:
- {
- m_ui->textConsole->setTextColor(Qt::black);
- }
- }
- }
- else
- {
- m_ui->textConsole->setTextColor(Qt::black);
- }
</del><span class="cx">
</span><del>- if (event->getBody())
- {
- QString text = event->getBody();
-
- if (text.endsWith("\r\n"))
- text.chop(2);
- if (text.endsWith("\n"))
- text.chop(1);
-
- appendConsoleText(text);
- }
- delete event;
-}
</del><span class="cx"> void Cfsgui::changeEvent(QEvent *e)
</span><span class="cx"> {
</span><span class="cx"> QMainWindow::changeEvent(e);
</span><span class="lines">@@ -218,24 +99,8 @@
</span><span class="cx">
</span><span class="cx"> if (serverDialog->exec())
</span><span class="cx"> {
</span><del>- m_ui->statusBar->showMessage("Connecting...");
- eslConnection = new ESLconnection(serverDialog->getHost().toAscii(),
- serverDialog->getPort().toAscii(),
- serverDialog->getPass().toAscii());
- /* Connect signals from eslConnection */
- connect(eslConnection, SIGNAL(gotConnected(void)),
- this, SLOT(gotConnectedSlot(void)));
- connect(eslConnection, SIGNAL(gotDisconnected(void)),
- this, SLOT(gotDisconnectedSlot(void)));
- connect(eslConnection, SIGNAL(connectionFailed(QString)),
- this, SLOT(connectionFailedSlot(QString)));
- connect(eslConnection, SIGNAL(gotEvent(ESLevent*)),
- this, SLOT(gotEventSlot(ESLevent*)));
-
- /* Connect the disconnect menu */
- connect(m_ui->actionDisconnect, SIGNAL(triggered()),
- this, SLOT(getDisconnectedSlot()));
-
- eslConnection->doConnect();
</del><ins>+ consolePage *page = new consolePage();
+ m_ui->tabWidget->addTab(page, serverDialog->getHost());
+ page->init(serverDialog->getHost());
</ins><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcincludeconsolepageh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h (0 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h         (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+#ifndef CONSOLEPAGE_H
+#define CONSOLEPAGE_H
+
+#include <QtGui/QWidget>
+
+namespace Ui {
+ class consolePage;
+}
+
+/* Forward declarations */
+class ESLevent;
+class ESLconnection;
+
+class consolePage : public QWidget {
+ Q_OBJECT
+
+public:
+ consolePage(QWidget *parent = 0);
+ ~consolePage();
+ void init(QString host);
+
+protected:
+ virtual void changeEvent(QEvent *e);
+ void appendConsoleText(const QString);
+
+private slots:
+ void gotConnectedSlot();
+ void gotDisconnectedSlot();
+ void connectionFailedSlot(QString);
+ void gotEventSlot(ESLevent *);
+ void getDisconnectedSlot();
+ void typedCommand();
+ void sendCommand();
+private:
+ Ui::consolePage *m_ui;
+ ESLconnection *eslConnection;
+ QString host;
+};
+
+#endif // CONSOLEPAGE_H
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcincludeesl_connectionh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.h (14263 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.h        2009-07-16 00:46:35 UTC (rev 14263)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.h        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">         ESLevent(esl_event_t *wrap_me, int free_me = 0);
</span><span class="cx">         ESLevent(ESLevent *me);
</span><span class="cx">         virtual ~ESLevent();
</span><del>-        const char *serialize(const char *format = NULL);
</del><ins>+ const char *serialize();
</ins><span class="cx">         bool setPriority(esl_priority_t priority = ESL_PRIORITY_NORMAL);
</span><span class="cx">         const char *getHeader(const char *header_name);
</span><span class="cx">         char *getBody(void);
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcincludefs_guih"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/fs_gui.h (14263 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/fs_gui.h        2009-07-16 00:46:35 UTC (rev 14263)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/fs_gui.h        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -46,9 +46,6 @@
</span><span class="cx"> class Cfsgui;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-/* Forward declarations */
-class ESLevent;
-class ESLconnection;
</del><span class="cx">
</span><span class="cx"> class Cfsgui : public QMainWindow {
</span><span class="cx"> Q_OBJECT
</span><span class="lines">@@ -60,23 +57,14 @@
</span><span class="cx"> protected:
</span><span class="cx"> virtual void changeEvent(QEvent *e);
</span><span class="cx"> void closeEvent(QCloseEvent *e);
</span><del>- void appendConsoleText(const QString);
</del><span class="cx">
</span><span class="cx"> private slots:
</span><span class="cx"> void showAbout();
</span><span class="cx"> void newConnectionFromDialog();
</span><del>- void gotConnectedSlot();
- void gotDisconnectedSlot();
- void connectionFailedSlot(QString);
- void gotEventSlot(ESLevent *);
- void getDisconnectedSlot();
- void typedCommand();
- void sendCommand();
</del><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> Ui::Cfsgui *m_ui;
</span><span class="cx"> CserverManager *serverDialog;
</span><del>- ESLconnection *eslConnection;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // FS_GUI_H
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcserver_managercpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp (14263 => 14264)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp        2009-07-16 00:46:35 UTC (rev 14263)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp        2009-07-16 00:49:41 UTC (rev 14264)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> {
</span><span class="cx"> m_ui->setupUi(this);
</span><span class="cx">
</span><del>- settingsApplication = "FsGUI";
</del><ins>+ settingsApplication = "FSGui";
</ins><span class="cx"> settingsOrganization = "FreeSWITCH";
</span><span class="cx"> readSettings();
</span><span class="cx"> connect(m_ui->btnSave, SIGNAL(clicked()),
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>