<!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][14273] </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=14273">14273</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-07-16 11:33:59 -0500 (Thu, 16 Jul 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Inherit ESLevent to emit different signals for different types of command. Colors have been disabled till we do the preferences window</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="#freeswitchtrunkcontribjmesquitafsguisrcconsolepagecpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcesl_connectioncpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcincludeconsolepageh">freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcincludeesl_connectionh">freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.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 (14272 => 14273)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/resources/server_manager.ui        2009-07-16 15:43:54 UTC (rev 14272)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/resources/server_manager.ui        2009-07-16 16:33:59 UTC (rev 14273)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> <item row="0" column="1">
</span><span class="cx"> <widget class="QLineEdit" name="host">
</span><span class="cx"> <property name="text">
</span><del>- <string>localhost</string>
</del><ins>+ <string/>
</ins><span class="cx"> </property>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx"> <item row="1" column="1">
</span><span class="cx"> <widget class="QLineEdit" name="pass">
</span><span class="cx"> <property name="text">
</span><del>- <string>ClueCon</string>
</del><ins>+ <string/>
</ins><span class="cx"> </property>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx"> <item row="2" column="1">
</span><span class="cx"> <widget class="QLineEdit" name="port">
</span><span class="cx"> <property name="text">
</span><del>- <string>8021</string>
</del><ins>+ <string/>
</ins><span class="cx"> </property>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcconsolepagecpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp (14272 => 14273)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp        2009-07-16 15:43:54 UTC (rev 14272)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp        2009-07-16 16:33:59 UTC (rev 14273)
</span><span class="lines">@@ -91,6 +91,8 @@
</span><span class="cx"> this, SLOT(connectionFailedSlot(QString)));
</span><span class="cx"> connect(eslConnection, SIGNAL(gotEvent(ESLevent*)),
</span><span class="cx"> this, SLOT(gotEventSlot(ESLevent*)));
</span><ins>+ connect(eslConnection, SIGNAL(gotConsoleEvent(ESLeventLog*)),
+ this, SLOT(gotConsoleEventSlot(ESLeventLog*)));
</ins><span class="cx">
</span><span class="cx"> eslConnection->doConnect();
</span><span class="cx"> }
</span><span class="lines">@@ -127,7 +129,7 @@
</span><span class="cx"> if (i != cmdList.size()-1)
</span><span class="cx"> args += " ";
</span><span class="cx"> }
</span><del>- ESLevent *e = new ESLevent(eslConnection->api(cmdList[0].toAscii(), args.toAscii()));
</del><ins>+ ESLevent *e = new ESLevent(eslConnection->bgapi(cmdList[0].toAscii(), args.toAscii()));
</ins><span class="cx"> gotEventSlot(e);
</span><span class="cx"> m_ui->lineCmd->clear();
</span><span class="cx"> }
</span><span class="lines">@@ -138,6 +140,7 @@
</span><span class="cx"> m_ui->comboLogLevel->setEnabled(eslConnection->connected());
</span><span class="cx"> m_ui->lineCmd->setFocus();
</span><span class="cx"> readSettings();
</span><ins>+ eslConnection->sendRecv("event plain BACKGROUND_JOB");
</ins><span class="cx"> }
</span><span class="cx"> void consolePage::gotDisconnectedSlot()
</span><span class="cx"> {
</span><span class="lines">@@ -153,50 +156,23 @@
</span><span class="cx"> }
</span><span class="cx"> void consolePage::gotEventSlot(ESLevent * event)
</span><span class="cx"> {
</span><del>- QString type (event->getHeader("Content-Type"));
- if (QString::compare("log/data", type, Qt::CaseInsensitive) == 0)
</del><ins>+ m_ui->textConsole->setTextColor(Qt::black);
+ if (event->getBody())
</ins><span class="cx"> {
</span><del>- 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><ins>+ QString text = event->getBody();
</ins><span class="cx">
</span><ins>+ if (text.endsWith("\r\n"))
+ text.chop(2);
+ if (text.endsWith("\n"))
+ text.chop(1);
+
+ appendConsoleText(text);
+ }
+ delete event;
+}
+void consolePage::gotConsoleEventSlot(ESLeventLog * event)
+{
+ m_ui->textConsole->setTextColor(event->getConsoleColor());
</ins><span class="cx"> if (event->getBody())
</span><span class="cx"> {
</span><span class="cx"> QString text = event->getBody();
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcesl_connectioncpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp (14272 => 14273)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp        2009-07-16 15:43:54 UTC (rev 14272)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp        2009-07-16 16:33:59 UTC (rev 14273)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include <QtGui>
</span><span class="cx"> #include <esl.h>
</span><span class="cx"> #include <esl_connection.h>
</span><ins>+#include "global_defines.h"
</ins><span class="cx">
</span><span class="cx"> #define connection_construct_common() memset(&handle, 0, sizeof(handle)); last_event_obj = NULL
</span><span class="cx"> #define event_construct_common() event = NULL; serialized_string = NULL; mine = 0; hp = NULL
</span><span class="lines">@@ -284,8 +285,18 @@
</span><span class="cx"> ESLevent * event = recvEventTimed(10);
</span><span class="cx"> if (event)
</span><span class="cx"> {
</span><del>- ESLevent * e = new ESLevent(event);
- emit gotEvent(e);
</del><ins>+ QString type (event->getHeader("Content-Type"));
+ if (QString::compare("log/data", type, Qt::CaseInsensitive) == 0)
+ {
+ ESLeventLog *e = new ESLeventLog(event);
+ e->readSettings();
+ emit gotConsoleEvent(e);
+ }
+ else
+ {
+ ESLevent * e = new ESLevent(event);
+ emit gotEvent(e);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if (!QString(handle.err).isEmpty())
</span><span class="lines">@@ -487,3 +498,17 @@
</span><span class="cx">
</span><span class="cx"> return (char *) "invalid";
</span><span class="cx"> }
</span><ins>+
+/* ESLeventLog */
+/***********************************************************************************************/
+ESLeventLog::ESLeventLog(ESLevent *e) : ESLevent(e){}
+ESLeventLog::~ESLeventLog(){}
+void ESLeventLog::readSettings()
+{
+ QSettings settings(SETTINGS_ORGANIZATION, SETTINGS_APPLICATION);
+ QColor consoleColor = settings.value(QString("Log-Level-%1-Color").arg(ESLevent::getHeader("Log-Level")), QColor(Qt::black)).value<QColor>();
+}
+QColor ESLeventLog::getConsoleColor()
+{
+ return consoleColor;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcincludeconsolepageh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h (14272 => 14273)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h        2009-07-16 15:43:54 UTC (rev 14272)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h        2009-07-16 16:33:59 UTC (rev 14273)
</span><span class="lines">@@ -9,6 +9,7 @@
</span><span class="cx">
</span><span class="cx"> /* Forward declarations */
</span><span class="cx"> class ESLevent;
</span><ins>+class ESLeventLog;
</ins><span class="cx"> class ESLconnection;
</span><span class="cx">
</span><span class="cx"> class consolePage : public QWidget {
</span><span class="lines">@@ -28,6 +29,7 @@
</span><span class="cx"> void gotDisconnectedSlot();
</span><span class="cx"> void connectionFailedSlot(QString);
</span><span class="cx"> void gotEventSlot(ESLevent *);
</span><ins>+ void gotConsoleEventSlot(ESLeventLog *);
</ins><span class="cx"> void getDisconnectedSlot();
</span><span class="cx"> void typedCommand();
</span><span class="cx"> void sendCommand();
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcincludeesl_connectionh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.h (14272 => 14273)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.h        2009-07-16 15:43:54 UTC (rev 14272)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/esl_connection.h        2009-07-16 16:33:59 UTC (rev 14273)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #ifndef _ESL_CONNECTION_H_
</span><span class="cx"> #define _ESL_CONNECTION_H_
</span><span class="cx"> #include <QThread>
</span><ins>+#include <QtGui>
</ins><span class="cx"> #include <esl.h>
</span><span class="cx">
</span><span class="cx"> /*#ifdef __cplusplus
</span><span class="lines">@@ -73,6 +74,16 @@
</span><span class="cx">         const char *nextHeader(void);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class ESLeventLog : public ESLevent {
+public:
+ ESLeventLog(ESLevent *e);
+ virtual ~ESLeventLog();
+ QColor getConsoleColor();
+ void readSettings();
+private:
+ QColor consoleColor;
+};
+
</ins><span class="cx"> class ESLconnection : public QThread
</span><span class="cx"> {
</span><span class="cx"> Q_OBJECT
</span><span class="lines">@@ -107,6 +118,7 @@
</span><span class="cx"> void gotDisconnected(void);
</span><span class="cx"> void connectionFailed(QString);
</span><span class="cx"> void gotEvent(ESLevent*);
</span><ins>+ void gotConsoleEvent(ESLeventLog*);
</ins><span class="cx"> protected:
</span><span class="cx"> void run();
</span><span class="cx"> };
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcserver_managercpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp (14272 => 14273)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp        2009-07-16 15:43:54 UTC (rev 14272)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/server_manager.cpp        2009-07-16 16:33:59 UTC (rev 14273)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> m_ui->setupUi(this);
</span><span class="cx">
</span><span class="cx"> readSettings();
</span><ins>+
</ins><span class="cx"> connect(m_ui->btnSave, SIGNAL(clicked()),
</span><span class="cx"> this, SLOT(addNewServer()));
</span><span class="cx"> connect(m_ui->btnDelete, SIGNAL(clicked()),
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>