Revision
14463
Author
jmesquita
Date
2009-08-08 18:33:24 -0500 (Sat, 08 Aug 2009)

Log Message

Adding new version of codebase. Not fully functional.

Added Paths

Diff

Added: freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/fsgui.pro	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS  = src/interfaces \
+           src/fsgui \
+           src/plugins/consoleplugin

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,173 @@
+#include <QtGui>
+#include <QDir>
+#include <QtPlugin>
+#include "servermanager.h"
+#include "settingsdialog.h"
+#include "appmanager.h"
+#include "interfaces.h"
+#include "ui_config_plugin_widget.h"
+
+AppManager::AppManager(QObject *parent)
+    : QObject(parent)
+{
+    QObject::connect(qApp, SIGNAL(lastWindowClosed()),
+                     this, SLOT(lastWindowClosed()));
+
+    QCoreApplication::setOrganizationName("FreeSWITCH");
+    QCoreApplication::setApplicationName("FsGui");
+    settings = new SettingsDialog();
+    QWidget *base = new QWidget;
+    pluginConfigPage = new Ui::configPage;
+    pluginConfigPage->setupUi(base);
+    settings->addConfigItem("Plugins", base);
+    QObject::connect(pluginConfigPage->btnRun, SIGNAL(clicked()),
+                     this, SLOT(runPlugin()));
+    QObject::connect(pluginConfigPage->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
+                     this, SLOT(pluginSelected(QListWidgetItem*, QListWidgetItem*)));
+
+    serverManager = new ServerManager;
+
+    qApp->setWindowIcon(QIcon(":/icons/fsgui_logo.png"));
+
+    createActions();
+    loadPlugins();
+    settings->show();
+}
+
+
+void AppManager::createActions()
+{
+    action_exit = new QAction(tr("E&xit"), this);
+    action_exit->setShortcut(tr("Ctrl+Q"));
+    action_exit->setToolTip(tr("Exit FsGui"));
+    QWidget::connect(action_exit, SIGNAL(triggered()),
+                     qApp, SLOT(closeAllWindows()));
+
+    action_preferences = new QAction(tr("&Preferences"), this);
+    QWidget::connect(action_preferences, SIGNAL(triggered()),
+                     settings, SLOT(show()));
+
+    action_about = new QAction(tr("&About"), this);
+    action_about->setShortcut(QKeySequence::HelpContents);
+    QWidget::connect(action_about, SIGNAL(triggered()),
+                     this, SLOT(about()));
+}
+
+
+void AppManager::createMenus(QMenuBar * menu_bar)
+{
+    bool file_exists, edit_exists, help_exists = false;
+    QList<QAction *> list = menu_bar->actions();
+    for (int i = 0; i < list.size(); ++i) {
+        if (QString::compare(list.at(i)->text(), tr("&File"), Qt::CaseInsensitive) == 0)
+        {
+            list.at(i)->menu()->addAction(action_exit);
+            file_exists = true;
+        }
+        if (QString::compare(list.at(i)->text(), tr("&Preferences"), Qt::CaseInsensitive) == 0)
+        {
+            list.at(i)->menu()->addAction(action_preferences);
+            edit_exists = true;
+        }
+        if (QString::compare(list.at(i)->text(), tr("&Help"), Qt::CaseInsensitive) == 0)
+        {
+            list.at(i)->menu()->addAction(action_about);
+            help_exists = true;
+        }
+    }
+    if (!file_exists)
+    {
+        QMenu * menu_file = new QMenu(tr("&File"), menu_bar);
+        menu_file->addAction(action_exit);
+        menu_bar->insertMenu(list.at(0), menu_file);
+    }
+    if (!edit_exists)
+    {
+        QMenu * menu_edit = new QMenu(tr("&Edit"), menu_bar);
+        menu_edit->addAction(action_preferences);
+        menu_bar->insertMenu(list.at(1), menu_edit);
+    }
+    if (!help_exists)
+    {
+        QMenu *menu_help = menu_bar->addMenu(tr("&Help"));
+        menu_help->addAction(action_about);
+    }
+}
+
+void AppManager::loadPlugins()
+{
+    QDir pluginsDir = QDir(qApp->applicationDirPath());
+#if defined(Q_OS_WIN)
+    if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
+        pluginsDir.cdUp();
+#elif defined(Q_OS_MAC)
+    if (pluginsDir.dirName() == "MacOS") {
+        pluginsDir.cdUp();
+        pluginsDir.cdUp();
+        pluginsDir.cdUp();
+    }
+#endif
+    pluginsDir.cd("plugins");
+    foreach (QString fileName, pluginsDir.entryList(QDir::Files))
+    {
+        QPluginLoader *loader = new QPluginLoader(pluginsDir.absoluteFilePath(fileName));
+        if (MonitorInterface *interface = qobject_cast<MonitorInterface *>(loader->instance()))
+        {
+            if(QMainWindow *interface_window = qobject_cast<QMainWindow *>(loader->instance()))
+            {
+                list_available_monitor_plugins.append(loader);
+                interface_window->setWindowTitle(QString("FsGui - ") + interface_window->windowTitle());
+                interface_window->setAttribute(Qt::WA_QuitOnClose);
+                interface->addConfigItens(settings);
+                interface->setServerManager(serverManager);
+                createMenus(interface_window->menuBar());
+                pluginConfigPage->listWidget->addItem(QString("%1 - %2").arg(interface->appName(),
+                                                                             interface->appDescription()));
+            }
+            else
+            {
+                QMessageBox::critical(0, tr("Error!"),
+                                      tr("Plugin %1 does not have the proper main Window"));
+            }
+        }
+    }
+    if (list_available_monitor_plugins.isEmpty())
+    {
+        QMessageBox::critical(0, tr("Error!"),
+                                      tr("No available plugins. Install compatible plugins before running FsGui."));
+        exit(1);
+    }
+}
+
+void AppManager::runPlugin()
+{
+    if (list_available_monitor_plugins.at(pluginConfigPage->listWidget->currentRow())->isLoaded())
+    {
+        MonitorInterface * interface = qobject_cast<MonitorInterface *>(list_available_monitor_plugins.at(pluginConfigPage->listWidget->currentRow())->instance());
+        interface->newInstance();
+        settings->hide();
+    }
+}
+
+void AppManager::lastWindowClosed()
+{
+    for (int i = 0; i < list_available_monitor_plugins.size(); ++i)
+    {
+        list_available_monitor_plugins.at(i)->unload();
+    }
+}
+
+void AppManager::pluginSelected(QListWidgetItem *current, QListWidgetItem */*previous*/)
+{
+    if (current)
+        pluginConfigPage->btnRun->setEnabled(true);
+    else
+        pluginConfigPage->btnRun->setEnabled(false);
+}
+
+void AppManager::about()
+{
+    QMessageBox::about(qobject_cast<QMainWindow *>(list_available_monitor_plugins.first()),
+                       tr("About FsGui"),
+                       tr("Hey, this is FsGui!!!"));
+}

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/appmanager.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,74 @@
+#ifndef APPMANAGER_H
+#define APPMANAGER_H
+
+#include <QObject>
+#include <QtCore>
+
+namespace Ui {
+    class configPage;
+}
+class QMainWindow;
+class QAction;
+class QMenu;
+class QMenuBar;
+class QListWidgetItem;
+class MonitorInterface;
+class SettingsDialog;
+class ServerManager;
+
+/*!
+  \brief This class will be the center of each installation
+  and will load some plugins.
+  */
+class AppManager : public QObject
+{
+    Q_OBJECT
+
+public:
+    AppManager(QObject *parent = 0);
+
+private:
+    /*!
+      \brief Create all actions that belong to this specific window.
+      */
+    void createActions();
+    /*!
+      \brief Create menus and override offensing default menus.
+      */
+    void createMenus(QMenuBar *menu_bar);
+    /*!
+      \brief Load all plugins populating each corresponding list
+      */
+    void loadPlugins();
+
+    QList<QPluginLoader *> list_available_monitor_plugins; /*< List of available Monitor plugins */
+    QAction *action_exit; /*< Exit the application */
+    QAction *action_preferences; /*< Show the preferences dialog */
+    QAction *action_about; /*< Calls the about dialog */
+    QMenu *menu_file; /*< The file menu on menu bar */
+    QMenu *menu_edit; /*< The edit menu on menu bar */
+    QMenu *menu_help; /*< The help menu on menu bar */
+    ServerManager *serverManager; /*< The dialog that can fetch new esl connections from the config */
+    SettingsDialog *settings; /*< Settings dialog */
+    Ui::configPage *pluginConfigPage; /*< The plugin config page being used */
+
+private slots:
+    /*!
+      \brief Run the selected plugin.
+      */
+    void runPlugin();
+    /*!
+      \brief Cleanup and give plugins a chance to clean for themselves.
+      */
+    void lastWindowClosed();
+    /*!
+      \brief Just enables or disables the run button when no plugins is selected.
+      */
+    void pluginSelected(QListWidgetItem*, QListWidgetItem*);
+    /*!
+      \brief Show the about dialog.
+      */
+    void about();
+};
+
+#endif // APPMANAGER_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/config_plugin_widget.ui	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>configPage</class>
+ <widget class="QWidget" name="configPage">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>374</width>
+    <height>210</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <widget class="QListWidget" name="listWidget"/>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <widget class="QPushButton" name="btnRun">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="text">
+        <string>&amp;Run</string>
+       </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>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/fsgui.pro	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,19 @@
+# version check qt
+contains(QT_VERSION, ^4\.[0-4]\..*) { 
+    message("Cannot build Qt Creator with Qt version $$QT_VERSION.")
+    error("Use at least Qt 4.5.")
+}
+QT += network
+TARGET = ../../bin/fsgui
+TEMPLATE = app
+INCLUDEPATH = ../interfaces \
+    ../../../../../libs/esl/src/include/
+SOURCES += main.cpp \
+    appmanager.cpp
+HEADERS += appmanager.h
+LIBS += -L../interfaces \
+    -linterfaces \
+    -L../../../../../libs/esl/ \
+    -lesl
+FORMS += config_plugin_widget.ui
+RESOURCES += ../resources/resources.qrc

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/main.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/main.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/fsgui/main.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,10 @@
+#include <QtGui/QApplication>
+#include "appmanager.h"
+
+int main(int argc, char *argv[])
+{
+    //Q_INIT_RESOURCE(sdi);
+    QApplication a(argc, argv);
+    AppManager w;
+    return a.exec();
+}

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,478 @@
+/*
+ * 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) gmail.com>
+ *
+ */
+
+#include <QtGui>
+#include <esl.h>
+#include "eslconnection.h"
+
+#define event_construct_common() event = NULL; serialized_string = NULL; mine = 0; hp = NULL
+
+void eslSetLogLevel(int level)
+{
+    esl_global_set_default_logger(level);
+}
+
+ESLconnection::ESLconnection(const char *host, const char *port, const char *password, const char *name)
+        : handle(NULL),_host(new QString(host)), _port(new QString(port)),
+        _pass(new QString(password)), _name(new QString(name)){}
+ESLconnection::~ESLconnection()
+{
+    if (isConnected()) {
+        esl_disconnect(handle);
+    }
+
+}
+
+QString ESLconnection::getName()
+{
+    return *_name;
+}
+
+int ESLconnection::disconnect()
+{
+    if (handle)
+    {
+        if (handle->connected)
+        {
+            return esl_disconnect(handle);
+        }
+    }
+    return 0;
+}
+
+bool ESLconnection::setConsoleLogLevel(int level)
+{
+    ESLevent *event = sendRecv(QString("log %1").arg(level).toAscii());
+    if (event)
+    {
+        return true;
+    }
+    return false;
+}
+
+void ESLconnection::connect()
+{
+    start();
+}
+
+int ESLconnection::isConnected()
+{
+    if (handle)
+        return handle->connected;
+    return 0;
+}
+
+void ESLconnection::send(QString cmd)
+{
+    esl_send(handle, cmd.toAscii());
+}
+
+ESLevent *ESLconnection::sendRecv(const char *cmd)
+{
+    if (esl_send_recv(handle, cmd) == ESL_SUCCESS) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        return new ESLevent(event, 1);
+    }
+
+    return NULL;
+}
+
+void ESLconnection::api(QString cmd)
+{
+    if (cmd.isEmpty()) {
+        return;
+    }
+
+    if (esl_send_recv(handle, QString("api %1").arg(cmd).toAscii()) == ESL_SUCCESS) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        emit gotEvent(new ESLevent(event, 1));
+    }
+}
+
+void ESLconnection::bgapi(QString cmd)
+{
+    if (cmd.isEmpty()) {
+        return;
+    }
+
+    if (esl_send_recv(handle, QString("bgapi %1").arg(cmd).toAscii()) == ESL_SUCCESS) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        emit gotEvent(new ESLevent(event, 1));
+    }
+}
+
+ESLevent *ESLconnection::getInfo()
+{
+    if (handle->connected && handle->info_event) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->info_event);
+        return new ESLevent(event, 1);
+    }
+
+    return NULL;
+}
+
+int ESLconnection::setAsyncExecute(const char *val)
+{
+    if (val) {
+        handle->async_execute = esl_true(val);
+    }
+    return handle->async_execute;
+}
+
+int ESLconnection::setEventLock(const char *val)
+{
+    if (val) {
+        handle->event_lock = esl_true(val);
+    }
+    return handle->event_lock;
+}
+
+int ESLconnection::execute(const char *app, const char *arg, const char *uuid)
+{
+    return esl_execute(handle, app, arg, uuid);
+}
+
+
+int ESLconnection::executeAsync(const char *app, const char *arg, const char *uuid)
+{
+    int async = handle->async_execute;
+    int r;
+
+    handle->async_execute = 1;
+    r = esl_execute(handle, app, arg, uuid);
+    handle->async_execute = async;
+
+    return r;
+}
+
+int ESLconnection::sendEvent(ESLevent *send_me)
+{
+    return esl_sendevent(handle, send_me->event);
+}
+
+ESLevent *ESLconnection::recvEvent()
+{
+    if (last_event_obj) {
+        delete last_event_obj;
+    }
+
+    if (esl_recv_event(handle, 1, NULL) == ESL_SUCCESS) {
+        esl_event_t *e = handle->last_ievent ? handle->last_ievent : handle->last_event;
+        if (e) {
+            esl_event_t *event;
+            esl_event_dup(&event, e);
+            last_event_obj = new ESLevent(event, 1);
+            return last_event_obj;
+        }
+    }
+
+    last_event_obj = new ESLevent("server_disconnected");
+
+    return last_event_obj;
+}
+
+ESLevent *ESLconnection::recvEventTimed(int ms)
+{
+    if (last_event_obj) {
+        delete last_event_obj;
+        last_event_obj = NULL;
+    }
+
+    if (esl_recv_event_timed(handle, ms, 1, NULL) == ESL_SUCCESS) {
+        esl_event_t *e = handle->last_ievent ? handle->last_ievent : handle->last_event;
+        if (e) {
+            esl_event_t *event;
+            esl_event_dup(&event, e);
+            last_event_obj = new ESLevent(event, 1);
+            return last_event_obj;
+        }
+    }
+
+    return NULL;
+}
+
+ESLevent *ESLconnection::filter(const char *header, const char *value)
+{
+    esl_status_t status = esl_filter(handle, header, value);
+
+    if (status == ESL_SUCCESS && handle->last_sr_event) {
+        esl_event_t *event;
+        esl_event_dup(&event, handle->last_sr_event);
+        return new ESLevent(event, 1);
+    }
+
+    return NULL;
+
+}
+
+int ESLconnection::events(const char *etype, const char *value)
+{
+    esl_event_type_t type_id = ESL_EVENT_TYPE_PLAIN;
+
+    if (!strcmp(etype, "xml")) {
+        type_id = ESL_EVENT_TYPE_XML;
+    }
+
+    return esl_events(handle, type_id, value);
+}
+
+void ESLconnection::run(void)
+{
+
+    handle = new esl_handle_t;
+    memset(handle, 0, sizeof(esl_handle_t));
+    last_event_obj = NULL;
+    if (esl_connect(handle, _host->toAscii(), _port->toInt(), _pass->toAscii()) == ESL_SUCCESS)
+    {
+        send("event plain ALL");
+        send("log 7");
+        emit connected();
+    }
+    while(isConnected())
+    {
+        ESLevent * event = recvEventTimed(10);
+        if (event)
+        {
+            ESLevent * e = new ESLevent(event);
+            emit gotEvent(e);
+        }
+    }
+    if (!QString(handle->err).isEmpty())
+    {
+        emit connectionFailed(handle->err);
+    }
+    else
+    {
+        emit disconnected();
+    }
+}
+
+// ESLevent
+///////////////////////////////////////////////////////////////////////
+
+ESLevent::ESLevent(const char *type, const char *subclass_name)
+{
+    esl_event_types_t event_id;
+
+    event_construct_common();
+
+    if (esl_name_event(type, &event_id) != ESL_SUCCESS) {
+        event_id = ESL_EVENT_MESSAGE;
+    }
+
+    if (!esl_strlen_zero(subclass_name) && event_id != ESL_EVENT_CUSTOM) {
+        esl_log(ESL_LOG_WARNING, "Changing event type to custom because you specified a subclass name!\n");
+        event_id = ESL_EVENT_CUSTOM;
+    }
+
+    if (esl_event_create_subclass(&event, event_id, subclass_name) != ESL_SUCCESS) {
+        esl_log(ESL_LOG_ERROR, "Failed to create event!\n");
+        event = NULL;
+    }
+
+    serialized_string = NULL;
+    mine = 1;
+}
+
+ESLevent::ESLevent(esl_event_t *wrap_me, int free_me)
+{
+    event_construct_common();
+    event = wrap_me;
+    mine = free_me;
+    serialized_string = NULL;
+}
+
+
+ESLevent::ESLevent(ESLevent *me)
+{
+    /* workaround for silly php thing */
+    event = me->event;
+    mine = me->mine;
+    serialized_string = NULL;
+    me->event = NULL;
+    me->mine = 0;
+    esl_safe_free(me->serialized_string);
+}
+
+ESLevent::~ESLevent()
+{
+
+    if (serialized_string) {
+        free(serialized_string);
+    }
+
+    if (event && mine) {
+        esl_event_destroy(&event);
+    }
+}
+
+const char *ESLevent::nextHeader(void)
+{
+    const char *name = NULL;
+
+    if (hp) {
+        name = hp->name;
+        hp = hp->next;
+    }
+
+    return name;
+}
+
+const char *ESLevent::firstHeader(void)
+{
+    if (event) {
+        hp = event->headers;
+    }
+
+    return nextHeader();
+}
+
+const char *ESLevent::serialize()
+{
+    this_check("");
+
+    esl_safe_free(serialized_string);
+
+    if (!event) {
+        return "";
+    }
+
+    if (esl_event_serialize(event, &serialized_string, ESL_TRUE) == ESL_SUCCESS) {
+        return serialized_string;
+    }
+
+    return "";
+
+}
+
+bool ESLevent::setPriority(esl_priority_t priority)
+{
+    this_check(false);
+
+    if (event) {
+        esl_event_set_priority(event, priority);
+        return true;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to setPriority an event that does not exist!\n");
+    }
+    return false;
+}
+
+const char *ESLevent::getHeader(const char *header_name)
+{
+    this_check("");
+
+    if (event) {
+        return esl_event_get_header(event, header_name);
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to getHeader an event that does not exist!\n");
+    }
+    return NULL;
+}
+
+bool ESLevent::addHeader(const char *header_name, const char *value)
+{
+    this_check(false);
+
+    if (event) {
+        return esl_event_add_header_string(event, ESL_STACK_BOTTOM, header_name, value) == ESL_SUCCESS ? true : false;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to addHeader an event that does not exist!\n");
+    }
+
+    return false;
+}
+
+bool ESLevent::delHeader(const char *header_name)
+{
+    this_check(false);
+
+    if (event) {
+        return esl_event_del_header(event, header_name) == ESL_SUCCESS ? true : false;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to delHeader an event that does not exist!\n");
+    }
+
+    return false;
+}
+
+
+bool ESLevent::addBody(const char *value)
+{
+    this_check(false);
+
+    if (event) {
+        return esl_event_add_body(event, "%s", value) == ESL_SUCCESS ? true : false;
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to addBody an event that does not exist!\n");
+    }
+
+    return false;
+}
+
+char *ESLevent::getBody(void)
+{
+
+    this_check((char *)"");
+
+    if (event) {
+        return esl_event_get_body(event);
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to getBody an event that does not exist!\n");
+    }
+
+    return NULL;
+}
+
+const char *ESLevent::getType(void)
+{
+    this_check("");
+
+    if (event) {
+        return esl_event_name(event->event_id);
+    } else {
+        esl_log(ESL_LOG_ERROR, "Trying to getType an event that does not exist!\n");
+    }
+
+    return (char *) "invalid";
+}
+

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/eslconnection.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,116 @@
+/*
+ * 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) gmail.com>
+ *
+ */
+
+#ifndef ESLCONNECTION_H
+#define ESLCONNECTION_H
+#include <QThread>
+#include <QtGui>
+#include <esl.h>
+
+#define this_check(x) do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
+#define this_check_void() do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return;}} while(0)
+
+
+class ESLevent {
+ private:
+        esl_event_header_t *hp;
+ public:
+        esl_event_t *event;
+        char *serialized_string;
+        int mine;
+
+        ESLevent(const char *type, const char *subclass_name = NULL);
+        ESLevent(esl_event_t *wrap_me, int free_me = 0);
+        ESLevent(ESLevent *me);
+        virtual ~ESLevent();
+        const char *serialize();
+        bool setPriority(esl_priority_t priority = ESL_PRIORITY_NORMAL);
+        const char *getHeader(const char *header_name);
+        char *getBody(void);
+        const char *getType(void);
+        bool addBody(const char *value);
+        bool addHeader(const char *header_name, const char *value);
+        bool delHeader(const char *header_name);
+        const char *firstHeader(void);
+        const char *nextHeader(void);
+};
+
+class ESLconnection : public QThread
+{
+    Q_OBJECT
+ private:
+    esl_handle_t *handle;
+    ESLevent *last_event_obj;
+    QString *_host;
+    QString *_port;
+    QString *_pass;
+    QString *_name;
+ public:
+    ESLconnection(const char *host, const char *port, const char *password, const char *name);
+    virtual ~ESLconnection();
+    int isConnected();
+    void connect();
+    ESLevent *getInfo();
+    ESLevent *sendRecv(const char *cmd);
+    int sendEvent(ESLevent *send_me);
+    ESLevent *recvEvent();
+    ESLevent *recvEventTimed(int ms);
+    ESLevent *filter(const char *header, const char *value);
+    int events(const char *etype, const char *value);
+    int execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
+    int executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL);
+    int setAsyncExecute(const char *val);
+    int setEventLock(const char *val);
+    int disconnect(void);
+    bool setConsoleLogLevel(int);
+    void api(QString cmd);
+    void bgapi(QString cmd);
+    void send(QString cmd);
+    QString getName();
+signals:
+    void connected(void);
+    void disconnected(void);
+    void connectionFailed(QString);
+    void gotEvent(ESLevent*);
+protected:
+    void run();
+};
+
+void eslSetLogLevel(int level);
+
+#endif // ESLCONNECTION_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,46 @@
+#ifndef INTERFACES_H
+#define INTERFACES_H
+
+#include <QtPlugin>
+
+class ESLevent;
+class SettingsDialog;
+class ServerManager;
+
+/*!
+  \brief This interface is provided to extend FsGui with applications that
+  could do any kind of monitoring of any kinda of data inside FreeSWITCH
+  or its components
+  */
+class MonitorInterface
+{
+public:
+    virtual ~MonitorInterface() { }
+    /*!
+      \brief This returns the plugin itself so we can connect signals/slots
+      */
+    virtual QObject* getMonitorInterfaceObject() = 0;
+    /*!
+      \brief This should return the name of the application
+      */
+    virtual QString appName() = 0;
+    /*!
+      \brief This should return the application description.
+      */
+    virtual QString appDescription() = 0;
+    /*!
+      \brief Add a new configuration item to the settings dialog
+      */
+    virtual void addConfigItens(SettingsDialog *settings) = 0;
+    /*!
+      \brief Sets a pointer to ServerManager object
+      */
+    virtual void setServerManager(ServerManager *serverManager) = 0;
+    /*!
+      \brief Run a new instance of this application.
+    */
+    virtual void newInstance() = 0;
+};
+
+Q_DECLARE_INTERFACE(MonitorInterface, "com.fsgui.fsgui.MonitorInterface/1.0")
+#endif // INTERFACES_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/interfaces.pro	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,16 @@
+TEMPLATE = lib
+CONFIG += staticlib
+INCLUDEPATH = ../fsgui/ \
+    ../../../../../libs/esl/src/include/
+HEADERS = interfaces.h \
+    settingsdialog.h \
+    servermanager.h \
+    eslconnection.h
+SOURCES = settingsdialog.cpp \
+    servermanager.cpp \
+    eslconnection.cpp
+FORMS += settingsdialog.ui \
+    servermanager.ui
+LIBS+=-L../../../../../libs/esl/ \
+    -lesl
+RESOURCES += ../resources/resources.qrc

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,155 @@
+#include <QtGui>
+#include "eslconnection.h"
+#include "servermanager.h"
+#include "ui_servermanager.h"
+
+ServerManager::ServerManager(QWidget *parent) :
+    QDialog(parent),
+    m_ui(new Ui::ServerManager)
+{
+    m_ui->setupUi(this);
+
+    m_ui->serverConfigTabs->removeTab(1);
+
+    readSettings();
+    QObject::connect(m_ui->listServers, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
+                     this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
+    QObject::connect(m_ui->btnAddServer, SIGNAL(clicked()),
+                     this, SLOT(addServer()));
+    QObject::connect(m_ui->btnDelServer, SIGNAL(clicked()),
+                     this, SLOT(deleteServer()));
+    QObject::connect(m_ui->btnEdit, SIGNAL(clicked()),
+                     this, SLOT(editServer()));
+    QObject::connect(m_ui->btnSave, SIGNAL(clicked()),
+                     this, SLOT(saveServer()));
+}
+
+ServerManager::~ServerManager()
+{
+    delete m_ui;
+}
+
+ESLconnection * ServerManager::getESLconnection()
+{
+    QTreeWidgetItem * item = m_ui->listServers->selectedItems().first();
+    return new ESLconnection(item->data(0, ServerManager::Host).toByteArray(),
+                             item->data(0, ServerManager::Port).toByteArray(),
+                             item->data(0, ServerManager::Password).toByteArray(),
+                             item->data(0, ServerManager::Name).toByteArray());
+}
+
+void ServerManager::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        m_ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void ServerManager::currentItemChanged (QTreeWidgetItem * current, QTreeWidgetItem * /*previous*/)
+{
+    if (current)
+    {
+        m_ui->lineHost->setText(current->data(0,ServerManager::Host).toString());
+        m_ui->linePassword->setText(current->data(0,ServerManager::Password).toString());
+        m_ui->linePort->setText(current->data(0,ServerManager::Port).toString());
+        m_ui->btnConnect->setEnabled(true);
+        m_ui->btnEdit->setEnabled(true);
+        m_ui->lineHost->setEnabled(false);
+        m_ui->linePassword->setEnabled(false);
+        m_ui->linePort->setEnabled(false);
+        m_ui->btnSave->setEnabled(false);
+    }
+    else
+    {
+        m_ui->btnEdit->setEnabled(false);
+        m_ui->btnConnect->setEnabled(false);
+    }
+}
+
+void ServerManager::addServer()
+{
+    bool ok;
+    QString text = QInputDialog::getText(this, tr("New Server Name"),
+                                         tr("Server Name:"), QLineEdit::Normal,
+                                         "", &ok);
+    if (ok && !text.isEmpty())
+    {
+        QSettings settings;
+        settings.beginGroup("Servers");
+        settings.beginGroup(text);
+        settings.setValue("name", text);
+        settings.setValue("port", 8021);
+        settings.endGroup();
+        settings.endGroup();
+        readSettings();
+        m_ui->listServers->setCurrentItem(m_ui->listServers->findItems(text, Qt::MatchExactly, 0).first());
+    }
+}
+
+void ServerManager::editServer()
+{
+    m_ui->lineHost->setEnabled(true);
+    m_ui->linePassword->setEnabled(true);
+    m_ui->linePort->setEnabled(true);
+    m_ui->btnSave->setEnabled(true);
+    m_ui->btnEdit->setEnabled(false);
+    m_ui->lineHost->setFocus();
+}
+
+void ServerManager::saveServer()
+{
+    QTreeWidgetItem * item = m_ui->listServers->selectedItems().first();
+    item->setData(0, ServerManager::Host, m_ui->lineHost->text());
+    item->setData(0, ServerManager::Password, m_ui->linePassword->text());
+    item->setData(0, ServerManager::Port, m_ui->linePort->text());
+
+    QSettings settings;
+    settings.beginGroup("Servers");
+    settings.beginGroup(item->data(0, ServerManager::Name).toString());
+    settings.setValue("host", m_ui->lineHost->text());
+    settings.setValue("password", m_ui->linePassword->text());
+    settings.setValue("port", m_ui->linePort->text());
+    settings.endGroup();
+    settings.endGroup();
+
+    m_ui->lineHost->setEnabled(false);
+    m_ui->linePassword->setEnabled(false);
+    m_ui->linePort->setEnabled(false);
+    m_ui->btnSave->setEnabled(false);
+    m_ui->btnEdit->setEnabled(true);
+}
+
+void ServerManager::deleteServer()
+{
+    QTreeWidgetItem *item = m_ui->listServers->selectedItems().first();
+    QSettings settings;
+    settings.beginGroup("Servers");
+    settings.remove(item->data(0, ServerManager::Name).toString());
+    delete item;
+}
+
+void ServerManager::readSettings()
+{
+    m_ui->listServers->clear();
+    QSettings settings;
+    settings.beginGroup("Servers");
+    foreach (QString server, settings.childGroups())
+    {
+        settings.beginGroup(server);
+        QTreeWidgetItem *serverItem = new QTreeWidgetItem(m_ui->listServers->invisibleRootItem());
+        serverItem->setIcon(0, QIcon(":/icons/server_icon.png"));
+        serverItem->setText(0, settings.value("name").toString());
+        serverItem->setData(0, ServerManager::Name, settings.value("name"));
+        serverItem->setData(0, ServerManager::Host, settings.value("host"));
+        serverItem->setData(0, ServerManager::Port, settings.value("port"));
+        serverItem->setData(0, ServerManager::Password, settings.value("password"));
+        settings.endGroup();
+    }
+    settings.endGroup();
+}
+

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,44 @@
+#ifndef SERVERMANAGER_H
+#define SERVERMANAGER_H
+
+#include <QtGui/QDialog>
+
+namespace Ui {
+    class ServerManager;
+}
+
+class ESLconnection;
+
+class QTreeWidgetItem;
+
+class ServerManager : public QDialog {
+    Q_OBJECT
+public:
+    ServerManager(QWidget *parent = 0);
+    ~ServerManager();
+    ESLconnection * getESLconnection();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void currentItemChanged ( QTreeWidgetItem * current, QTreeWidgetItem * previous );
+    void addServer();
+    void editServer();
+    void saveServer();
+    void deleteServer();
+
+private:
+    Ui::ServerManager *m_ui;
+
+    enum {
+        Host = Qt::UserRole,
+        Port,
+        Password,
+        Name
+    };
+
+    void readSettings();
+};
+
+#endif // SERVERMANAGER_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/servermanager.ui	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ServerManager</class>
+ <widget class="QDialog" name="ServerManager">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>534</width>
+    <height>292</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Server Manager</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QTreeWidget" name="listServers">
+         <column>
+          <property name="text">
+           <string>Servers</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QPushButton" name="btnAddServer">
+           <property name="text">
+            <string>&amp;Add server</string>
+           </property>
+           <property name="icon">
+            <iconset resource="../resources/resources.qrc">
+             <normaloff>:/icons/new_server_icon.png</normaloff>:/icons/new_server_icon.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btnDelServer">
+           <property name="text">
+            <string>&amp;Remove Server</string>
+           </property>
+           <property name="icon">
+            <iconset resource="../resources/resources.qrc">
+             <normaloff>:/icons/remove_server_icon.png</normaloff>:/icons/remove_server_icon.png</iconset>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QTabWidget" name="serverConfigTabs">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <property name="currentIndex">
+          <number>0</number>
+         </property>
+         <widget class="QWidget" name="tabBasic">
+          <attribute name="title">
+           <string>Basic</string>
+          </attribute>
+          <layout class="QFormLayout" name="formLayout">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Host</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="lineHost">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QLabel" name="label_2">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Password</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="QLineEdit" name="linePassword">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="0">
+            <widget class="QLabel" name="label_3">
+             <property name="enabled">
+              <bool>true</bool>
+             </property>
+             <property name="text">
+              <string>Port</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1">
+            <widget class="QLineEdit" name="linePort">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tabAdvanced">
+          <attribute name="title">
+           <string>Advanced</string>
+          </attribute>
+         </widget>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QPushButton" name="btnSave">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>&amp;Save</string>
+           </property>
+           <property name="icon">
+            <iconset resource="../resources/resources.qrc">
+             <normaloff>:/icons/save.png</normaloff>:/icons/save.png</iconset>
+           </property>
+           <property name="iconSize">
+            <size>
+             <width>20</width>
+             <height>20</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btnEdit">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+           <property name="text">
+            <string>&amp;Edit</string>
+           </property>
+           <property name="icon">
+            <iconset resource="../resources/resources.qrc">
+             <normaloff>:/icons/edit_icon.png</normaloff>:/icons/edit_icon.png</iconset>
+           </property>
+           <property name="iconSize">
+            <size>
+             <width>20</width>
+             <height>20</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButton_5">
+       <property name="maximumSize">
+        <size>
+         <width>85</width>
+         <height>28</height>
+        </size>
+       </property>
+       <property name="text">
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnConnect">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>85</width>
+         <height>28</height>
+        </size>
+       </property>
+       <property name="text">
+        <string>&amp;Connect</string>
+       </property>
+       <property name="icon">
+        <iconset resource="../resources/resources.qrc">
+         <normaloff>:/icons/connect_icon.png</normaloff>:/icons/connect_icon.png</iconset>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>20</width>
+         <height>20</height>
+        </size>
+       </property>
+       <property name="shortcut">
+        <string>Return</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+  <zorder></zorder>
+ </widget>
+ <resources>
+  <include location="../resources/resources.qrc"/>
+  <include location="../resources/resources.qrc"/>
+  <include location="../resources/resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>pushButton_5</sender>
+   <signal>clicked()</signal>
+   <receiver>ServerManager</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>438</x>
+     <y>346</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>171</x>
+     <y>257</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>btnConnect</sender>
+   <signal>clicked()</signal>
+   <receiver>ServerManager</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>564</x>
+     <y>365</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>617</x>
+     <y>351</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,51 @@
+#include <QtGui>
+#include "settingsdialog.h"
+#include "ui_settingsdialog.h"
+
+SettingsDialog::SettingsDialog(QWidget *parent) :
+    QDialog(parent),
+    m_ui(new Ui::SettingsDialog)
+{
+    m_ui->setupUi(this);
+    settings = new QSettings;
+    QObject::connect(m_ui->listConfig, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
+                     this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
+}
+
+SettingsDialog::~SettingsDialog()
+{
+    delete m_ui;
+}
+
+void SettingsDialog::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        m_ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void SettingsDialog::addConfigItem(QString item, QWidget *page)
+{
+    QListWidgetItem *item_widget = new QListWidgetItem(item);
+    addConfigItem(item_widget, page);
+}
+
+void SettingsDialog::addConfigItem(QListWidgetItem *item, QWidget *page)
+{
+    m_ui->listConfig->addItem(item);
+    m_ui->configPages->insertWidget(m_ui->listConfig->row(item),page);
+}
+
+void SettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
+{
+    if (!current)
+        current = previous;
+
+    m_ui->configPages->setCurrentIndex(m_ui->listConfig->row(current));
+}
+

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,31 @@
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QtGui/QDialog>
+
+namespace Ui {
+    class SettingsDialog;
+}
+class QListWidgetItem;
+class QSettings;
+
+class SettingsDialog : public QDialog {
+    Q_OBJECT
+public:
+    SettingsDialog(QWidget *parent = 0);
+    ~SettingsDialog();
+    void addConfigItem(QListWidgetItem *item, QWidget *page);
+    void addConfigItem(QString item, QWidget *page);
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void changePage(QListWidgetItem*, QListWidgetItem*);
+
+private:
+    Ui::SettingsDialog *m_ui;
+    QSettings *settings;
+};
+
+#endif // SETTINGSDIALOG_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/settingsdialog.ui	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SettingsDialog</class>
+ <widget class="QDialog" name="SettingsDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>333</width>
+    <height>248</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>General Settings</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="resources.qrc">
+    <normaloff>:/icons/fsgui_logo.png</normaloff>:/icons/fsgui_logo.png</iconset>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QListWidget" name="listConfig">
+       <property name="maximumSize">
+        <size>
+         <width>128</width>
+         <height>16777215</height>
+        </size>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>96</width>
+         <height>84</height>
+        </size>
+       </property>
+       <property name="movement">
+        <enum>QListView::Static</enum>
+       </property>
+       <property name="spacing">
+        <number>12</number>
+       </property>
+       <property name="viewMode">
+        <enum>QListView::IconMode</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QStackedWidget" name="configPages">
+       <property name="currentIndex">
+        <number>1</number>
+       </property>
+       <widget class="QWidget" name="page"/>
+       <widget class="QWidget" name="page_2"/>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnApply">
+       <property name="text">
+        <string>&amp;Apply</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnOk">
+       <property name="text">
+        <string>&amp;OK</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnCancel">
+       <property name="text">
+        <string>&amp;Cancel</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>btnCancel</sender>
+   <signal>clicked()</signal>
+   <receiver>SettingsDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>279</x>
+     <y>226</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>330</x>
+     <y>213</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/interfaces/ui_settings.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,132 @@
+/********************************************************************************
+** Form generated from reading ui file 'settings.ui'
+**
+** Created: Thu Aug 6 02:01:13 2009
+**      by: Qt User Interface Compiler version 4.5.0
+**
+** WARNING! All changes made in this file will be lost when recompiling ui file!
+********************************************************************************/
+
+#ifndef UI_SETTINGS_H
+#define UI_SETTINGS_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QDialog>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QListWidget>
+#include <QtGui/QPushButton>
+#include <QtGui/QSpacerItem>
+#include <QtGui/QStackedWidget>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_SettingsDialog
+{
+public:
+    QVBoxLayout *verticalLayout;
+    QHBoxLayout *horizontalLayout;
+    QListWidget *listConfig;
+    QStackedWidget *configPages;
+    QWidget *page;
+    QWidget *page_2;
+    QHBoxLayout *horizontalLayout_2;
+    QSpacerItem *horizontalSpacer;
+    QPushButton *btnApply;
+    QPushButton *btnOk;
+    QPushButton *btnCancel;
+
+    void setupUi(QDialog *SettingsDialog)
+    {
+        if (SettingsDialog->objectName().isEmpty())
+            SettingsDialog->setObjectName(QString::fromUtf8("SettingsDialog"));
+        SettingsDialog->resize(400, 300);
+        QIcon icon;
+        icon.addPixmap(QPixmap(QString::fromUtf8(":/icons/fsgui_logo.png")), QIcon::Normal, QIcon::Off);
+        SettingsDialog->setWindowIcon(icon);
+        verticalLayout = new QVBoxLayout(SettingsDialog);
+        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+        horizontalLayout = new QHBoxLayout();
+        horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
+        listConfig = new QListWidget(SettingsDialog);
+        listConfig->setObjectName(QString::fromUtf8("listConfig"));
+        listConfig->setMaximumSize(QSize(128, 16777215));
+        listConfig->setIconSize(QSize(96, 84));
+        listConfig->setMovement(QListView::Static);
+        listConfig->setSpacing(12);
+        listConfig->setViewMode(QListView::IconMode);
+
+        horizontalLayout->addWidget(listConfig);
+
+        configPages = new QStackedWidget(SettingsDialog);
+        configPages->setObjectName(QString::fromUtf8("configPages"));
+        page = new QWidget();
+        page->setObjectName(QString::fromUtf8("page"));
+        configPages->addWidget(page);
+        page_2 = new QWidget();
+        page_2->setObjectName(QString::fromUtf8("page_2"));
+        configPages->addWidget(page_2);
+
+        horizontalLayout->addWidget(configPages);
+
+
+        verticalLayout->addLayout(horizontalLayout);
+
+        horizontalLayout_2 = new QHBoxLayout();
+        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
+        horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+        horizontalLayout_2->addItem(horizontalSpacer);
+
+        btnApply = new QPushButton(SettingsDialog);
+        btnApply->setObjectName(QString::fromUtf8("btnApply"));
+
+        horizontalLayout_2->addWidget(btnApply);
+
+        btnOk = new QPushButton(SettingsDialog);
+        btnOk->setObjectName(QString::fromUtf8("btnOk"));
+
+        horizontalLayout_2->addWidget(btnOk);
+
+        btnCancel = new QPushButton(SettingsDialog);
+        btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
+
+        horizontalLayout_2->addWidget(btnCancel);
+
+
+        verticalLayout->addLayout(horizontalLayout_2);
+
+
+        retranslateUi(SettingsDialog);
+        QObject::connect(btnOk, SIGNAL(clicked()), SettingsDialog, SLOT(accept()));
+        QObject::connect(btnCancel, SIGNAL(clicked()), SettingsDialog, SLOT(reject()));
+
+        configPages->setCurrentIndex(1);
+
+
+        QMetaObject::connectSlotsByName(SettingsDialog);
+    } // setupUi
+
+    void retranslateUi(QDialog *SettingsDialog)
+    {
+        SettingsDialog->setWindowTitle(QApplication::translate("SettingsDialog", "FsGui", 0, QApplication::UnicodeUTF8));
+        btnApply->setText(QApplication::translate("SettingsDialog", "&Apply", 0, QApplication::UnicodeUTF8));
+        btnOk->setText(QApplication::translate("SettingsDialog", "&OK", 0, QApplication::UnicodeUTF8));
+        btnCancel->setText(QApplication::translate("SettingsDialog", "&Cancel", 0, QApplication::UnicodeUTF8));
+        Q_UNUSED(SettingsDialog);
+    } // retranslateUi
+
+};
+
+namespace Ui {
+    class SettingsDialog: public Ui_SettingsDialog {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_SETTINGS_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,119 @@
+<?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>673</width>
+    <height>536</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Console for human beings</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="../../resources/resources.qrc">
+    <normaloff>:/icons/fsgui_logo.png</normaloff>:/icons/fsgui_logo.png</iconset>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QVBoxLayout" name="verticalLayout_3">
+    <item>
+     <widget class="QTabWidget" name="tabConsole">
+      <property name="tabsClosable">
+       <bool>true</bool>
+      </property>
+      <property name="movable">
+       <bool>true</bool>
+      </property>
+      <widget class="QWidget" name="tab">
+       <attribute name="title">
+        <string>Tab 1</string>
+       </attribute>
+      </widget>
+      <widget class="QWidget" name="tab_2">
+       <attribute name="title">
+        <string>Tab 2</string>
+       </attribute>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>673</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menu_Server">
+    <property name="title">
+     <string>&amp;Server</string>
+    </property>
+    <addaction name="action_Server_Manager"/>
+    <addaction name="separator"/>
+    <addaction name="action_Connect"/>
+    <addaction name="action_Disconnect"/>
+   </widget>
+   <widget class="QMenu" name="menu_File">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="action_Close"/>
+   </widget>
+   <addaction name="menu_File"/>
+   <addaction name="menu_Server"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="action_Connect">
+   <property name="text">
+    <string>&amp;Connect</string>
+   </property>
+  </action>
+  <action name="action_Disconnect">
+   <property name="text">
+    <string>&amp;Disconnect</string>
+   </property>
+  </action>
+  <action name="action_Close">
+   <property name="text">
+    <string>&amp;Close</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+W</string>
+   </property>
+  </action>
+  <action name="action_Server_Manager">
+   <property name="text">
+    <string>&amp;Server Manager</string>
+   </property>
+  </action>
+ </widget>
+ <resources>
+  <include location="../../resources/resources.qrc"/>
+  <include location="../../resources/resources.qrc"/>
+  <include location="../../resources/resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>action_Close</sender>
+   <signal>triggered(bool)</signal>
+   <receiver>consoleWindow</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>197</x>
+     <y>169</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/console_settings.ui	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,656 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>configPage</class>
+ <widget class="QWidget" name="configPage">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>438</width>
+    <height>387</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_9">
+     <item>
+      <widget class="QGroupBox" name="groupBox">
+       <property name="minimumSize">
+        <size>
+         <width>372</width>
+         <height>318</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>372</width>
+         <height>318</height>
+        </size>
+       </property>
+       <property name="title">
+        <string>Colors</string>
+       </property>
+       <layout class="QVBoxLayout" name="verticalLayout_2">
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout">
+          <item>
+           <widget class="QLineEdit" name="lineConsole">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Console message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundConsole">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundConsole">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_2">
+          <item>
+           <widget class="QLineEdit" name="lineAlert">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Alert message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundAlert">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundAlert">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_3">
+          <item>
+           <widget class="QLineEdit" name="lineCritical">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Critical message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundCritical">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundCritical">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_4">
+          <item>
+           <widget class="QLineEdit" name="lineError">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Error message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundError">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundError">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_5">
+          <item>
+           <widget class="QLineEdit" name="lineWarning">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Warning message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundWarning">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundWarning">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_6">
+          <item>
+           <widget class="QLineEdit" name="lineNotice">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Notice message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundNotice">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundNotice">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_7">
+          <item>
+           <widget class="QLineEdit" name="lineInfo">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Info message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundInfo">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundInfo">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_8">
+          <item>
+           <widget class="QLineEdit" name="lineDebug">
+            <property name="minimumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>146</width>
+              <height>26</height>
+             </size>
+            </property>
+            <property name="autoFillBackground">
+             <bool>true</bool>
+            </property>
+            <property name="text">
+             <string>Debug message</string>
+            </property>
+            <property name="frame">
+             <bool>true</bool>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnBackgroundDebug">
+            <property name="minimumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>95</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Background</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="btnForegroundDebug">
+            <property name="minimumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>91</width>
+              <height>28</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Foreground</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,348 @@
+#include <QtGui>
+#include <QtPlugin>
+#include "consoleplugin.h"
+#include "eslconnection.h"
+#include "settingsdialog.h"
+#include "servermanager.h"
+#include "consoletabwidget.h"
+#include "ui_console_settings.h"
+
+
+ConsolePlugin::ConsolePlugin(QWidget *parent)
+        : QMainWindow(parent),
+        consoleWindow(new Ui::consoleWindow),
+        serverManager(NULL)
+{
+    consoleWindow->setupUi(this);
+    consoleWindow->tabConsole->clear();
+}
+
+ConsolePlugin::~ConsolePlugin(){}
+
+QObject * ConsolePlugin::getMonitorInterfaceObject()
+{
+    return this;
+}
+
+QString ConsolePlugin::appName()
+{
+    return "Console";
+}
+
+QString ConsolePlugin::appDescription()
+{
+    return tr("This application will do the same as fs_cli does.");
+}
+
+void ConsolePlugin::addConfigItens(SettingsDialog *settings)
+{
+    consoleConfigPage = new Ui::configPage;
+    QWidget *base = new QWidget;
+    consoleConfigPage->setupUi(base);
+    settings->addConfigItem("Console", base);
+
+    QObject::connect(consoleConfigPage->btnBackgroundConsole, SIGNAL(clicked()),
+                     this, SLOT(changeConsoleBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundAlert, SIGNAL(clicked()),
+                     this, SLOT(changeAlertBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundCritical, SIGNAL(clicked()),
+                     this, SLOT(changeCriticalBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundError, SIGNAL(clicked()),
+                     this, SLOT(changeErrorBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundWarning, SIGNAL(clicked()),
+                     this, SLOT(changeWarningBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundNotice, SIGNAL(clicked()),
+                     this, SLOT(changeNoticeBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundInfo, SIGNAL(clicked()),
+                     this, SLOT(changeInfoBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnBackgroundDebug, SIGNAL(clicked()),
+                     this, SLOT(changeDebugBackgroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundConsole, SIGNAL(clicked()),
+                     this, SLOT(changeConsoleForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundAlert, SIGNAL(clicked()),
+                     this, SLOT(changeAlertForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundCritical, SIGNAL(clicked()),
+                     this, SLOT(changeCriticalForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundError, SIGNAL(clicked()),
+                     this, SLOT(changeErrorForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundWarning, SIGNAL(clicked()),
+                     this, SLOT(changeWarningForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundNotice, SIGNAL(clicked()),
+                     this, SLOT(changeNoticeForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundInfo, SIGNAL(clicked()),
+                     this, SLOT(changeInfoForegroundColor()));
+    QObject::connect(consoleConfigPage->btnForegroundDebug, SIGNAL(clicked()),
+                     this, SLOT(changeDebugForegroundColor()));
+    readSettings();
+    QObject::connect(settings, SIGNAL(accepted()),
+                     this, SLOT(writeSettings()));
+}
+
+void ConsolePlugin::newInstance()
+{
+    this->show();
+    newConnection();
+}
+
+void ConsolePlugin::setServerManager(ServerManager *manager)
+{
+    serverManager = manager;
+    QObject::connect(consoleWindow->action_Server_Manager, SIGNAL(triggered()),
+                     this, SLOT(newConnection()));
+}
+
+void ConsolePlugin::connected()
+{
+    consoleWindow->action_Connect->setEnabled(false);
+    consoleWindow->action_Disconnect->setEnabled(true);
+}
+
+void ConsolePlugin::disconnected()
+{
+    consoleWindow->action_Connect->setEnabled(true);
+    consoleWindow->action_Disconnect->setEnabled(false);
+}
+
+void ConsolePlugin::connectionFailed(QString /*reason*/)
+{
+}
+
+void ConsolePlugin::newConnection()
+{
+    if (serverManager->exec())
+    {
+        ESLconnection *esl = serverManager->getESLconnection();
+        consoleWindow->tabConsole->addTab(new ConsoleTabWidget(this, esl), esl->getName());
+        if (hashESL.contains(esl->getName()))
+        {
+            esl->disconnect();
+            esl->wait();
+            hashESL.remove(esl->getName());
+            delete esl;
+        }
+        hashESL.insert(esl->getName(), esl);
+        QObject::connect(esl, SIGNAL(connected()),
+                         this, SLOT(connected()));
+        QObject::connect(esl, SIGNAL(connectionFailed(QString)),
+                         this, SLOT(connectionFailed(QString)));
+        QObject::connect(esl, SIGNAL(disconnected()),
+                         this, SLOT(disconnected()));
+    }
+}
+
+void ConsolePlugin::readSettings()
+{
+    QSettings settings;
+    settings.beginGroup("Console");
+    consoleConfigPage->lineConsole->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_EMERG)).value<QPalette>());
+    consoleConfigPage->lineAlert->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ALERT)).value<QPalette>());
+    consoleConfigPage->lineCritical->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_CRIT)).value<QPalette>());
+    consoleConfigPage->lineError->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ERROR)).value<QPalette>());
+    consoleConfigPage->lineWarning->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_WARNING)).value<QPalette>());
+    consoleConfigPage->lineNotice->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_NOTICE)).value<QPalette>());
+    consoleConfigPage->lineInfo->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_INFO)).value<QPalette>());
+    consoleConfigPage->lineDebug->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_DEBUG)).value<QPalette>());
+    settings.endGroup();
+}
+
+void ConsolePlugin::writeSettings()
+{
+    QSettings settings;
+    settings.beginGroup("Console");
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_EMERG), consoleConfigPage->lineConsole->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ALERT), consoleConfigPage->lineAlert->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_CRIT), consoleConfigPage->lineCritical->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ERROR), consoleConfigPage->lineError->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_WARNING), consoleConfigPage->lineWarning->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_NOTICE), consoleConfigPage->lineNotice->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_INFO), consoleConfigPage->lineInfo->palette());
+    settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_DEBUG), consoleConfigPage->lineDebug->palette());
+    settings.endGroup();
+}
+
+void ConsolePlugin::changeConsoleBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineConsole->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineConsole->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineConsole->setPalette(palette);
+        consoleConfigPage->lineConsole->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeAlertBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineAlert->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineAlert->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineAlert->setPalette(palette);
+        consoleConfigPage->lineAlert->setAutoFillBackground(true);
+    }
+}
+
+
+void ConsolePlugin::changeCriticalBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineCritical->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineCritical->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineCritical->setPalette(palette);
+        consoleConfigPage->lineCritical->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeErrorBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineError->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineError->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineError->setPalette(palette);
+        consoleConfigPage->lineError->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeWarningBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineWarning->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineWarning->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineWarning->setPalette(palette);
+        consoleConfigPage->lineWarning->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeNoticeBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineNotice->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineNotice->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineNotice->setPalette(palette);
+        consoleConfigPage->lineNotice->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeInfoBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineInfo->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineInfo->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineInfo->setPalette(palette);
+        consoleConfigPage->lineInfo->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeDebugBackgroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineDebug->palette().color(QPalette::Base), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineDebug->palette();
+        palette.setColor(QPalette::Base, color);
+        consoleConfigPage->lineDebug->setPalette(palette);
+        consoleConfigPage->lineDebug->setAutoFillBackground(true);
+    }
+}
+
+void ConsolePlugin::changeConsoleForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineConsole->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineConsole->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineConsole->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeAlertForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineAlert->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineAlert->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineAlert->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeCriticalForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineCritical->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineCritical->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineCritical->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeErrorForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineError->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineError->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineError->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeWarningForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineWarning->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineWarning->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineWarning->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeNoticeForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineNotice->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineNotice->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineNotice->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeInfoForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineInfo->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineInfo->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineInfo->setPalette(palette);
+    }
+}
+
+void ConsolePlugin::changeDebugForegroundColor()
+{
+    QColor color = QColorDialog::getColor(consoleConfigPage->lineDebug->palette().color(QPalette::Text), this);
+    if (color.isValid())
+    {
+        QPalette palette = consoleConfigPage->lineDebug->palette();
+        palette.setColor(QPalette::Text, color);
+        consoleConfigPage->lineDebug->setPalette(palette);
+    }
+}
+
+Q_EXPORT_PLUGIN2(consoleplugin, ConsolePlugin)

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,61 @@
+#ifndef CONSOLEPLUGIN_H
+#define CONSOLEPLUGIN_H
+
+#include <QtGui/QMainWindow>
+#include <QtPlugin>
+#include <QtCore/QHash>
+#include "interfaces.h"
+#include "ui_centralWidget.h"
+
+namespace Ui
+{
+    class configPage;
+}
+class ESLconnection;
+
+class ConsolePlugin : public QMainWindow, public MonitorInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(MonitorInterface)
+public:
+    ConsolePlugin(QWidget *parent = 0);
+    ~ConsolePlugin();
+    QObject *getMonitorInterfaceObject();
+    QString appName();
+    QString appDescription();
+    void addConfigItens(SettingsDialog *);
+    void newInstance();
+    void setServerManager(ServerManager *manager);
+
+private slots:
+    void connected();
+    void disconnected();
+    void connectionFailed(QString);
+    void newConnection();
+    void changeConsoleBackgroundColor();
+    void changeAlertBackgroundColor();
+    void changeCriticalBackgroundColor();
+    void changeErrorBackgroundColor();
+    void changeWarningBackgroundColor();
+    void changeNoticeBackgroundColor();
+    void changeInfoBackgroundColor();
+    void changeDebugBackgroundColor();
+    void changeConsoleForegroundColor();
+    void changeAlertForegroundColor();
+    void changeCriticalForegroundColor();
+    void changeErrorForegroundColor();
+    void changeWarningForegroundColor();
+    void changeNoticeForegroundColor();
+    void changeInfoForegroundColor();
+    void changeDebugForegroundColor();
+    void readSettings();
+    void writeSettings();
+
+private:
+    Ui::consoleWindow *consoleWindow;
+    Ui::configPage *consoleConfigPage;
+    ServerManager *serverManager;
+    QHash<QString, ESLconnection *> hashESL;
+};
+
+#endif // CONSOLEPLUGIN_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,21 @@
+TEMPLATE = lib
+TARGET = ../../../bin/plugins/consoleplugin
+CONFIG += plugin
+INCLUDEPATH = ../../fsgui/ \
+    ../../interfaces \
+    ../../../../../../libs/esl/src/include/
+HEADERS = consoleplugin.h \
+    sortfilterproxymodel.h \
+    consoletabwidget.h
+SOURCES = consoleplugin.cpp \
+    sortfilterproxymodel.cpp \
+    consoletabwidget.cpp
+FORMS += centralWidget.ui \
+    console_settings.ui \
+    consoletabwidget.ui
+LIBS += -L \
+    ../../interfaces \
+    -linterfaces \
+    -L../../../../../../libs/esl/ \
+    -lesl
+RESOURCES += ../../resources/resources.qrc

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,182 @@
+#include "consoletabwidget.h"
+#include "ui_consoletabwidget.h"
+#include "eslconnection.h"
+
+ConsoleTabWidget::ConsoleTabWidget(QWidget *parent, ESLconnection *eslconnection) :
+    QWidget(parent),
+    m_ui(new Ui::ConsoleTabWidget),
+    esl(eslconnection)
+{
+    m_ui->setupUi(this);
+    sourceModel = new QStandardItemModel(this);
+    model = new SortFilterProxyModel(this);
+    model->setSourceModel(sourceModel);
+    model->setFilterKeyColumn(0);
+    m_ui->consoleListView->setModel(model);
+
+    QObject::connect(m_ui->btnSend, SIGNAL(clicked()),
+                     this, SLOT(cmdSendClicked()));
+    QObject::connect(m_ui->lineCmd, SIGNAL(textChanged(QString)),
+                     this, SLOT(lineCmdChanged(QString)));
+    QObject::connect(m_ui->checkEmerg, SIGNAL(clicked(bool)),
+                     this, SLOT(checkEmerg(bool)));
+    QObject::connect(m_ui->checkAlert, SIGNAL(clicked(bool)),
+                     this, SLOT(checkAlert(bool)));
+    QObject::connect(m_ui->checkCrit, SIGNAL(clicked(bool)),
+                     this, SLOT(checkCrit(bool)));
+    QObject::connect(m_ui->checkError, SIGNAL(clicked(bool)),
+                     this, SLOT(checkError(bool)));
+    QObject::connect(m_ui->checkNotice, SIGNAL(clicked(bool)),
+                     this, SLOT(checkNotice(bool)));
+    QObject::connect(m_ui->checkInfo, SIGNAL(clicked(bool)),
+                     this, SLOT(checkInfo(bool)));
+    QObject::connect(m_ui->checkDebug, SIGNAL(clicked(bool)),
+                     this, SLOT(checkDebug(bool)));
+
+    QObject::connect(esl, SIGNAL(connected()),
+                     this, SLOT(connected()));
+    QObject::connect(esl, SIGNAL(connectionFailed(QString)),
+                     this, SLOT(connectionFailed(QString)));
+    QObject::connect(esl, SIGNAL(disconnected()),
+                     this, SLOT(disconnected()));
+    QObject::connect(esl, SIGNAL(gotEvent(ESLevent*)),
+                     this, SLOT(gotEvent(ESLevent*)));
+
+    esl->connect();
+}
+
+ConsoleTabWidget::~ConsoleTabWidget()
+{
+    delete m_ui;
+}
+
+void ConsoleTabWidget::changeEvent(QEvent *e)
+{
+    QWidget::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        m_ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void ConsoleTabWidget::connected()
+{
+    m_ui->btnSend->setEnabled(true);
+    m_ui->lineCmd->setEnabled(true);
+    QStandardItem *item = new QStandardItem(tr("Connected!"));
+    item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
+    addNewConsoleItem(item);
+}
+
+void ConsoleTabWidget::disconnected()
+{
+    m_ui->btnSend->setEnabled(false);
+    m_ui->lineCmd->setEnabled(false);
+    QStandardItem *item = new QStandardItem(tr("Disconnected!"));
+    item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
+    addNewConsoleItem(item);
+}
+
+void ConsoleTabWidget::connectionFailed(QString reason)
+{
+    m_ui->btnSend->setEnabled(false);
+    m_ui->lineCmd->setEnabled(false);
+    QStandardItem *item = new QStandardItem(tr("Connection Failed! Reason: %1").arg(reason));
+    item->setData(ESL_LOG_LEVEL_EMERG, Qt::UserRole);
+    addNewConsoleItem(item);
+}
+
+void ConsoleTabWidget::gotEvent(ESLevent * event)
+{
+    if (event->getBody())
+    {
+        QString text(event->getBody());
+
+        /* 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];
+            if (line == textList.size()-1)
+            {
+                final_str.chop(1);
+            }
+        }
+        QStringList lines = final_str.split('\n', QString::SkipEmptyParts);
+        for (int line = 0; line < lines.size(); ++line)
+        {
+            QStandardItem *item = new QStandardItem(lines[line]);
+            item->setData(QString(event->getHeader("Log-Level")).toInt(), Qt::UserRole);
+            addNewConsoleItem(item);
+        }
+    }
+    delete event;
+}
+
+void ConsoleTabWidget::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>();
+    item->setBackground(palette.base());
+    item->setForeground(palette.text());
+    if (m_ui->consoleListView->verticalScrollBar()->value() == m_ui->consoleListView->verticalScrollBar()->maximum())
+    {
+        sourceModel->appendRow(item);
+        m_ui->consoleListView->scrollToBottom();
+    }
+    else
+    {
+        sourceModel->appendRow(item);
+    }
+}
+
+void ConsoleTabWidget::cmdSendClicked()
+{
+    esl->bgapi(m_ui->lineCmd->text());
+    m_ui->lineCmd->clear();
+}
+
+void ConsoleTabWidget::lineCmdChanged(QString text)
+{
+    m_ui->btnSend->setDisabled(text.isEmpty());
+}
+
+void ConsoleTabWidget::checkEmerg(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_EMERG, state);
+}
+
+void ConsoleTabWidget::checkAlert(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_ALERT, state);
+}
+
+void ConsoleTabWidget::checkCrit(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_CRIT, state);
+}
+
+void ConsoleTabWidget::checkError(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_ERROR, state);
+}
+
+void ConsoleTabWidget::checkNotice(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_NOTICE, state);
+}
+
+void ConsoleTabWidget::checkInfo(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_INFO, state);
+}
+
+void ConsoleTabWidget::checkDebug(bool state)
+{
+    model->setLogLevelFilter(ESL_LOG_LEVEL_DEBUG, state);
+}

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,48 @@
+#ifndef CONSOLETABWIDGET_H
+#define CONSOLETABWIDGET_H
+
+#include <QtGui/QWidget>
+#include "sortfilterproxymodel.h"
+
+namespace Ui {
+    class ConsoleTabWidget;
+}
+
+class QStandardItem;
+class QStandardItemModel;
+class ESLconnection;
+class ESLevent;
+
+class ConsoleTabWidget : public QWidget {
+    Q_OBJECT
+public:
+    ConsoleTabWidget(QWidget *parent, ESLconnection *eslconnection);
+    ~ConsoleTabWidget();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void connected();
+    void disconnected();
+    void connectionFailed(QString);
+    void gotEvent(ESLevent *);
+    void addNewConsoleItem(QStandardItem *item);
+    void cmdSendClicked();
+    void lineCmdChanged(QString);
+    void checkEmerg(bool);
+    void checkAlert(bool);
+    void checkCrit(bool);
+    void checkError(bool);
+    void checkNotice(bool);
+    void checkInfo(bool);
+    void checkDebug(bool);
+
+private:
+    Ui::ConsoleTabWidget *m_ui;
+    QStandardItemModel *sourceModel;
+    SortFilterProxyModel *model;
+    ESLconnection *esl;
+};
+
+#endif // CONSOLETABWIDGET_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.ui	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConsoleTabWidget</class>
+ <widget class="QWidget" name="ConsoleTabWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>391</width>
+    <height>344</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <item>
+        <widget class="QListView" name="consoleListView"/>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox">
+         <property name="maximumSize">
+          <size>
+           <width>120</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="title">
+          <string>Log Level</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>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QLineEdit" name="lineCmd">
+         <property name="enabled">
+          <bool>false</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>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.cpp	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,24 @@
+#include <QtGui>
+#include "sortfilterproxymodel.h"
+
+SortFilterProxyModel::SortFilterProxyModel(QObject *parent)
+        : QSortFilterProxyModel(parent)
+{
+    // Get from config?
+    for(int i = 0; i < 8; i++)
+        loglevels.insert(i, true);
+}
+
+void SortFilterProxyModel::setLogLevelFilter(int level, bool state)
+{
+    loglevels.replace(level, state);
+    // Let us filter
+    invalidateFilter();
+}
+
+bool SortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+    QModelIndex index0 = sourceModel()->index(source_row, 0, source_parent);
+
+    return loglevels.value(sourceModel()->data(index0, Qt::UserRole).toInt()) == true;
+}

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/sortfilterproxymodel.h	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,22 @@
+#ifndef SORTFILTERPROXYMODEL_H
+#define SORTFILTERPROXYMODEL_H
+
+#include <QSortFilterProxyModel>
+#include <QVector>
+
+class SortFilterProxyModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
+
+public:
+    SortFilterProxyModel(QObject *parent = 0);
+    void setLogLevelFilter(int level, bool state);
+
+protected:
+    bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+
+private:
+    QVector<bool> loglevels;
+};
+
+#endif // SORTFILTERPROXYMODEL_H

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/connect_icon.png


(Binary files differ)
Property changes on: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/connect_icon.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/edit_icon.png


(Binary files differ)
Property changes on: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/edit_icon.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/fsgui_logo.png


(Binary files differ)
Property changes on: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/fsgui_logo.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/new_server_icon.png


(Binary files differ)
Property changes on: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/new_server_icon.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/remove_server_icon.png


(Binary files differ)
Property changes on: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/remove_server_icon.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/resources.qrc (0 => 14463)


--- freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/resources.qrc	                        (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/resources.qrc	2009-08-08 23:33:24 UTC (rev 14463)
@@ -0,0 +1,11 @@
+<RCC>
+    <qresource prefix="/icons" >
+        <file>fsgui_logo.png</file>
+        <file>new_server_icon.png</file>
+        <file>remove_server_icon.png</file>
+        <file>connect_icon.png</file>
+        <file>save.png</file>
+        <file>server_icon.png</file>
+        <file>edit_icon.png</file>
+    </qresource>
+</RCC>

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/save.png


(Binary files differ)
Property changes on: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/save.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream

Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/server_icon.png


(Binary files differ)
Property changes on: freeswitch/trunk/contrib/jmesquita/fsgui/src/resources/server_icon.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream