Modified: freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.cpp (14209 => 14210)
--- freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.cpp 2009-07-13 03:19:40 UTC (rev 14209)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/esl_connection.cpp 2009-07-13 04:21:31 UTC (rev 14210)
@@ -37,26 +37,23 @@
ESLevent * event = connection->recvEventTimed(10);
if (event)
{
- std::cout << "We received and event!" << std::endl;
- emit gotEvent(event);
+ ESLevent * e = new ESLevent(event);
+ emit gotEvent(e);
}
}
else if (!connection->connected() && isConnected)
{
- std::cout << "We just got disconnected." << std::endl;
isConnected = false;
emit gotDisconnected();
}
else if (connection->connected() && !isConnected)
{
- std::cout << "We just got connected." << std::endl;
isConnected = true;
connection->sendRecv("log 7");
emit gotConnected();
}
else
{
- std::cout << "We are disconnected and should stop this." << std::endl;
doDisconnect();
break;
}
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.cpp (14209 => 14210)
--- freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.cpp 2009-07-13 03:19:40 UTC (rev 14209)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.cpp 2009-07-13 04:21:31 UTC (rev 14210)
@@ -1,5 +1,6 @@
#include "fs_gui.h"
#include "ui_fs_gui.h"
+#include "esl_oop.h"
#include <iostream>
Cfsgui::Cfsgui(QWidget *parent) :
@@ -8,32 +9,54 @@
serverDialog(new CserverManager)
{
m_ui->setupUi(this);
+
+ // Set the default status bar message
+ m_ui->statusBar->addPermanentWidget(new QLabel(tr("Ready")),true);
+
connect(m_ui->actionConnect, SIGNAL(triggered())
, serverDialog, SLOT(show()));
connect(serverDialog, SIGNAL(doConnect(QString,QString,QString)),
this, SLOT(newConnectionFromDialog(QString,QString,QString)));
- /*connect(eslConnection, SIGNAL(gotConnected(void)),
- this, SLOT(gotConnectedSlot(void)));
- connect(eslConnection, SIGNAL(gotDisconnected(void)),
- this, SLOT(gotDisconnectedSlot(void)));*/
-}
+ }
Cfsgui::~Cfsgui()
{
delete m_ui;
delete serverDialog;
}
+void Cfsgui::appendConsoleText(const QString text)
+{
+ m_ui->textConsole->append(text);
+}
+
void Cfsgui::gotConnectedSlot()
{
- m_ui->textConsole->append("Conneted!");
m_ui->statusBar->showMessage("Connected");
+ appendConsoleText("Conneted!");
}
void Cfsgui::gotDisconnectedSlot()
{
- m_ui->statusBar->showMessage("Disconnected");
+ appendConsoleText("Disconnected!");
m_ui->textConsole->append("Conneted!");
}
+
+void Cfsgui::gotEventSlot(ESLevent * event)
+{
+ 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;
+}
+
void Cfsgui::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
@@ -57,4 +80,12 @@
{
m_ui->statusBar->showMessage("Connecting...");
eslConnection = new eslConnectionManager(host, pass, port);
+
+ /* 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(gotEvent(ESLevent*)),
+ this, SLOT(gotEventSlot(ESLevent*)));
}
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.h (14209 => 14210)
--- freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.h 2009-07-13 03:19:40 UTC (rev 14209)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.h 2009-07-13 04:21:31 UTC (rev 14210)
@@ -9,6 +9,8 @@
class Cfsgui;
}
+class ESLevent;
+
class Cfsgui : public QMainWindow {
Q_OBJECT
Q_DISABLE_COPY(Cfsgui)
@@ -19,11 +21,13 @@
protected:
virtual void changeEvent(QEvent *e);
void closeEvent(QCloseEvent *e);
+ void appendConsoleText(const QString);
private slots:
void newConnectionFromDialog(QString,QString,QString);
void gotConnectedSlot();
void gotDisconnectedSlot();
+ void gotEventSlot(ESLevent *);
private:
Ui::Cfsgui *m_ui;
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.ui (14209 => 14210)
--- freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.ui 2009-07-13 03:19:40 UTC (rev 14209)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fs_gui.ui 2009-07-13 04:21:31 UTC (rev 14210)
@@ -78,7 +78,11 @@
<addaction name="menuFile"/>
<addaction name="menuHelp"/>
</widget>
- <widget class="QStatusBar" name="statusBar"/>
+ <widget class="QStatusBar" name="statusBar">
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
<action name="actionQuit">
<property name="text">
<string>&Quit</string>