<!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][14582] </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=14582">14582</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-08-21 00:41:14 -0500 (Fri, 21 Aug 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Change the model used on the console listview. Make loglevel changeable.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectioncpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectionh">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcinterfacesmonitorstatemachinecpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgeth">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetui">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginsortfilterproxymodelcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginsortfilterproxymodelh">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectioncpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -279,7 +279,6 @@
</span><span class="cx"> if (esl_connect(handle, _host->toAscii(), _port->toInt(), _pass->toAscii()) == ESL_SUCCESS)
</span><span class="cx"> {
</span><span class="cx"> events("plain", "all");
</span><del>- send("log 7");
</del><span class="cx"> emit connected();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfaceseslconnectionh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -75,7 +75,6 @@
</span><span class="cx"> //int sendEvent(ESLevent *send_me);
</span><span class="cx"> ESLevent *recvEvent();
</span><span class="cx"> ESLevent *recvEventTimed(int ms);
</span><del>- bool setConsoleLogLevel(int);
</del><span class="cx"> /*void api(QString cmd);*/
</span><span class="cx"> ESLevent* bgapi(QString cmd);
</span><span class="cx"> void send(QString cmd);
</span><span class="lines">@@ -94,6 +93,7 @@
</span><span class="cx"> int setEventLock(const char *val);
</span><span class="cx"> int disconnect(void);
</span><span class="cx"> QString getName();
</span><ins>+ bool setConsoleLogLevel(int);
</ins><span class="cx"> signals:
</span><span class="cx"> void connected(void);
</span><span class="cx"> void disconnected(void);
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcinterfacesmonitorstatemachinecpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/monitorstatemachine.cpp        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -165,9 +165,15 @@
</span><span class="cx"> Event *event = new Event(e._headers);
</span><span class="cx"> Channel * chan = _channels.value(event_uuid, NULL);
</span><span class="cx"> if (!chan)
</span><ins>+ {
</ins><span class="cx"> chan = _inactive_channels.value(event_uuid, NULL);
</span><ins>+ return;
+ }
</ins><span class="cx"> if (!chan)
</span><ins>+ {
</ins><span class="cx"> qDebug() << QString("Event %1 has no uuid.").arg(e.getType());
</span><ins>+ return;
+ }
</ins><span class="cx"> chan->addEvent(event);
</span><span class="cx"> emit newEvent(chan, event);
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -12,12 +12,17 @@
</span><span class="cx"> findNext(false)
</span><span class="cx"> {
</span><span class="cx"> m_ui->setupUi(this);
</span><del>- sourceModel = new QStandardItemModel(this);
</del><ins>+ sourceModel = new ConsoleModel(this);
</ins><span class="cx"> model = new SortFilterProxyModel(this);
</span><span class="cx"> model->setSourceModel(sourceModel);
</span><span class="cx"> model->setFilterKeyColumn(0);
</span><span class="cx"> m_ui->consoleListView->setModel(model);
</span><span class="cx">
</span><ins>+ QObject::connect(sourceModel, SIGNAL(layoutAboutToBeChanged()),
+ this, SLOT(setConditionalScroll()));
+ QObject::connect(sourceModel, SIGNAL(layoutChanged()),
+ this, SLOT(conditionalScroll()));
+
</ins><span class="cx"> QObject::connect(m_ui->btnSend, SIGNAL(clicked()),
</span><span class="cx"> this, SLOT(cmdSendClicked()));
</span><span class="cx"> QObject::connect(m_ui->lineCmd, SIGNAL(textChanged(QString)),
</span><span class="lines">@@ -36,6 +41,8 @@
</span><span class="cx"> this, SLOT(checkInfo(bool)));
</span><span class="cx"> QObject::connect(m_ui->checkDebug, SIGNAL(clicked(bool)),
</span><span class="cx"> this, SLOT(checkDebug(bool)));
</span><ins>+ QObject::connect(m_ui->comboLogLevel, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(changeLogLevel(int)));
</ins><span class="cx">
</span><span class="cx"> QObject::connect(m_ui->btnFilterClear, SIGNAL(clicked()),
</span><span class="cx"> this, SLOT(filterClear()));
</span><span class="lines">@@ -61,17 +68,25 @@
</span><span class="cx"> msm = new MonitorStateMachine();
</span><span class="cx"> msm->addESLconnection(esl);
</span><span class="cx">
</span><del>- scrollTimer = new QBasicTimer;
- scrollTimer->start(0, this);
- /* Number of items to be inserted */
- batch = 40;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ConsoleTabWidget::~ConsoleTabWidget()
</span><span class="cx"> {
</span><ins>+ writeSettings();
</ins><span class="cx"> delete m_ui;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ConsoleTabWidget::setConditionalScroll()
+{
+ autoScroll = (m_ui->consoleListView->verticalScrollBar()->maximum() == m_ui->consoleListView->verticalScrollBar()->value());
+}
+
+void ConsoleTabWidget::conditionalScroll()
+{
+ if (autoScroll)
+ m_ui->consoleListView->scrollToBottom();
+}
+
</ins><span class="cx"> void ConsoleTabWidget::clearConsoleContents()
</span><span class="cx"> {
</span><span class="cx"> sourceModel->clear();
</span><span class="lines">@@ -89,25 +104,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ConsoleTabWidget::timerEvent(QTimerEvent *e)
-{
- bool scroll = false;
- if (e->timerId() == scrollTimer->timerId())
- {
- if (m_ui->consoleListView->verticalScrollBar()->value() == m_ui->consoleListView->verticalScrollBar()->maximum())
- scroll = true;
-
- int inserted_items = 0;
- while( !_list_items.isEmpty() && inserted_items < batch)
- {
- sourceModel->appendRow(_list_items.takeFirst());
- inserted_items++;
- }
- if (scroll)
- m_ui->consoleListView->scrollToBottom();
- }
-}
-
</del><span class="cx"> void ConsoleTabWidget::filterClear()
</span><span class="cx"> {
</span><span class="cx"> m_ui->lineFilter->clear();
</span><span class="lines">@@ -131,15 +127,18 @@
</span><span class="cx"> {
</span><span class="cx"> m_ui->btnSend->setEnabled(true);
</span><span class="cx"> m_ui->lineCmd->setEnabled(true);
</span><ins>+ m_ui->comboLogLevel->setEnabled(true);
</ins><span class="cx"> QStandardItem *item = new QStandardItem(tr("Connected!"));
</span><span class="cx"> item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
</span><span class="cx"> addNewConsoleItem(item);
</span><ins>+ readSettings();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ConsoleTabWidget::disconnected()
</span><span class="cx"> {
</span><span class="cx"> m_ui->btnSend->setEnabled(false);
</span><span class="cx"> m_ui->lineCmd->setEnabled(false);
</span><ins>+ m_ui->comboLogLevel->setEnabled(false);
</ins><span class="cx"> QStandardItem *item = new QStandardItem(tr("Disconnected!"));
</span><span class="cx"> item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
</span><span class="cx"> addNewConsoleItem(item);
</span><span class="lines">@@ -149,6 +148,7 @@
</span><span class="cx"> {
</span><span class="cx"> m_ui->btnSend->setEnabled(false);
</span><span class="cx"> m_ui->lineCmd->setEnabled(false);
</span><ins>+ m_ui->comboLogLevel->setEnabled(false);
</ins><span class="cx"> QStandardItem *item = new QStandardItem(tr("Connection Failed! Reason: %1").arg(reason));
</span><span class="cx"> item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
</span><span class="cx"> addNewConsoleItem(item);
</span><span class="lines">@@ -175,7 +175,6 @@
</span><span class="cx"> addNewConsoleItem(item);
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- //delete event;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ConsoleTabWidget::addNewConsoleItem(QStandardItem *item)
</span><span class="lines">@@ -185,8 +184,7 @@
</span><span class="cx"> QPalette palette = settings.value(QString("log-level-%1-palette").arg(item->data(Qt::UserRole).toInt())).value<QPalette>();
</span><span class="cx"> item->setBackground(palette.base());
</span><span class="cx"> item->setForeground(palette.text());
</span><del>- //sourceModel->appendRow(item);
- _list_items.append(item);
</del><ins>+ sourceModel->appendRow(item);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ConsoleTabWidget::cmdSendClicked()
</span><span class="lines">@@ -249,3 +247,53 @@
</span><span class="cx"> {
</span><span class="cx"> model->setLogLevelFilter(ESL_LOG_LEVEL_DEBUG, state);
</span><span class="cx"> }
</span><ins>+
+void ConsoleTabWidget::changeLogLevel(int level)
+{
+ if (esl->setConsoleLogLevel(level))
+ {
+ currentLogLevel = level;
+ QStandardItem *item = new QStandardItem(QString("Changed loglevel to %1").arg(level));
+ item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
+ addNewConsoleItem(item);
+ if (level > 4)
+ {
+ m_ui->lblWarningMsg->show();
+ m_ui->lblWarningMsg->setText("High loglevels connected to high load servers can cause network consgestion!");
+ m_ui->lblWarningMsg->setAutoFillBackground(true);
+ m_ui->lblWarningMsg->setPalette(QPalette(Qt::yellow));
+ QTimer::singleShot(5000, m_ui->lblWarningMsg, SLOT(hide()));
+ }
+ }
+ else
+ {
+ currentLogLevel = level;
+ QStandardItem *item = new QStandardItem(QString("Could not change loglevel to %1").arg(level));
+ item->setData(ESL_LOG_LEVEL_ALERT, Qt::UserRole);
+ m_ui->comboLogLevel->blockSignals(true);
+ m_ui->comboLogLevel->setCurrentIndex(currentLogLevel);
+ m_ui->comboLogLevel->blockSignals(false);
+ }
+}
+
+void ConsoleTabWidget::readSettings()
+{
+ QSettings settings;
+ settings.beginGroup("Console");
+ settings.beginGroup(esl->getName());
+ /* Set the saved loglevel */
+ m_ui->comboLogLevel->setCurrentIndex(settings.value("Loglevel", 0).toInt());
+ settings.endGroup();
+ settings.endGroup();
+}
+
+void ConsoleTabWidget::writeSettings()
+{
+ QSettings settings;
+ settings.beginGroup("Console");
+ settings.beginGroup(esl->getName());
+ /* Save the current loglevel */
+ settings.setValue("Loglevel", currentLogLevel);
+ settings.endGroup();
+ settings.endGroup();
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgeth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -28,9 +28,9 @@
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> void changeEvent(QEvent *e);
</span><del>- void timerEvent(QTimerEvent *);
</del><span class="cx">
</span><span class="cx"> private slots:
</span><ins>+ void setConditionalScroll();
</ins><span class="cx"> void conditionalScroll();
</span><span class="cx"> void filterClear();
</span><span class="cx"> void filterStringChanged();
</span><span class="lines">@@ -48,20 +48,22 @@
</span><span class="cx"> void checkNotice(bool);
</span><span class="cx"> void checkInfo(bool);
</span><span class="cx"> void checkDebug(bool);
</span><ins>+ void changeLogLevel(int);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> Ui::ConsoleTabWidget *m_ui;
</span><del>- QStandardItemModel *sourceModel;
</del><ins>+ ConsoleModel *sourceModel;
</ins><span class="cx"> QModelIndexList foundItems;
</span><span class="cx"> SortFilterProxyModel *model;
</span><del>- QBasicTimer *scrollTimer;
</del><span class="cx"> ESLconnection *esl;
</span><span class="cx"> MonitorStateMachine *msm;
</span><span class="cx"> RealtimeStatisticsDialog *_rtStatsDlg;
</span><span class="cx"> bool findNext;
</span><del>- QList<QStandardItem *> _list_items;
- int batch;
</del><ins>+ bool autoScroll;
+ int currentLogLevel;
</ins><span class="cx">
</span><ins>+ void readSettings();
+ void writeSettings();
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // CONSOLETABWIDGET_H
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -6,16 +6,22 @@
</span><span class="cx"> <rect>
</span><span class="cx"> <x>0</x>
</span><span class="cx"> <y>0</y>
</span><del>- <width>859</width>
- <height>557</height>
</del><ins>+ <width>657</width>
+ <height>525</height>
</ins><span class="cx"> </rect>
</span><span class="cx"> </property>
</span><span class="cx"> <property name="windowTitle">
</span><span class="cx"> <string>Form</string>
</span><span class="cx"> </property>
</span><del>- <layout class="QVBoxLayout" name="verticalLayout_6">
</del><ins>+ <layout class="QVBoxLayout" name="verticalLayout_5">
</ins><span class="cx"> <item>
</span><span class="cx"> <widget class="QGroupBox" name="groupBox_2">
</span><ins>+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>97</height>
+ </size>
+ </property>
</ins><span class="cx"> <property name="title">
</span><span class="cx"> <string>Filter</string>
</span><span class="cx"> </property>
</span><span class="lines">@@ -78,6 +84,13 @@
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><span class="cx"> <item>
</span><ins>+ <widget class="QLabel" name="lblWarningMsg">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
</ins><span class="cx"> <spacer name="horizontalSpacer">
</span><span class="cx"> <property name="orientation">
</span><span class="cx"> <enum>Qt::Horizontal</enum>
</span><span class="lines">@@ -96,24 +109,150 @@
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><span class="cx"> <item>
</span><del>- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QListView" name="consoleListView">
- <property name="editTriggers">
- <set>QAbstractItemView::NoEditTriggers</set>
</del><ins>+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QListView" name="consoleListView">
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <property name="layoutMode">
+ <enum>QListView::SinglePass</enum>
+ </property>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMaximumSize</enum>
</ins><span class="cx"> </property>
</span><del>- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="layoutMode">
- <enum>QListView::SinglePass</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
</del><span class="cx"> <item>
</span><del>- <widget class="QGroupBox" name="groupBox">
</del><ins>+ <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>
+ </layout>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
</ins><span class="cx"> <property name="maximumSize">
</span><span class="cx"> <size>
</span><span class="cx"> <width>120</width>
</span><span class="lines">@@ -121,115 +260,71 @@
</span><span class="cx"> </size>
</span><span class="cx"> </property>
</span><span class="cx"> <property name="title">
</span><del>- <string>Log Level</string>
</del><ins>+ <string>Loglevel</string>
</ins><span class="cx"> </property>
</span><del>- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="checkEmerg">
- <property name="text">
- <string>Console</string>
</del><ins>+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QComboBox" name="comboLogLevel">
+ <property name="enabled">
+ <bool>false</bool>
</ins><span class="cx"> </property>
</span><del>- <property name="checked">
- <bool>true</bool>
</del><ins>+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</ins><span class="cx"> </property>
</span><del>- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="checkAlert">
- <property name="text">
- <string>Alert</string>
</del><ins>+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
</ins><span class="cx"> </property>
</span><del>- <property name="checked">
- <bool>true</bool>
- </property>
</del><ins>+ <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>
</ins><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><del>- <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>
</del><span class="cx"> </layout>
</span><span class="cx"> </widget>
</span><span class="cx"> </item>
</span><del>- <item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
</del><span class="cx"> </layout>
</span><del>- </item>
- </layout>
</del><ins>+ </widget>
+ </widget>
</ins><span class="cx"> </item>
</span><span class="cx"> <item>
</span><span class="cx"> <layout class="QHBoxLayout" name="horizontalLayout">
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginrealtimestatisticsdialogcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/realtimestatisticsdialog.cpp        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -24,8 +24,6 @@
</span><span class="cx"> this, SLOT(channelCreate(Channel*)));
</span><span class="cx"> connect(sm, SIGNAL(channelDestroyed(Channel*)),
</span><span class="cx"> this, SLOT(channelDestroy(Channel*)));
</span><del>- connect(sm, SIGNAL(channelStateChanged(Channel*)),
- this, SLOT(channelStateChanged(Channel*)));
</del><span class="cx"> connect(m_ui->listActiveChannels, SIGNAL(clicked(QModelIndex)),
</span><span class="cx"> this, SLOT(activeChannelSelected(QModelIndex)));
</span><span class="cx"> connect(m_ui->listInactiveChannels, SIGNAL(clicked(QModelIndex)),
</span><span class="lines">@@ -113,31 +111,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RealtimeStatisticsDialog::channelStateChanged(Channel * ch)
-{
- /* Sanity checking */
- if (!ch)
- return;
-
- foreach (QStandardItem *item, _channel_model->findItems("*", Qt::MatchWildcard | Qt::MatchRecursive))
- {
- if (item->data(Qt::UserRole) == ch->getUUID())
- if (_channel_model->itemFromIndex(m_ui->listActiveChannels->currentIndex()) == item)
- {
- activeChannelSelected(_channel_model->indexFromItem(item));
- }
- }
-
- foreach (QStandardItem *item, _inactive_channel_model->findItems("*", Qt::MatchWildcard | Qt::MatchRecursive))
- {
- if (item->data(Qt::UserRole) == ch->getUUID())
- if (_inactive_channel_model->itemFromIndex(m_ui->listInactiveChannels->currentIndex()) == item)
- {
- inactiveChannelSelected(_inactive_channel_model->indexFromItem(item));
- }
- }
-}
-
</del><span class="cx"> void RealtimeStatisticsDialog::activeChannelSelected(QModelIndex index)
</span><span class="cx"> {
</span><span class="cx">
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginsortfilterproxymodelcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -1,6 +1,66 @@
</span><span class="cx"> #include <QtGui>
</span><span class="cx"> #include "sortfilterproxymodel.h"
</span><span class="cx">
</span><ins>+ConsoleModel::ConsoleModel (QObject *parent)
+ : QAbstractListModel(parent)
+{
+ QSettings settings;
+ batchSize = settings.value("Console/batchSize", 200).toInt();
+ insertionTimer = new QBasicTimer;
+ insertionTimer->start(0, this);
+}
+
+int ConsoleModel::rowCount ( const QModelIndex & /*parent*/ ) const
+{
+ return _listDisplayModel.count();
+}
+
+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();
+}
+
+void ConsoleModel::appendRow ( QStandardItem* item )
+{
+ _listInsertModel.append(item);
+}
+
+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;
+ }
+ beginInsertRows( QModelIndex(), _listDisplayModel.size(), _listDisplayModel.size() + toBeInserted );
+ emit layoutAboutToBeChanged();
+ while( !_listInsertModel.isEmpty() && inserted_items < batchSize)
+ {
+ _listDisplayModel.append(_listInsertModel.takeFirst());
+ inserted_items++;
+ }
+ endInsertRows();
+ emit layoutChanged();
+ }
+ }
+}
+
</ins><span class="cx"> SortFilterProxyModel::SortFilterProxyModel(QObject *parent)
</span><span class="cx"> : QSortFilterProxyModel(parent)
</span><span class="cx"> {
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginsortfilterproxymodelh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h (14581 => 14582)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h        2009-08-21 00:59:09 UTC (rev 14581)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h        2009-08-21 05:41:14 UTC (rev 14582)
</span><span class="lines">@@ -2,8 +2,32 @@
</span><span class="cx"> #define SORTFILTERPROXYMODEL_H
</span><span class="cx">
</span><span class="cx"> #include <QSortFilterProxyModel>
</span><ins>+#include <QAbstractListModel>
</ins><span class="cx"> #include <QVector>
</span><ins>+#include <QList>
</ins><span class="cx">
</span><ins>+class QBasicTimer;
+class QStandardItem;
+class QScrollBar;
+
+class ConsoleModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ ConsoleModel (QObject *parent = 0);
+ int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
+ QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
+ void appendRow ( QStandardItem* item );
+ void clear();
+protected:
+ void timerEvent(QTimerEvent *);
+private:
+ QList<QStandardItem *> _listDisplayModel;
+ QList<QStandardItem *> _listInsertModel;
+ int batchSize;
+ QBasicTimer *insertionTimer;
+};
+
</ins><span class="cx"> class SortFilterProxyModel : public QSortFilterProxyModel
</span><span class="cx"> {
</span><span class="cx"> Q_OBJECT
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>