<!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][17232] </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=17232">17232</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2010-04-07 00:05:03 -0500 (Wed, 07 Apr 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add new debug tools to FSComm to help on development. Check tools->debug.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkfscommFSCommpro">freeswitch/trunk/fscomm/FSComm.pro</a></li>
<li><a href="#freeswitchtrunkfscommfshostcpp">freeswitch/trunk/fscomm/fshost.cpp</a></li>
<li><a href="#freeswitchtrunkfscommfshosth">freeswitch/trunk/fscomm/fshost.h</a></li>
<li><a href="#freeswitchtrunkfscommmainwindowcpp">freeswitch/trunk/fscomm/mainwindow.cpp</a></li>
<li><a href="#freeswitchtrunkfscommmainwindowh">freeswitch/trunk/fscomm/mainwindow.h</a></li>
<li><a href="#freeswitchtrunkfscommmainwindowui">freeswitch/trunk/fscomm/mainwindow.ui</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>freeswitch/trunk/fscomm/debugtools/</li>
<li><a href="#freeswitchtrunkfscommdebugtoolsconsolewindowcpp">freeswitch/trunk/fscomm/debugtools/consolewindow.cpp</a></li>
<li><a href="#freeswitchtrunkfscommdebugtoolsconsolewindowh">freeswitch/trunk/fscomm/debugtools/consolewindow.h</a></li>
<li><a href="#freeswitchtrunkfscommdebugtoolsconsolewindowui">freeswitch/trunk/fscomm/debugtools/consolewindow.ui</a></li>
<li><a href="#freeswitchtrunkfscommdebugtoolssortfilterproxymodelcpp">freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.cpp</a></li>
<li><a href="#freeswitchtrunkfscommdebugtoolssortfilterproxymodelh">freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.h</a></li>
<li><a href="#freeswitchtrunkfscommdebugtoolsstatedebugdialogcpp">freeswitch/trunk/fscomm/debugtools/statedebugdialog.cpp</a></li>
<li><a href="#freeswitchtrunkfscommdebugtoolsstatedebugdialogh">freeswitch/trunk/fscomm/debugtools/statedebugdialog.h</a></li>
<li><a href="#freeswitchtrunkfscommdebugtoolsstatedebugdialogui">freeswitch/trunk/fscomm/debugtools/statedebugdialog.ui</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkfscommFSCommpro"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/FSComm.pro (17231 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/FSComm.pro        2010-04-06 20:03:57 UTC (rev 17231)
+++ freeswitch/trunk/fscomm/FSComm.pro        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -33,7 +33,10 @@
</span><span class="cx"> preferences/prefaccounts.cpp \
</span><span class="cx"> account.cpp \
</span><span class="cx"> widgets/codecwidget.cpp \
</span><del>- channel.cpp
</del><ins>+ channel.cpp \
+ debugtools/consolewindow.cpp \
+ debugtools/sortfilterproxymodel.cpp \
+ debugtools/statedebugdialog.cpp
</ins><span class="cx"> HEADERS += mainwindow.h \
</span><span class="cx"> fshost.h \
</span><span class="cx"> call.h \
</span><span class="lines">@@ -45,10 +48,15 @@
</span><span class="cx"> preferences/prefaccounts.h \
</span><span class="cx"> account.h \
</span><span class="cx"> widgets/codecwidget.h \
</span><del>- channel.h
</del><ins>+ channel.h \
+ debugtools/consolewindow.h \
+ debugtools/sortfilterproxymodel.h \
+ debugtools/statedebugdialog.h
</ins><span class="cx"> FORMS += mainwindow.ui \
</span><span class="cx"> preferences/prefdialog.ui \
</span><span class="cx"> preferences/accountdialog.ui \
</span><del>- widgets/codecwidget.ui
</del><ins>+ widgets/codecwidget.ui \
+ debugtools/consolewindow.ui \
+ debugtools/statedebugdialog.ui
</ins><span class="cx"> RESOURCES += resources.qrc
</span><span class="cx"> OTHER_FILES += conf/freeswitch.xml
</span></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolsconsolewindowcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/consolewindow.cpp (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/consolewindow.cpp         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/consolewindow.cpp        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,158 @@
</span><ins>+#include "consolewindow.h"
+#include "ui_consolewindow.h"
+
+ConsoleWindow::ConsoleWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::ConsoleWindow),
+ findNext(false)
+{
+ ui->setupUi(this);
+ sourceModel = new ConsoleModel(this);
+ model = new SortFilterProxyModel(this);
+ model->setSourceModel(sourceModel);
+ model->setFilterKeyColumn(0);
+ ui->consoleListView->setModel(model);
+ ui->consoleListView->setColumnWidth(0, 2000);
+
+ connect(sourceModel, SIGNAL(beforeInserting()),
+ this, SLOT(setConditionalScroll()));
+ connect(sourceModel, SIGNAL(afterInserting()),
+ this, SLOT(conditionalScroll()));
+
+ connect(ui->btnSend, SIGNAL(clicked()),
+ this, SLOT(cmdSendClicked()));
+ connect(ui->lineCmd, SIGNAL(textChanged(QString)),
+ this, SLOT(lineCmdChanged(QString)));
+
+ _levelFilter = new QSignalMapper(this);
+ connect(ui->checkEmerg, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ connect(ui->checkAlert, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ connect(ui->checkCrit, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ connect(ui->checkDebug, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ connect(ui->checkError, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ connect(ui->checkInfo, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ connect(ui->checkNotice, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ connect(ui->checkWarn, SIGNAL(clicked()), _levelFilter, SLOT(map()));
+ _levelFilter->setMapping(ui->checkEmerg, SWITCH_LOG_CONSOLE);
+ _levelFilter->setMapping(ui->checkAlert, SWITCH_LOG_ALERT);
+ _levelFilter->setMapping(ui->checkCrit, SWITCH_LOG_CRIT);
+ _levelFilter->setMapping(ui->checkDebug, SWITCH_LOG_DEBUG);
+ _levelFilter->setMapping(ui->checkError, SWITCH_LOG_ERROR);
+ _levelFilter->setMapping(ui->checkInfo, SWITCH_LOG_INFO);
+ _levelFilter->setMapping(ui->checkNotice, SWITCH_LOG_NOTICE);
+ _levelFilter->setMapping(ui->checkWarn, SWITCH_LOG_WARNING);
+ connect(_levelFilter, SIGNAL(mapped(int)), this, SLOT(filterModelLogLevel(int)));
+
+ connect(ui->btnFilterClear, SIGNAL(clicked()),
+ this, SLOT(filterClear()));
+ connect(ui->lineFilter, SIGNAL(textChanged(QString)),
+ this, SLOT(filterStringChanged()));
+ connect(ui->filterCaseSensitivityCheckBox, SIGNAL(toggled(bool)),
+ this, SLOT(filterStringChanged()));
+ connect(ui->filterSyntaxComboBox, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(filterStringChanged()));
+ connect(ui->filterReverseCheckBox, SIGNAL(toggled(bool)),
+ this, SLOT(reverseFilterChecked()));
+
+ connect(&g_FSHost, SIGNAL(eventLog(QSharedPointer<switch_log_node_t>,switch_log_level_t)), this, SLOT(loggerHandler(QSharedPointer<switch_log_node_t>,switch_log_level_t)));
+
+}
+
+ConsoleWindow::~ConsoleWindow()
+{
+ delete ui;
+}
+
+void ConsoleWindow::changeEvent(QEvent *e)
+{
+ QMainWindow::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+void ConsoleWindow::setConditionalScroll()
+{
+ autoScroll = (ui->consoleListView->verticalScrollBar()->maximum() == ui->consoleListView->verticalScrollBar()->value());
+}
+
+void ConsoleWindow::conditionalScroll()
+{
+ if (autoScroll)
+ ui->consoleListView->scrollToBottom();
+}
+
+void ConsoleWindow::cmdSendClicked()
+{
+ if (ui->lineCmd->text().isEmpty()) return;
+
+ QString cmd = ui->lineCmd->text().split(" ", QString::SkipEmptyParts)[0];
+ if (cmd.isEmpty()) return;
+
+ QStringList split = ui->lineCmd->text().split(" ", QString::SkipEmptyParts);
+ if (split.isEmpty()) return;
+ QString args;
+ for (int i=1; i<split.length(); i++)
+ {
+ args += split[i];
+ if (i!=split.length()-1)
+ args += " ";
+ }
+
+ QString res;
+ g_FSHost.sendCmd(cmd.toAscii().data(), args.toAscii().data(), &res);
+ QStandardItem *item = new QStandardItem(res);
+ item->setData(SWITCH_LOG_CONSOLE, ConsoleModel::LogLevelRole);
+ addNewConsoleItem(item);
+ ui->lineCmd->clear();
+}
+
+void ConsoleWindow::lineCmdChanged(QString text)
+{
+ ui->btnSend->setDisabled(text.isEmpty());
+}
+
+void ConsoleWindow::filterModelLogLevel(int level)
+{
+ model->setLogLevelFilter(level);
+}
+
+void ConsoleWindow::loggerHandler(QSharedPointer<switch_log_node_t> node, switch_log_level_t level)
+{
+ if (level > ui->comboLogLevel->currentIndex()) return;
+ QString text(node.data()->data);
+ if (!text.isEmpty())
+ {
+ /* Remove \r\n */
+ QStringList textList = text.split(QRegExp("(\r+)"), QString::SkipEmptyParts);
+ QString final_str;
+ for (int line = 0; line<textList.size(); line++)
+ {
+ final_str += textList[line];
+ }
+ QStringList lines = final_str.split(QRegExp("(\n+)"), QString::SkipEmptyParts);
+ for (int line = 0; line < lines.size(); ++line)
+ {
+ QStandardItem *item = new QStandardItem(lines[line]);
+ item->setData(level, ConsoleModel::LogLevelRole);
+ item->setData(node.data()->userdata, ConsoleModel::UUIDRole);
+ addNewConsoleItem(item);
+ }
+ }
+}
+
+void ConsoleWindow::addNewConsoleItem(QStandardItem *item)
+{
+ QSettings settings;
+ settings.beginGroup("Console");
+ QPalette palette = settings.value(QString("log-level-%1-palette").arg(item->data(Qt::UserRole).toInt())).value<QPalette>();
+ QFont font = settings.value(QString("log-level-%1-font").arg(item->data(Qt::UserRole).toInt())).value<QFont>();
+ item->setBackground(palette.base());
+ item->setForeground(palette.text());
+ item->setFont(font);
+ sourceModel->appendRow(item);
+}
</ins></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolsconsolewindowh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/consolewindow.h (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/consolewindow.h         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/consolewindow.h        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+#ifndef CONSOLEWINDOW_H
+#define CONSOLEWINDOW_H
+
+#include <QtGui>
+#include "fshost.h"
+#include "sortfilterproxymodel.h"
+
+namespace Ui {
+ class ConsoleWindow;
+}
+
+class ConsoleWindow : public QMainWindow {
+ Q_OBJECT
+public:
+ ConsoleWindow(QWidget *parent = 0);
+ ~ConsoleWindow();
+
+protected:
+ void changeEvent(QEvent *e);
+
+/*public slots:
+ void clearConsoleContents();
+ void saveLogToFile();
+ void pastebinLog();
+ void filterLogUUID(QString);
+ void findText();*/
+
+private slots:
+ void setConditionalScroll();
+ void conditionalScroll();
+ /*void filterClear();
+ void filterStringChanged();*/
+ void loggerHandler(QSharedPointer<switch_log_node_t> node, switch_log_level_t level);
+ void addNewConsoleItem(QStandardItem *item);
+ void cmdSendClicked();
+ void lineCmdChanged(QString);
+ /*void reverseFilterChecked();*/
+ void filterModelLogLevel(int);
+
+
+private:
+ Ui::ConsoleWindow *ui;
+ ConsoleModel *sourceModel;
+ QModelIndexList foundItems;
+ SortFilterProxyModel *model;
+ /*pastebinDialog *_pastebinDlg;
+ FindDialog *_findDialog;*/
+ bool findNext;
+ bool autoScroll;
+ QSignalMapper *_levelFilter;
+
+ /*void readSettings();
+ void writeSettings();*/
+};
+
+#endif // CONSOLEWINDOW_H
</ins></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolsconsolewindowui"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/consolewindow.ui (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/consolewindow.ui         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/consolewindow.ui        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,466 @@
</span><ins>+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConsoleWindow</class>
+ <widget class="QMainWindow" name="ConsoleWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>696</width>
+ <height>559</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>118</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Filter</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLineEdit" name="lineFilter">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="filterSyntaxComboBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContentsOnFirstShow</enum>
+ </property>
+ <item>
+ <property name="text">
+ <string>Regular Expression</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Wildcard</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fixed String</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>UUID</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnFilterClear">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Clear</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="filterCaseSensitivityCheckBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Case sensitive filter</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="filterReverseCheckBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Reverse filter</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lblWarningMsg">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>358</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QWidget" name="layoutWidget_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMaximumSize</enum>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Log Level Filter</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="checkEmerg">
+ <property name="text">
+ <string>Console</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkAlert">
+ <property name="text">
+ <string>Alert</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkCrit">
+ <property name="text">
+ <string>Critical</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkError">
+ <property name="text">
+ <string>Error</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkWarn">
+ <property name="text">
+ <string>Warning</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkNotice">
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkInfo">
+ <property name="text">
+ <string>Info</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkDebug">
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>18</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Loglevel</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QComboBox" name="comboLogLevel">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="currentIndex">
+ <number>7</number>
+ </property>
+ <item>
+ <property name="text">
+ <string>Console</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Alert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Critical</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Error</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Warning</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Info</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QTableView" name="consoleListView">
+ <property name="autoScroll">
+ <bool>false</bool>
+ </property>
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="tabKeyNavigation">
+ <bool>false</bool>
+ </property>
+ <property name="showDropIndicator" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="dragDropOverwriteMode">
+ <bool>false</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <property name="horizontalScrollMode">
+ <enum>QAbstractItemView::ScrollPerPixel</enum>
+ </property>
+ <property name="showGrid">
+ <bool>false</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderDefaultSectionSize">
+ <number>20</number>
+ </attribute>
+ <attribute name="verticalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderStretchLastSection">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="lineCmd">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>26</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnSend">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>28</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>85</width>
+ <height>28</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Send</string>
+ </property>
+ <property name="shortcut">
+ <string>Return</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>696</width>
+ <height>24</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
</ins></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolssortfilterproxymodelcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.cpp (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.cpp         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.cpp        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+#include <QtGui>
+#include "sortfilterproxymodel.h"
+
+ConsoleModel::ConsoleModel (QObject *parent)
+ : QAbstractTableModel(parent)
+{
+ QSettings settings;
+ batchSize = settings.value("Console/batchSize", 200).toInt();
+ insertionTimer = new QBasicTimer;
+ insertionTimer->start(0, this);
+}
+
+int ConsoleModel::rowCount ( const QModelIndex & parent ) const
+{
+ if (parent.isValid())
+ return 0;
+ return _listDisplayModel.count();
+}
+
+int ConsoleModel::columnCount ( const QModelIndex & /*parent*/ ) const
+{
+ return 1;
+}
+
+QVariant ConsoleModel::data ( const QModelIndex & index, int role ) const
+{
+ if (!index.isValid())
+ return QVariant();
+ return _listDisplayModel.at(index.row())->data(role);
+}
+
+void ConsoleModel::clear()
+{
+ _listDisplayModel.clear();
+ reset();
+}
+
+void ConsoleModel::appendRow ( QStandardItem* item )
+{
+ _listInsertModel.append(item);
+ insertionTimer->start(0, this);
+}
+
+void ConsoleModel::timerEvent(QTimerEvent *e)
+{
+
+ if (e->timerId() == insertionTimer->timerId())
+ {
+ if (!_listInsertModel.isEmpty())
+ {
+ int inserted_items = 0;
+ int toBeInserted = 0;
+ if (_listInsertModel.size() < batchSize)
+ {
+ toBeInserted = _listInsertModel.size() - 1;
+ } else {
+ toBeInserted = batchSize - 1;
+ }
+ emit beforeInserting();
+ beginInsertRows( QModelIndex(), _listDisplayModel.size(), _listDisplayModel.size() + toBeInserted );
+ while( !_listInsertModel.isEmpty() && inserted_items <= batchSize)
+ {
+ _listDisplayModel.append(_listInsertModel.takeFirst());
+ inserted_items++;
+ }
+ endInsertRows();
+ emit afterInserting();
+ } else {
+ insertionTimer->stop();
+ }
+ }
+}
+
+SortFilterProxyModel::SortFilterProxyModel(QObject *parent)
+ : QSortFilterProxyModel(parent)
+{
+ reverseFlag = false;
+ for(int i = 0; i < 8; i++)
+ loglevels.insert(i, true);
+}
+
+void SortFilterProxyModel::toggleReverseFlag()
+{
+ reverseFlag = !reverseFlag;
+ invalidateFilter();
+}
+
+void SortFilterProxyModel::setLogLevelFilter(int level)
+{
+ loglevels.replace(level, loglevels.value(level) == false);
+ // Let us filter
+ invalidateFilter();
+}
+
+void SortFilterProxyModel::setUUIDFilterLog(QString uuid)
+{
+ _uuid = uuid;
+ invalidateFilter();
+}
+
+bool SortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ QModelIndex index0 = sourceModel()->index(source_row, 0, source_parent);
+ bool uuidMatch = true;
+
+ if (!_uuid.isEmpty())
+ uuidMatch = (sourceModel()->data(index0, ConsoleModel::UUIDRole).toString() == _uuid);
+
+ bool res = (loglevels.value(sourceModel()->data(index0, Qt::UserRole).toInt()) == true
+ && sourceModel()->data(index0).toString().contains(filterRegExp())
+ && uuidMatch);
+ if (reverseFlag)
+ return !res;
+ else
+ return res;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolssortfilterproxymodelh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.h (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.h         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/sortfilterproxymodel.h        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,97 @@
</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) freeswitch.org>
+ *
+ */
+#ifndef SORTFILTERPROXYMODEL_H
+#define SORTFILTERPROXYMODEL_H
+
+#include <QSortFilterProxyModel>
+#include <QAbstractTableModel>
+#include <QVector>
+#include <QList>
+
+class QBasicTimer;
+class QStandardItem;
+class QScrollBar;
+
+class ConsoleModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ ConsoleModel (QObject *parent = 0);
+ int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
+ int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
+ QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
+ void appendRow ( QStandardItem* item );
+ void clear();
+ QList<QStandardItem *> modelData() { return _listDisplayModel; }
+
+ enum {
+ LogLevelRole = Qt::UserRole,
+ UUIDRole
+ };
+signals:
+ void beforeInserting();
+ void afterInserting();
+protected:
+ void timerEvent(QTimerEvent *);
+private:
+ QList<QStandardItem *> _listDisplayModel;
+ QList<QStandardItem *> _listInsertModel;
+ int batchSize;
+ QBasicTimer *insertionTimer;
+};
+
+class SortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+ SortFilterProxyModel(QObject *parent = 0);
+ void setLogLevelFilter(int level);
+ void setUUIDFilterLog(QString uuid);
+ void toggleReverseFlag();
+
+protected:
+ bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+
+private:
+ QVector<bool> loglevels;
+ QString _uuid;
+ bool reverseFlag;
+};
+
+#endif // SORTFILTERPROXYMODEL_H
</ins></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolsstatedebugdialogcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/statedebugdialog.cpp (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/statedebugdialog.cpp         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/statedebugdialog.cpp        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+#include "statedebugdialog.h"
+#include "ui_statedebugdialog.h"
+
+StateDebugDialog::StateDebugDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::StateDebugDialog)
+{
+ ui->setupUi(this);
+ connect(&g_FSHost, SIGNAL(newEvent(QSharedPointer<switch_event_t>)), this, SLOT(newEvent(QSharedPointer<switch_event_t>)));
+ connect(ui->listUUID, SIGNAL(itemSelectionChanged()), this, SLOT(currentUuidChanged()));
+ connect(ui->listEvents, SIGNAL(itemSelectionChanged()), this, SLOT(currentEventsChanged()));
+}
+
+StateDebugDialog::~StateDebugDialog()
+{
+ delete ui;
+}
+
+void StateDebugDialog::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+void StateDebugDialog::newEvent(QSharedPointer<switch_event_t>event)
+{
+ /* We don't want to keep track of events that are not calls at this moment */
+ if (QString(switch_event_get_header_nil(event.data(), "Unique-ID")).isEmpty())
+ return;
+
+ QString uuid(switch_event_get_header_nil(event.data(), "Unique-ID"));
+
+ if (!_events.contains(uuid))
+ {
+ QList<QSharedPointer<switch_event_t> > tmpListEvents;
+ tmpListEvents.append(event);
+ _events.insert(uuid, tmpListEvents);
+ ui->listUUID->addItem(new QListWidgetItem(uuid));
+ }
+ else
+ {
+ QList<QSharedPointer<switch_event_t> > tmpListEvents = _events.value(uuid);
+ tmpListEvents.append(event);
+ _events.insert(uuid, tmpListEvents);
+ }
+}
+
+void StateDebugDialog::currentUuidChanged()
+{;
+ ui->listEvents->clear();
+ ui->listDetails->clear();
+ QString uuid = ui->listUUID->currentItem()->text();
+ foreach(QSharedPointer<switch_event_t> e, _events.value(uuid))
+ {
+ ui->listEvents->addItem(new QListWidgetItem(switch_event_name(e.data()->event_id)));
+ }
+}
+
+void StateDebugDialog::currentEventsChanged()
+{
+ ui->listDetails->clear();
+ int r = ui->listEvents->currentRow();
+ QString uuid = ui->listUUID->currentItem()->text();
+ QList<QSharedPointer<switch_event_t> > tmpListEvents = _events.value(uuid);
+ QSharedPointer<switch_event_t> e = tmpListEvents.at(r);
+ for(switch_event_header_t* h = e.data()->headers; h != e.data()->last_header; h = h->next)
+ {
+ ui->listDetails->addItem(new QListWidgetItem(QString("%1 = %2").arg(h->name, h->value)));
+ }
+}
</ins></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolsstatedebugdialogh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/statedebugdialog.h (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/statedebugdialog.h         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/statedebugdialog.h        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+#ifndef STATEDEBUGDIALOG_H
+#define STATEDEBUGDIALOG_H
+
+#include <QtGui>
+#include "fshost.h"
+
+namespace Ui {
+ class StateDebugDialog;
+}
+
+class StateDebugDialog : public QDialog {
+ Q_OBJECT
+public:
+ StateDebugDialog(QWidget *parent = 0);
+ ~StateDebugDialog();
+
+private slots:
+ void newEvent(QSharedPointer<switch_event_t> event);
+ void currentUuidChanged();
+ void currentEventsChanged();
+
+protected:
+ void changeEvent(QEvent *e);
+
+private:
+ Ui::StateDebugDialog *ui;
+ QHash<QString, QList<QSharedPointer<switch_event_t> > > _events;
+};
+
+#endif // STATEDEBUGDIALOG_H
</ins></span></pre></div>
<a id="freeswitchtrunkfscommdebugtoolsstatedebugdialogui"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/fscomm/debugtools/statedebugdialog.ui (0 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/debugtools/statedebugdialog.ui         (rev 0)
+++ freeswitch/trunk/fscomm/debugtools/statedebugdialog.ui        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>StateDebugDialog</class>
+ <widget class="QDialog" name="StateDebugDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>804</width>
+ <height>235</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Debug Events</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>UUID</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listUUID"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>EVENTS</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listEvents"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>DETAILS</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listDetails"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
</ins></span></pre></div>
<a id="freeswitchtrunkfscommfshostcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/fshost.cpp (17231 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/fshost.cpp        2010-04-06 20:03:57 UTC (rev 17231)
+++ freeswitch/trunk/fscomm/fshost.cpp        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -43,7 +43,10 @@
</span><span class="cx"> switch_core_set_globals();
</span><span class="cx">
</span><span class="cx"> qRegisterMetaType<QSharedPointer<Call> >("QSharedPointer<Call>");
</span><del>- qRegisterMetaType<QSharedPointer<Call> >("QSharedPointer<Channel>");
</del><ins>+ qRegisterMetaType<QSharedPointer<switch_event_t> >("QSharedPointer<switch_event_t>");
+ qRegisterMetaType<QSharedPointer<switch_log_node_t> >("QSharedPointer<switch_log_node_t>");
+ qRegisterMetaType<switch_log_level_t>("switch_log_level_t");
+ qRegisterMetaType<QSharedPointer<Channel> >("QSharedPointer<Channel>");
</ins><span class="cx"> qRegisterMetaType<QSharedPointer<Account> >("QSharedPointer<Account>");
</span><span class="cx">
</span><span class="cx"> connect(this, SIGNAL(loadedModule(QString,QString)), this, SLOT(minimalModuleLoaded(QString,QString)));
</span><span class="lines">@@ -115,6 +118,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void FSHost::generalLoggerHandler(QSharedPointer<switch_log_node_t>node, switch_log_level_t level)
+{
+ emit eventLog(node, level);
+}
+
</ins><span class="cx"> void FSHost::run(void)
</span><span class="cx"> {
</span><span class="cx"> switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
</span><span class="lines">@@ -150,6 +158,7 @@
</span><span class="cx"> emit coreLoadingError(err);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ switch_log_bind_logger(loggerHandler, SWITCH_LOG_DEBUG, SWITCH_FALSE);
</ins><span class="cx"> emit ready();
</span><span class="cx">
</span><span class="cx"> /* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set
</span><span class="lines">@@ -172,6 +181,8 @@
</span><span class="cx"> {
</span><span class="cx"> QString uuid = switch_event_get_header_nil(event.data(), "Unique-ID");
</span><span class="cx">
</span><ins>+ emit newEvent(event);
+
</ins><span class="cx"> switch(event.data()->event_id) {
</span><span class="cx"> case SWITCH_EVENT_CHANNEL_CREATE: /*1A - 17B*/
</span><span class="cx"> {
</span></span></pre></div>
<a id="freeswitchtrunkfscommfshosth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/fshost.h (17231 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/fshost.h        2010-04-06 20:03:57 UTC (rev 17231)
+++ freeswitch/trunk/fscomm/fshost.h        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> explicit FSHost(QObject *parent = 0);
</span><span class="cx"> switch_status_t sendCmd(const char *cmd, const char *args, QString *res);
</span><span class="cx"> void generalEventHandler(QSharedPointer<switch_event_t>event);
</span><ins>+ void generalLoggerHandler(QSharedPointer<switch_log_node_t>node, switch_log_level_t level);
</ins><span class="cx"> QSharedPointer<Call> getCallByUUID(QString uuid) { return _active_calls.value(uuid); }
</span><span class="cx"> QSharedPointer<Call> getCurrentActiveCall();
</span><span class="cx"> QList<QSharedPointer<Account> > getAccounts() { return _accounts.values(); }
</span><span class="lines">@@ -64,6 +65,11 @@
</span><span class="cx"> void loadedModule(QString, QString);
</span><span class="cx"> void ready(void);
</span><span class="cx">
</span><ins>+
+ /* Logging signals */
+ void eventLog(QSharedPointer<switch_log_node_t>, switch_log_level_t);
+ void newEvent(QSharedPointer<switch_event_t>);
+
</ins><span class="cx"> /* Call signals */
</span><span class="cx"> void ringing(QSharedPointer<Call>);
</span><span class="cx"> void answered(QSharedPointer<Call>);
</span><span class="lines">@@ -121,7 +127,7 @@
</span><span class="cx"> /*
</span><span class="cx"> Used to match callback from fs core. We dup the event and call the class
</span><span class="cx"> method callback to make use of the signal/slot infrastructure.
</span><del>-*/
</del><ins>+ */
</ins><span class="cx"> static void eventHandlerCallback(switch_event_t *event)
</span><span class="cx"> {
</span><span class="cx"> switch_event_t *clone = NULL;
</span><span class="lines">@@ -131,4 +137,15 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/*
+ Used to propagate logs on the application
+ */
+static switch_status_t loggerHandler(const switch_log_node_t *node, switch_log_level_t level)
+{
+ switch_log_node_t *clone = switch_log_node_dup(node);
+ QSharedPointer<switch_log_node_t> l(clone);
+ g_FSHost.generalLoggerHandler(l, level);
+ return SWITCH_STATUS_SUCCESS;
+}
+
</ins><span class="cx"> #endif // FSHOST_H
</span></span></pre></div>
<a id="freeswitchtrunkfscommmainwindowcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/mainwindow.cpp (17231 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/mainwindow.cpp        2010-04-06 20:03:57 UTC (rev 17231)
+++ freeswitch/trunk/fscomm/mainwindow.cpp        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -36,7 +36,10 @@
</span><span class="cx"> MainWindow::MainWindow(QWidget *parent) :
</span><span class="cx"> QMainWindow(parent),
</span><span class="cx"> ui(new Ui::MainWindow),
</span><del>- preferences(NULL)
</del><ins>+ preferences(NULL),
+ _consoleWindow(NULL),
+ _stateDebugDialog(NULL)
+
</ins><span class="cx"> {
</span><span class="cx"> ui->setupUi(this);
</span><span class="cx">
</span><span class="lines">@@ -100,6 +103,8 @@
</span><span class="cx"> connect(ui->tableCalls, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(callTableDoubleClick(QTableWidgetItem*)));
</span><span class="cx"> connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefTriggered()));
</span><span class="cx"> connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close()));
</span><ins>+ connect(ui->actionConsole, SIGNAL(triggered()), this, SLOT(debugConsoleTriggered()));
+ connect(ui->actionEvents, SIGNAL(triggered()), this, SLOT(debugEventsTriggered()));
</ins><span class="cx"> connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
</span><span class="cx"> connect(ui->actionSetDefaultAccount, SIGNAL(triggered(bool)), this, SLOT(setDefaultAccount()));
</span><span class="cx"> connect(sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayActivated(QSystemTrayIcon::ActivationReason)));
</span><span class="lines">@@ -151,6 +156,28 @@
</span><span class="cx"> settings.endGroup();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MainWindow::debugEventsTriggered()
+{
+ if (!_stateDebugDialog)
+ _stateDebugDialog = new StateDebugDialog();
+
+ _stateDebugDialog->raise();
+ _stateDebugDialog->show();
+ _stateDebugDialog->activateWindow();
+}
+
+void MainWindow::debugConsoleTriggered()
+{
+
+ if (!_consoleWindow)
+ _consoleWindow = new ConsoleWindow();
+
+ _consoleWindow->raise();
+ _consoleWindow->show();
+ _consoleWindow->activateWindow();
+
+}
+
</ins><span class="cx"> void MainWindow::prefTriggered()
</span><span class="cx"> {
</span><span class="cx"> if (!preferences)
</span></span></pre></div>
<a id="freeswitchtrunkfscommmainwindowh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/mainwindow.h (17231 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/mainwindow.h        2010-04-06 20:03:57 UTC (rev 17231)
+++ freeswitch/trunk/fscomm/mainwindow.h        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -40,6 +40,8 @@
</span><span class="cx"> #include <call.h>
</span><span class="cx"> #include <account.h>
</span><span class="cx"> #include "preferences/prefdialog.h"
</span><ins>+#include "debugtools/consolewindow.h"
+#include "debugtools/statedebugdialog.h"
</ins><span class="cx">
</span><span class="cx"> namespace Ui {
</span><span class="cx"> class MainWindow;
</span><span class="lines">@@ -80,11 +82,15 @@
</span><span class="cx"> void accountStateChanged(QSharedPointer<Account>);
</span><span class="cx"> void sysTrayActivated(QSystemTrayIcon::ActivationReason reason);
</span><span class="cx"> void updateCallTimers();
</span><ins>+ void debugConsoleTriggered();
+ void debugEventsTriggered();
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> Ui::MainWindow *ui;
</span><span class="cx"> QSignalMapper *dialpadMapper;
</span><span class="cx"> PrefDialog *preferences;
</span><ins>+ ConsoleWindow *_consoleWindow;
+ StateDebugDialog * _stateDebugDialog;
</ins><span class="cx"> QSystemTrayIcon *sysTray;
</span><span class="cx"> QTimer *callTimer;
</span><span class="cx"> };
</span></span></pre></div>
<a id="freeswitchtrunkfscommmainwindowui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/fscomm/mainwindow.ui (17231 => 17232)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/fscomm/mainwindow.ui        2010-04-06 20:03:57 UTC (rev 17231)
+++ freeswitch/trunk/fscomm/mainwindow.ui        2010-04-07 05:05:03 UTC (rev 17232)
</span><span class="lines">@@ -375,7 +375,21 @@
</span><span class="cx"> </property>
</span><span class="cx"> <addaction name="actionAbout"/>
</span><span class="cx"> </widget>
</span><ins>+ <widget class="QMenu" name="menuTools">
+ <property name="title">
+ <string>&amp;Tools</string>
+ </property>
+ <widget class="QMenu" name="menuDebug">
+ <property name="title">
+ <string>&amp;Debug</string>
+ </property>
+ <addaction name="actionConsole"/>
+ <addaction name="actionEvents"/>
+ </widget>
+ <addaction name="menuDebug"/>
+ </widget>
</ins><span class="cx"> <addaction name="menu_File"/>
</span><ins>+ <addaction name="menuTools"/>
</ins><span class="cx"> <addaction name="menuHelp"/>
</span><span class="cx"> </widget>
</span><span class="cx"> <widget class="QToolBar" name="mainToolBar">
</span><span class="lines">@@ -410,6 +424,16 @@
</span><span class="cx"> <string>Set the default account for dialing out.</string>
</span><span class="cx"> </property>
</span><span class="cx"> </action>
</span><ins>+ <action name="actionConsole">
+ <property name="text">
+ <string>Console</string>
+ </property>
+ </action>
+ <action name="actionEvents">
+ <property name="text">
+ <string>Events</string>
+ </property>
+ </action>
</ins><span class="cx"> </widget>
</span><span class="cx"> <layoutdefault spacing="6" margin="11"/>
</span><span class="cx"> <resources/>
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>