3 * Author: Roland Knall <rknall@gmail.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include <QApplication>
20 #include <epan/plugin_if.h>
26 #include <ui/qt/main_window.h>
28 #include "uihandler.h"
29 #include "pluginifdemo_main.h"
30 #include "pluginifdemo_about.h"
32 QMutex
* GuiHandler::singletonMutex
= new QMutex();
34 GuiHandler::GuiHandler()
38 GuiHandler
* GuiHandler::getInstance()
40 static GuiHandler
* instance
= 0;
42 QMutexLocker
locker(singletonMutex
);
46 instance
= new GuiHandler();
52 void GuiHandler::showAboutDialog(ext_menubar_gui_type gui_type _U_
, gpointer gui_data _U_
)
54 PluginIFDemo_About
* mainwindow
= new PluginIFDemo_About();
55 executeDialog((QDialog
*)mainwindow
);
58 void GuiHandler::showMainDialog(ext_menubar_gui_type gui_type _U_
, gpointer gui_data _U_
)
60 PluginIFDemo_Main
* mainwindow
= new PluginIFDemo_Main();
61 mainwindow
->setToolbar(_toolbar
);
62 executeDialog((QDialog
*)mainwindow
);
65 void GuiHandler::executeDialog(QDialog
* dialog
)
67 bool hasGuiApp
= (qobject_cast
<QApplication
*>(QCoreApplication::instance())!=0);
71 /* Necessity for creating the correct app context */
73 char * argv
= (char *) "Test";
75 /* In Gtk there is no application context, must be created and displayed */
76 QApplication
app(argc
, &argv
);
84 /* With Wireshark Qt, an application context already exists, therefore just
85 * displaying the dialog using show to have it non-modal */
90 void GuiHandler::doReset()
95 void GuiHandler::addLogMessage(QString message
)
97 emit
logChanged(message
);
100 void GuiHandler::setToolbar(ext_toolbar_t
* toolbar
)
111 * indent-tabs-mode: nil
114 * ex: set shiftwidth=4 tabstop=8 expandtab:
115 * :indentSize=4:tabSize=8:noTabs=true: