aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/epan/pluginifdemo/ui
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/epan/pluginifdemo/ui')
-rw-r--r--plugins/epan/pluginifdemo/ui/pluginifdemo_about.cpp61
-rw-r--r--plugins/epan/pluginifdemo/ui/pluginifdemo_about.h65
-rw-r--r--plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui156
-rw-r--r--plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp394
-rw-r--r--plugins/epan/pluginifdemo/ui/pluginifdemo_main.h136
-rw-r--r--plugins/epan/pluginifdemo/ui/pluginifdemo_main.ui369
-rw-r--r--plugins/epan/pluginifdemo/ui/uiclasshandler.cpp128
-rw-r--r--plugins/epan/pluginifdemo/ui/uihandler.cpp81
-rw-r--r--plugins/epan/pluginifdemo/ui/uihandler.h101
9 files changed, 1491 insertions, 0 deletions
diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_about.cpp b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.cpp
new file mode 100644
index 0000000000..048bcc1a84
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.cpp
@@ -0,0 +1,61 @@
+/* pluginifdemo_about.cpp
+ *
+ * Author: Roland Knall <rknall@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <plugins/pluginifdemo/ui/pluginifdemo_about.h>
+#include <ui_pluginifdemo_about.h>
+
+#include <config.h>
+
+#include <QDialog>
+#include <QWidget>
+#include <QAbstractButton>
+
+PluginIFDemo_About::PluginIFDemo_About(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::PluginIFDemo_About)
+{
+ ui->setupUi(this);
+}
+
+PluginIFDemo_About::~PluginIFDemo_About()
+{
+ delete ui;
+}
+
+void PluginIFDemo_About::on_buttonBox_clicked(QAbstractButton *)
+{
+ this->close();
+}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_about.h b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.h
new file mode 100644
index 0000000000..aa4bb4726d
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.h
@@ -0,0 +1,65 @@
+/* pluginifdemo_about.h
+ *
+ * Author: Roland Knall <rknall@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef PLUGINIFDEMO_ABOUT_H_
+#define PLUGINIFDEMO_ABOUT_H_
+
+#include <QWidget>
+#include <QDialog>
+#include <QAbstractButton>
+#include <QPixmap>
+#include <QGraphicsScene>
+
+namespace Ui {
+class PluginIFDemo_About;
+}
+
+class PluginIFDemo_About : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit PluginIFDemo_About(QWidget *parent = 0);
+ ~PluginIFDemo_About();
+
+private slots:
+ void on_buttonBox_clicked(QAbstractButton *button);
+
+private:
+ Ui::PluginIFDemo_About *ui;
+};
+
+#endif /* PLUGINIFDEMO_ABOUT_H_ */
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui
new file mode 100644
index 0000000000..2353dd76ac
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PluginIFDemo_About</class>
+ <widget class="QDialog" name="PluginIFDemo_About">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>545</width>
+ <height>401</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>545</width>
+ <height>401</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>545</width>
+ <height>401</height>
+ </size>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="windowTitle">
+ <string>About Plugin Interface Demonstrator</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>10</number>
+ </property>
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="lblAboutDialog">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;PlugIn Interface Demonstration&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;Version: &lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;0.0.1 &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Copyright © &lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-style:italic;&quot;&gt;Wireshark Foundation&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;a href=&quot;http://www.wireshark.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;www.wireshark.org&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>License Information</string>
+ </attribute>
+ <widget class="QLabel" name="lblLicense">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>0</y>
+ <width>511</width>
+ <height>102</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This PlugIn demonstrates functionality of the interface API for plugins and extcap interfaces.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <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="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Ok</set>
+ </property>
+ <property name="centerButtons">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp
new file mode 100644
index 0000000000..d29c47ad50
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp
@@ -0,0 +1,394 @@
+/* pluginifdemo_main.cpp
+ *
+ * Author: Roland Knall <rknall@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <plugins/pluginifdemo/ui/pluginifdemo_main.h>
+#include <ui_pluginifdemo_main.h>
+
+#include <config.h>
+
+#include <ui/uihandler.h>
+
+#include <QWidget>
+#include <QLineEdit>
+#include <QListView>
+#include <QStandardItemModel>
+
+PluginIfType::PluginIfType(const QString &label, const ext_toolbar_item_t &itemType)
+ : m_label(label), m_itemType(itemType)
+{}
+
+QString PluginIfType::label() const { return m_label; }
+ext_toolbar_item_t PluginIfType::itemType() const { return m_itemType; }
+
+PluginIfTypeModel::PluginIfTypeModel(QObject * parent)
+ :QAbstractListModel(parent)
+{
+}
+
+void PluginIfTypeModel::addPluginIfType(const PluginIfType &ifType)
+{
+ beginInsertRows(QModelIndex(), rowCount(), rowCount());
+ m_pluginIfTypes << ifType;
+ endInsertRows();
+}
+
+int PluginIfTypeModel::rowCount(const QModelIndex &) const
+{
+ return m_pluginIfTypes.count();
+}
+
+QVariant PluginIfTypeModel::data(const QModelIndex & idx, int role) const
+{
+ if ( idx.row() < 0 || idx.row() >= m_pluginIfTypes.count() )
+ return QVariant();
+
+ const PluginIfType &ifType = m_pluginIfTypes[idx.row()];
+ if ( role == Qt::UserRole )
+ {
+ return ifType.itemType();
+ } else if ( role == Qt::DisplayRole ) {
+ return ifType.label();
+ }
+
+ return QVariant();
+}
+
+PluginIfTypeSortFilterProxyModel::PluginIfTypeSortFilterProxyModel(QObject * parent)
+:QSortFilterProxyModel(parent)
+{
+ m_filterType = EXT_TOOLBAR_BOOLEAN;
+}
+
+void PluginIfTypeSortFilterProxyModel::setFilterElement(ext_toolbar_item_t filterType)
+{
+ m_filterType = filterType;
+ invalidateFilter();
+}
+
+bool PluginIfTypeSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ QModelIndex dataIndex = sourceModel()->index(sourceRow, 0, sourceParent);
+ QVariant varData = sourceModel()->data(dataIndex, Qt::UserRole);
+ if ( varData.isValid() && varData.toInt() == (int) m_filterType )
+ return true;
+
+ return false;
+}
+
+PluginIFDemo_Main::PluginIFDemo_Main(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::PluginIFDemo_Main)
+{
+ ui->setupUi(this);
+
+ _toolbar = 0;
+ sourceModel = new PluginIfTypeModel(this);
+ proxyModel = new PluginIfTypeSortFilterProxyModel(this);
+ proxyModel->setSourceModel(sourceModel);
+ ui->cmbElements->setModel(proxyModel);
+
+ listModel = new QStandardItemModel(this);
+ ui->lstItems->setModel(listModel);
+
+ indexModel = new QStandardItemModel(this);
+ ui->cmbEntryIndex->setModel(indexModel);
+
+ ui->logView->setModel(new QStandardItemModel(ui->logView));
+
+ ui->tabInterfaceTypes->setCurrentIndex(0);
+
+ connect ( GuiHandler::getInstance(), SIGNAL(reset(void)), this, SLOT(closeDialog()) );
+ connect ( GuiHandler::getInstance(), SIGNAL(logChanged(QString)), this, SLOT(logChanged(QString)) );
+}
+
+PluginIFDemo_Main::~PluginIFDemo_Main()
+{
+ delete ui;
+}
+
+void PluginIFDemo_Main::setToolbar(ext_toolbar_t * &toolbar)
+{
+ _toolbar = toolbar;
+
+ GList * walker = toolbar->children;
+ while ( walker && walker->data )
+ {
+ ext_toolbar_t * entry = (ext_toolbar_t *)walker->data;
+ if ( entry && entry->type == EXT_TOOLBAR_ITEM && entry->name )
+ sourceModel->addPluginIfType(PluginIfType(QString(entry->name), entry->item_type));
+ walker = g_list_next(walker);
+ }
+}
+
+void PluginIFDemo_Main::closeDialog()
+{
+ this->close();
+}
+
+void PluginIFDemo_Main::on_buttonBox_clicked(QAbstractButton *button _U_)
+{
+ this->close();
+}
+
+void PluginIFDemo_Main::logChanged(QString message)
+{
+ QStandardItemModel * model = (QStandardItemModel *) ui->logView->model();
+ model->appendRow(new QStandardItem(message));
+}
+
+void PluginIFDemo_Main::on_btnSendButtonText_clicked()
+{
+ if ( ! _toolbar )
+ return;
+
+ ext_toolbar_t *item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item )
+ return;
+
+ QString entryText = ui->txtButtonName->text();
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ ext_toolbar_update_value(item, (gpointer) entryText.toStdString().c_str(), silent);
+}
+
+void PluginIFDemo_Main::on_btnSendText_clicked()
+{
+ if ( ! _toolbar )
+ return;
+
+ ext_toolbar_t *item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item )
+ return;
+
+ QString entryText = ui->txtEdit->text();
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ ext_toolbar_update_value(item, (gpointer) entryText.toStdString().c_str(), silent);
+}
+
+void PluginIFDemo_Main::on_chkTestCheckbox_stateChanged(int newState)
+{
+ if ( ! _toolbar )
+ return;
+
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item )
+ return;
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ ext_toolbar_update_value(item, GINT_TO_POINTER(newState == Qt::Checked ? 1 : 0), silent);
+}
+
+void PluginIFDemo_Main::on_tabInterfaceTypes_currentChanged(int newTab)
+{
+ proxyModel->setFilterElement((ext_toolbar_item_t) newTab);
+}
+
+void PluginIFDemo_Main::on_cmbElements_currentTextChanged(const QString & newText)
+{
+ if ( ! _toolbar )
+ return;
+
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, newText.toStdString().c_str());
+ if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR )
+ return;
+
+ listModel->clear();
+ indexModel->clear();
+
+ GList * walker = item->values;
+ while ( walker && walker->data )
+ {
+ ext_toolbar_value_t * listItem = (ext_toolbar_value_t *)walker->data;
+ QString content = QString("%1: %2").arg(listItem->value).arg(listItem->display);
+ listModel->appendRow(new QStandardItem(content));
+ indexModel->appendRow(new QStandardItem(listItem->value));
+
+ walker = g_list_next(walker);
+ }
+
+}
+
+void PluginIFDemo_Main::on_btnEnable_clicked()
+{
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item )
+ return;
+
+ ext_toolbar_update_data_set_active(item, true);
+}
+
+void PluginIFDemo_Main::on_btnDisable_clicked()
+{
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item )
+ return;
+
+ ext_toolbar_update_data_set_active(item, false);
+}
+
+void PluginIFDemo_Main::on_btnAddItem_clicked()
+{
+ if ( ui->txtNewItemDisplay->text().length() <= 0 || ui->txtNewItemValue->text().length() <= 0 )
+ return;
+
+ QString content = QString("%1: %2").arg(ui->txtNewItemValue->text()).arg(ui->txtNewItemDisplay->text());
+
+ QList<QStandardItem *> items = listModel->findItems(content);
+ if ( items.count() > 0 )
+ return;
+ items = listModel->findItems(QString("%1: ").arg(ui->txtNewItemValue->text()), Qt::MatchStartsWith);
+ if ( items.count() > 0 )
+ return;
+
+ listModel->appendRow(new QStandardItem(content));
+
+ if ( ui->chkAddRemoveImmediate->checkState() == Qt::Checked )
+ {
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR )
+ return;
+
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ gchar * value = g_strdup(ui->txtNewItemValue->text().toUtf8().constData());
+ gchar * display = g_strdup(ui->txtNewItemDisplay->text().toUtf8().constData());
+ ext_toolbar_update_data_add_entry(item, display, value, silent);
+ g_free(value);
+ g_free(display);
+ }
+}
+
+void PluginIFDemo_Main::on_btnRemoveItem_clicked()
+{
+ QItemSelectionModel * selModel = ui->lstItems->selectionModel();
+
+ if ( selModel->selectedIndexes().count() == 0 )
+ return;
+
+ QModelIndexList selIndeces = selModel-> selectedIndexes();
+ foreach(QModelIndex idx, selIndeces)
+ {
+ if ( ui->chkAddRemoveImmediate->checkState() == Qt::Checked )
+ {
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR )
+ return;
+
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ QString content = listModel->data(idx).toString();
+ int pos = content.indexOf(":");
+
+ gchar * value = g_strdup(content.left(pos).toUtf8().constData() );
+ /* -2 because removal of : and space */
+ gchar * display = g_strdup(content.right(content.size() - pos - 2).toUtf8().constData());
+ ext_toolbar_update_data_remove_entry(item, display, value, silent);
+ g_free(value);
+ g_free(display);
+ }
+
+ listModel->removeRow(idx.row());
+ }
+}
+
+void PluginIFDemo_Main::on_btnSendList_clicked()
+{
+ if ( ! _toolbar )
+ return;
+
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR )
+ return;
+
+ GList * items = NULL;
+
+ for( int i = 0; i < listModel->rowCount(); i++ )
+ {
+ QString content = listModel->data(listModel->index(i, 0)).toString();
+ int pos = content.indexOf(":");
+
+ ext_toolbar_value_t * valEntry = g_new0(ext_toolbar_value_t, 1);
+ valEntry->value = g_strdup(content.left(pos).toStdString().c_str() );
+ valEntry->display = g_strdup(content.right(content.size() - pos + 1).toStdString().c_str());
+
+ items = g_list_append(items, valEntry);
+ }
+
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ ext_toolbar_update_data(item, items , silent);
+}
+
+void PluginIFDemo_Main::on_btnSendUpdateItem_clicked()
+{
+ if ( ! _toolbar )
+ return;
+
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR )
+ return;
+
+ QString cmbIndexText = ui->cmbEntryIndex->currentText();
+ QString displayValue = ui->txtUpdateDisplayValue->text();
+ if ( displayValue.length() == 0 )
+ return;
+
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ ext_toolbar_update_data_by_index(item,
+ (gpointer) displayValue.toStdString().c_str(), (gpointer) cmbIndexText.toStdString().c_str(), silent );
+}
+
+void PluginIFDemo_Main::on_lstItems_clicked(const QModelIndex &idx)
+{
+ if ( ! _toolbar || ! idx.isValid() )
+ return;
+
+ ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str());
+ if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR )
+ return;
+
+ bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false;
+
+ QString content = listModel->data(listModel->index(idx.row(), 0)).toString();
+ int pos = content.indexOf(":");
+
+ gchar * idxData = g_strdup(content.left(pos).toUtf8().constData() );
+
+ ext_toolbar_update_value(item, idxData, silent);
+ g_free(idxData);
+
+}
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_main.h b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.h
new file mode 100644
index 0000000000..3854967d1d
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.h
@@ -0,0 +1,136 @@
+/* pluginifdemo_main.h
+ *
+ * Author: Roland Knall <rknall@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef PLUGINIFDEMO_MAIN_H_
+#define PLUGINIFDEMO_MAIN_H_
+
+#include <QWidget>
+#include <QDialog>
+#include <QAbstractButton>
+#include <QListWidget>
+#include <QAbstractListModel>
+#include <QSortFilterProxyModel>
+#include <QStandardItemModel>
+
+#include <plugin_if.h>
+
+namespace Ui {
+class PluginIFDemo_Main;
+}
+
+class PluginIfType
+{
+public:
+ PluginIfType(const QString &label, const ext_toolbar_item_t &itemType);
+
+ QString label() const;
+ ext_toolbar_item_t itemType() const;
+private:
+ QString m_label;
+ ext_toolbar_item_t m_itemType;
+};
+
+class PluginIfTypeModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ PluginIfTypeModel(QObject * parent = 0);
+
+ void addPluginIfType(const PluginIfType & pluginIfType);
+
+ int rowCount(const QModelIndex & parent = QModelIndex()) const;
+ QVariant data(const QModelIndex & idx, int role = Qt::DisplayRole) const;
+
+private:
+ QList<PluginIfType> m_pluginIfTypes;
+
+};
+
+class PluginIfTypeSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+public:
+ PluginIfTypeSortFilterProxyModel(QObject * parent = 0);
+
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+ void setFilterElement(ext_toolbar_item_t filterType);
+
+private:
+ ext_toolbar_item_t m_filterType;
+};
+
+class PluginIFDemo_Main : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit PluginIFDemo_Main(QWidget *parent = 0);
+ ~PluginIFDemo_Main();
+
+ void setToolbar(ext_toolbar_t * &toolbar);
+
+private slots:
+ void on_buttonBox_clicked(QAbstractButton *button);
+ void on_btnSendButtonText_clicked();
+ void on_btnSendText_clicked();
+ void on_btnSendUpdateItem_clicked();
+ void on_chkTestCheckbox_stateChanged(int newState);
+ void on_tabInterfaceTypes_currentChanged(int newTab);
+ void on_btnAddItem_clicked();
+ void on_btnRemoveItem_clicked();
+ void on_btnSendList_clicked();
+ void on_cmbElements_currentTextChanged(const QString & newText);
+ void on_lstItems_clicked(const QModelIndex &idx);
+ void on_btnEnable_clicked();
+ void on_btnDisable_clicked();
+
+ void logChanged(QString message);
+ void closeDialog();
+
+private:
+ Ui::PluginIFDemo_Main *ui;
+
+ PluginIfTypeModel * sourceModel;
+ PluginIfTypeSortFilterProxyModel * proxyModel;
+ QStandardItemModel * listModel;
+ QStandardItemModel * indexModel;
+
+ ext_toolbar_t * _toolbar;
+};
+
+
+#endif /* PLUGINIFDEMO_MAIN_H_ */
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_main.ui b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.ui
new file mode 100644
index 0000000000..467ec85e07
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.ui
@@ -0,0 +1,369 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PluginIFDemo_Main</class>
+ <widget class="QDialog" name="PluginIFDemo_Main">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>570</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>500</width>
+ <height>570</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QTabWidget" name="tabInterfaceTypes">
+ <property name="currentIndex">
+ <number>3</number>
+ </property>
+ <widget class="QWidget" name="tabBoolean">
+ <attribute name="title">
+ <string>Boolean</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="chkTestCheckbox">
+ <property name="text">
+ <string>Check the value in the toolbar checkbox</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <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>
+ <widget class="QWidget" name="tabButton">
+ <attribute name="title">
+ <string>Button</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0">
+ <item>
+ <widget class="QLineEdit" name="txtButtonName">
+ <property name="placeholderText">
+ <string>Text to be sent to toolbar</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnSendButtonText">
+ <property name="text">
+ <string>Send Text</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_4">
+ <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>
+ <widget class="QWidget" name="tabString">
+ <attribute name="title">
+ <string>String</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
+ <item>
+ <widget class="QLineEdit" name="txtEdit">
+ <property name="placeholderText">
+ <string>Text to be sent to toolbar</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnSendText">
+ <property name="text">
+ <string>Send Text</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_3">
+ <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>
+ <widget class="QWidget" name="tabSelector">
+ <attribute name="title">
+ <string>Selector</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Display:</string>
+ </property>
+ <property name="buddy">
+ <cstring>txtNewItemDisplay</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="txtNewItemDisplay">
+ <property name="placeholderText">
+ <string>Enter display text</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Value:</string>
+ </property>
+ <property name="buddy">
+ <cstring>txtNewItemValue</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="txtNewItemValue">
+ <property name="placeholderText">
+ <string>Enter value text</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnAddItem">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QListView" name="lstItems"/>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="btnRemoveItem">
+ <property name="text">
+ <string>Remove</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>
+ <item>
+ <widget class="QPushButton" name="btnSendList">
+ <property name="text">
+ <string>Send List</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="chkAddRemoveImmediate">
+ <property name="text">
+ <string>Add and remove will immediately be send to interface</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="chkSendSelect">
+ <property name="text">
+ <string>Update interface with selection</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Update</string>
+ </property>
+ <property name="buddy">
+ <cstring>cmbEntryIndex</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="cmbEntryIndex"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>with</string>
+ </property>
+ <property name="buddy">
+ <cstring>txtUpdateDisplayValue</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="txtUpdateDisplayValue">
+ <property name="placeholderText">
+ <string>Enter value text</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnSendUpdateItem">
+ <property name="text">
+ <string>Send</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Element to be updated</string>
+ </property>
+ <property name="buddy">
+ <cstring>cmbElements</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <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 row="1" column="1">
+ <widget class="QPushButton" name="btnEnable">
+ <property name="text">
+ <string>Enable element</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="btnDisable">
+ <property name="text">
+ <string>Disable element</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QComboBox" name="cmbElements"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="chkSilent">
+ <property name="text">
+ <string>Activate updates silently</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListView" name="logView"/>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/epan/pluginifdemo/ui/uiclasshandler.cpp b/plugins/epan/pluginifdemo/ui/uiclasshandler.cpp
new file mode 100644
index 0000000000..e88f17a35e
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/uiclasshandler.cpp
@@ -0,0 +1,128 @@
+/* uiclasshandler.cpp
+ *
+ * Author: Roland Knall <rknall@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+
+#include <QObject>
+#include <QApplication>
+#include <QMutex>
+
+#include <epan/plugin_if.h>
+
+#if defined(_WIN32)
+#define _WINSOCKAPI_
+#endif
+
+#include <ui/qt/main_window.h>
+
+#include <ui/uihandler.h>
+#include <ui/pluginifdemo_main.h>
+#include <ui/pluginifdemo_about.h>
+
+QMutex * GuiHandler::singletonMutex = new QMutex();
+
+GuiHandler::GuiHandler()
+{
+}
+
+GuiHandler * GuiHandler::getInstance()
+{
+ static GuiHandler * instance = 0;
+
+ QMutexLocker locker(singletonMutex);
+
+ if ( instance == 0 )
+ {
+ instance = new GuiHandler();
+ }
+
+ return instance;
+}
+
+void GuiHandler::showAboutDialog(ext_menubar_gui_type gui_type _U_, gpointer gui_data _U_)
+{
+ PluginIFDemo_About * mainwindow = new PluginIFDemo_About();
+ executeDialog((QDialog*)mainwindow);
+}
+
+void GuiHandler::showMainDialog(ext_menubar_gui_type gui_type _U_, gpointer gui_data _U_)
+{
+ PluginIFDemo_Main * mainwindow = new PluginIFDemo_Main();
+ mainwindow->setToolbar(_toolbar);
+ executeDialog((QDialog*)mainwindow);
+}
+
+void GuiHandler::executeDialog(QDialog * dialog)
+{
+ bool hasGuiApp = (qobject_cast<QApplication*>(QCoreApplication::instance())!=0);
+
+ if ( ! hasGuiApp )
+ {
+ /* Necessity for creating the correct app context */
+ int argc = 1;
+ char * argv = (char *) "Test";
+
+ /* In Gtk there is no application context, must be created and displayed */
+ QApplication app(argc, &argv);
+
+ dialog->show();
+
+ app.exec();
+ }
+ else
+ {
+ /* With Wireshark Qt, an application context already exists, therefore just
+ * displaying the dialog using show to have it non-modal */
+ dialog->show();
+ }
+}
+
+void GuiHandler::doReset()
+{
+ emit reset();
+}
+
+void GuiHandler::addLogMessage(QString message)
+{
+ emit logChanged(message);
+}
+
+void GuiHandler::setToolbar(ext_toolbar_t * toolbar)
+{
+ _toolbar = toolbar;
+}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/plugins/epan/pluginifdemo/ui/uihandler.cpp b/plugins/epan/pluginifdemo/ui/uihandler.cpp
new file mode 100644
index 0000000000..8dc3940669
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/uihandler.cpp
@@ -0,0 +1,81 @@
+/* uihandler.cpp
+ * Author: Roland Knall <rknall@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+
+#include <QObject>
+#include <QApplication>
+
+#include <epan/plugin_if.h>
+#include <epan/tap.h>
+
+#if defined(_WIN32)
+#define _WINSOCKAPI_
+#endif
+
+#include <ui/qt/main_window.h>
+
+#include <ui/uihandler.h>
+
+static void
+reset_dialog(void *data _U_)
+{
+ GuiHandler::getInstance()->doReset();
+}
+
+void pluginifdemo_ui_main(ext_menubar_gui_type gui_type, gpointer gui_data)
+{
+ /* ensures, that the dialog is closing, if scm udid is set or a filter is applied */
+ register_tap_listener("frame", NULL, NULL, 0, reset_dialog, NULL, NULL );
+
+ GuiHandler::getInstance()->showMainDialog(gui_type, gui_data);
+}
+
+void pluginifdemo_ui_about(ext_menubar_gui_type gui_type, gpointer gui_data)
+{
+ GuiHandler::getInstance()->showAboutDialog(gui_type, gui_data);
+}
+
+void pluginifdemo_toolbar_log(const gchar * message)
+{
+ GuiHandler::getInstance()->addLogMessage(QString(message));
+}
+
+void pluginifdemo_toolbar_register(ext_toolbar_t * toolbar)
+{
+ GuiHandler::getInstance()->setToolbar(toolbar);
+}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/plugins/epan/pluginifdemo/ui/uihandler.h b/plugins/epan/pluginifdemo/ui/uihandler.h
new file mode 100644
index 0000000000..ce78a23940
--- /dev/null
+++ b/plugins/epan/pluginifdemo/ui/uihandler.h
@@ -0,0 +1,101 @@
+/* uihandler.h
+ * Author: Roland Knall <rknall@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef PLUGINIFDEMO_UI_UIHANDLER_H_
+#define PLUGINIFDEMO_UI_UIHANDLER_H_
+
+#ifdef __cplusplus
+
+#include <QObject>
+#include <QDialog>
+#include <QMutex>
+
+#include <epan/plugin_if.h>
+
+#include "ws_symbol_export.h"
+
+class WS_DLL_PUBLIC_DEF GuiHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ static GuiHandler * getInstance();
+
+ void showAboutDialog(ext_menubar_gui_type gui_type, gpointer gui_data);
+ void showMainDialog(ext_menubar_gui_type gui_type, gpointer gui_data);
+
+ void doReset();
+
+ void addLogMessage(QString message);
+
+ void setToolbar(ext_toolbar_t * toolbar);
+ ext_toolbar_t * toolBar();
+
+signals:
+ void reset();
+ void logChanged(QString newEntry);
+
+protected:
+
+ GuiHandler();
+
+ // Stop the compiler generating methods of "copy the object"
+ GuiHandler(GuiHandler const& copy); // Not implemented
+ GuiHandler& operator=(GuiHandler const& copy); // Not implemented
+
+private:
+
+ static QMutex * singletonMutex;
+
+ ext_toolbar_t * _toolbar;
+
+ void executeDialog(QDialog * object);
+};
+
+extern "C" {
+#endif
+
+extern void pluginifdemo_ui_about(ext_menubar_gui_type gui_type, gpointer gui_data);
+extern void pluginifdemo_ui_main(ext_menubar_gui_type gui_type, gpointer gui_data);
+extern void pluginifdemo_toolbar_log(const gchar * message);
+
+extern void pluginifdemo_toolbar_register(ext_toolbar_t * toolbar);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BURANALYZER_UI_UIHANDLER_H_ */
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */