Diff
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/resources/consolepage.ui (14266 => 14267)
--- freeswitch/trunk/contrib/jmesquita/fsgui/resources/consolepage.ui 2009-07-16 03:41:59 UTC (rev 14266)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/resources/consolepage.ui 2009-07-16 04:56:31 UTC (rev 14267)
@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
- <width>274</width>
- <height>244</height>
+ <width>570</width>
+ <height>443</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
<string>consolePage</string>
</property>
@@ -18,27 +24,87 @@
<widget class="QTextEdit" name="textConsole"/>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QLineEdit" name="lineCmd"/>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="lineCmd"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnSend">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Send</string>
+ </property>
+ <property name="shortcut">
+ <string>Return</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
- <widget class="QPushButton" name="btnSend">
- <property name="enabled">
- <bool>false</bool>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>LogLevel</string>
</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>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QComboBox" name="comboLogLevel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <item>
+ <property name="text">
+ <string>Console</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Alert</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Crit</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Err</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>
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp (14266 => 14267)
--- freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp 2009-07-16 03:41:59 UTC (rev 14266)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/consolepage.cpp 2009-07-16 04:56:31 UTC (rev 14267)
@@ -46,16 +46,19 @@
m_ui(new Ui::consolePage)
{
m_ui->setupUi(this);
+ connect(m_ui->comboLogLevel, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(loglevelChanged(int)));
}
consolePage::~consolePage()
{
- delete m_ui;
+ writeSettings();
if (eslConnection->isRunning())
{
eslConnection->disconnect();
eslConnection->wait();
}
delete eslConnection;
+ delete m_ui;
}
void consolePage::init(QString host)
{
@@ -133,18 +136,22 @@
void consolePage::gotConnectedSlot()
{
appendConsoleText(tr("Connected!"));
- m_ui->lineCmd->setEnabled(true);
+ m_ui->lineCmd->setEnabled(eslConnection->connected());
+ m_ui->comboLogLevel->setEnabled(eslConnection->connected());
m_ui->lineCmd->setFocus();
+ readSettings();
}
void consolePage::gotDisconnectedSlot()
{
appendConsoleText(tr("Disconnected!"));
- m_ui->lineCmd->setDisabled(true);
+ m_ui->lineCmd->setEnabled(eslConnection->connected());
+ m_ui->comboLogLevel->setEnabled(eslConnection->connected());
}
void consolePage::connectionFailedSlot(QString msg)
{
appendConsoleText("Connection Failed: "+msg);
- m_ui->lineCmd->setDisabled(true);
+ m_ui->lineCmd->setEnabled(eslConnection->connected());
+ m_ui->comboLogLevel->setEnabled(eslConnection->connected());
}
void consolePage::gotEventSlot(ESLevent * event)
{
@@ -205,3 +212,35 @@
}
delete event;
}
+void consolePage::loglevelChanged(int loglevel)
+{
+ if (!eslConnection->connected())
+ {
+ appendConsoleText(QString("Cannot change loglevel if not connected."));
+ return;
+ }
+ ESLevent *event = eslConnection->sendRecv(QString("log %1").arg(loglevel).toAscii());
+ if (event)
+ {
+ appendConsoleText(QString("Changed loglevel to %1").arg(m_ui->comboLogLevel->currentText()));
+ }
+ else
+ {
+ appendConsoleText(QString("Could not change loglevel"));
+ }
+}
+void consolePage::readSettings()
+{
+ QString settingsApplication = "FSGui";
+ QString settingsOrganization = "FreeSWITCH";
+ QSettings settings(settingsOrganization, settingsApplication);
+ m_ui->comboLogLevel->setCurrentIndex(settings.value(QString("servers/%1/loglevel").arg(host)).toInt());
+}
+void consolePage::writeSettings()
+{
+ QString settingsApplication = "FSGui";
+ QString settingsOrganization = "FreeSWITCH";
+ QSettings settings(settingsOrganization, settingsApplication);
+ qDebug() << m_ui->comboLogLevel->currentIndex();
+ settings.setValue(QString("servers/%1/loglevel").arg(host), m_ui->comboLogLevel->currentIndex());
+}
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp (14266 => 14267)
--- freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp 2009-07-16 03:41:59 UTC (rev 14266)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/esl_connection.cpp 2009-07-16 04:56:31 UTC (rev 14267)
@@ -77,7 +77,6 @@
if (esl_connect(&handle, _host->toAscii(), x_port, _pass->toAscii()) == ESL_SUCCESS)
{
- sendRecv("log 7");
emit gotConnected();
}
start();
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/fs_gui.cpp (14266 => 14267)
--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fs_gui.cpp 2009-07-16 03:41:59 UTC (rev 14266)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fs_gui.cpp 2009-07-16 04:56:31 UTC (rev 14267)
@@ -45,8 +45,9 @@
m_ui(new Ui::Cfsgui),
serverDialog(NULL)
{
- m_ui->setupUi(this);
+ m_ui->setupUi(this);
+
// Set the default status bar message
m_ui->statusBar->showMessage(tr("Ready"));
@@ -58,6 +59,7 @@
this, SLOT(closeTab(int)));
m_ui->tabWidget->clear();
+ showMaximized();
}
Cfsgui::~Cfsgui()
{
@@ -86,7 +88,6 @@
}
void Cfsgui::closeEvent(QCloseEvent *e)
{
- /* TODO: We have to stop threads and do cleanup */
e->accept();
}
void Cfsgui::newConnectionFromDialog()
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h (14266 => 14267)
--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h 2009-07-16 03:41:59 UTC (rev 14266)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/consolepage.h 2009-07-16 04:56:31 UTC (rev 14267)
@@ -31,7 +31,10 @@
void getDisconnectedSlot();
void typedCommand();
void sendCommand();
+ void loglevelChanged(int loglevel);
private:
+ void writeSettings();
+ void readSettings();
Ui::consolePage *m_ui;
ESLconnection *eslConnection;
QString host;
Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/include/fs_gui.h (14266 => 14267)
--- freeswitch/trunk/contrib/jmesquita/fsgui/src/include/fs_gui.h 2009-07-16 03:41:59 UTC (rev 14266)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/include/fs_gui.h 2009-07-16 04:56:31 UTC (rev 14267)
@@ -66,6 +66,7 @@
private:
Ui::Cfsgui *m_ui;
CserverManager *serverDialog;
+ void saveWindowSettings();
};
#endif // FS_GUI_H