summaryrefslogtreecommitdiff
path: root/plugins/pluginifdemo
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pluginifdemo')
-rw-r--r--plugins/pluginifdemo/AUTHORS2
-rw-r--r--plugins/pluginifdemo/CMakeLists.txt87
-rw-r--r--plugins/pluginifdemo/COPYING340
-rw-r--r--plugins/pluginifdemo/Makefile.am66
-rw-r--r--plugins/pluginifdemo/NEWS1
-rw-r--r--plugins/pluginifdemo/README2
-rw-r--r--plugins/pluginifdemo/moduleinfo.h39
-rw-r--r--plugins/pluginifdemo/plugin.rc.in34
-rw-r--r--plugins/pluginifdemo/pluginifdemo.c157
-rw-r--r--plugins/pluginifdemo/pluginifdemo.h23
-rw-r--r--plugins/pluginifdemo/ui/pluginifdemo_about.cpp61
-rw-r--r--plugins/pluginifdemo/ui/pluginifdemo_about.h65
-rw-r--r--plugins/pluginifdemo/ui/pluginifdemo_about.ui156
-rw-r--r--plugins/pluginifdemo/ui/pluginifdemo_main.cpp320
-rw-r--r--plugins/pluginifdemo/ui/pluginifdemo_main.h133
-rw-r--r--plugins/pluginifdemo/ui/pluginifdemo_main.ui315
-rw-r--r--plugins/pluginifdemo/ui/uiclasshandler.cpp128
-rw-r--r--plugins/pluginifdemo/ui/uihandler.cpp81
-rw-r--r--plugins/pluginifdemo/ui/uihandler.h101
19 files changed, 2111 insertions, 0 deletions
diff --git a/plugins/pluginifdemo/AUTHORS b/plugins/pluginifdemo/AUTHORS
new file mode 100644
index 0000000000..ca50630cb9
--- /dev/null
+++ b/plugins/pluginifdemo/AUTHORS
@@ -0,0 +1,2 @@
+Author :
+Roland Knall <rknall@gmail.com>
diff --git a/plugins/pluginifdemo/CMakeLists.txt b/plugins/pluginifdemo/CMakeLists.txt
new file mode 100644
index 0000000000..5090f3d63b
--- /dev/null
+++ b/plugins/pluginifdemo/CMakeLists.txt
@@ -0,0 +1,87 @@
+# CMakeLists.txt
+#
+# 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(WiresharkPlugin)
+
+# Plugin name and version info (major minor micro extra)
+set_module_info(pluginifdemo 0 0 1 0)
+
+SET(CMAKE_AUTOMOC ON)
+SET(CMAKE_AUTOUIC ON)
+
+find_package(Qt5Core)
+find_package(Qt5PrintSupport)
+find_package(Qt5Widgets)
+
+set(DISSECTOR_SRC
+ pluginifdemo.c
+ ui/uihandler.cpp
+ ui/uiclasshandler.cpp
+ ui/pluginifdemo_main.cpp
+ ui/pluginifdemo_about.cpp
+ ${UI_SRC}
+)
+
+set(PLUGIN_FILES
+ plugin.c
+ ${DISSECTOR_SRC}
+)
+
+set(CLEAN_FILES
+ ${PLUGIN_FILES}
+)
+
+if (WERROR_COMMON_FLAGS)
+ set_source_files_properties(
+ ${CLEAN_FILES}
+ PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+ )
+endif()
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+register_dissector_files(plugin.c
+ plugin
+ ${DISSECTOR_SRC}
+)
+
+add_plugin_library(pluginifdemo)
+
+target_link_libraries(pluginifdemo Qt5::Core Qt5::Widgets Qt5::PrintSupport)
+
+install(TARGETS pluginifdemo
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION} NAMELINK_SKIP
+ RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
+)
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+ NAME
+ pluginifdemo
+ SWITCHES
+ -g abort -g termoutput -build
+ SOURCES
+ ${DISSECTOR_SRC}
+ ${DISSECTOR_HEADERS}
+)
diff --git a/plugins/pluginifdemo/COPYING b/plugins/pluginifdemo/COPYING
new file mode 100644
index 0000000000..f7962229f1
--- /dev/null
+++ b/plugins/pluginifdemo/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/plugins/pluginifdemo/Makefile.am b/plugins/pluginifdemo/Makefile.am
new file mode 100644
index 0000000000..f2311806a2
--- /dev/null
+++ b/plugins/pluginifdemo/Makefile.am
@@ -0,0 +1,66 @@
+# Makefile.am
+#
+# 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 $(top_srcdir)/Makefile.am.inc
+include ../Makefile.am.inc
+
+# the name of the plugin
+PLUGIN_NAME = pluginifdemo
+
+# Non-generated sources to be scanned for registration routines
+NONGENERATED_REGISTER_C_FILES = \
+ pluginifdemo.c
+
+# Non-generated sources
+NONGENERATED_C_FILES = \
+ $(NONGENERATED_REGISTER_C_FILES)
+
+# Headers.
+CLEAN_HEADER_FILES = \
+ pluginifdemo.h
+
+HEADER_FILES = \
+ $(CLEAN_HEADER_FILES)
+
+plugin_LTLIBRARIES = pluginifdemo.la
+
+pluginifdemo_la_SOURCES = \
+ plugin.c \
+ moduleinfo.h \
+ $(SRC_FILES) \
+ $(HEADER_FILES)
+
+pluginifdemo_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_CPPFLAGS)
+
+pluginifdemo_la_CFLAGS = $(AM_CFLAGS) $(PLUGIN_CFLAGS)
+
+pluginifdemo_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+
+CLEANFILES = \
+ pluginifdemo \
+ *~
+
+MAINTAINERCLEANFILES = \
+ Makefile.in \
+ plugin.c
+
+EXTRA_DIST = \
+ plugin.rc.in \
+ CMakeLists.txt
diff --git a/plugins/pluginifdemo/NEWS b/plugins/pluginifdemo/NEWS
new file mode 100644
index 0000000000..e6a8d1263b
--- /dev/null
+++ b/plugins/pluginifdemo/NEWS
@@ -0,0 +1 @@
+Initial version
diff --git a/plugins/pluginifdemo/README b/plugins/pluginifdemo/README
new file mode 100644
index 0000000000..7aa753f711
--- /dev/null
+++ b/plugins/pluginifdemo/README
@@ -0,0 +1,2 @@
+This plugin demonstrates a Qt integration using plugin_if and
+menubar_ext functionality.
diff --git a/plugins/pluginifdemo/moduleinfo.h b/plugins/pluginifdemo/moduleinfo.h
new file mode 100644
index 0000000000..b1b10a58dc
--- /dev/null
+++ b/plugins/pluginifdemo/moduleinfo.h
@@ -0,0 +1,39 @@
+/* moduleinfo.h
+ *
+ * Module info header for wireshark plugins.
+ *
+ * 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.
+ */
+
+/* Included *after* config.h, in order to re-define these macros */
+
+#ifdef PACKAGE
+#undef PACKAGE
+#endif
+
+/* Name of package */
+#define PACKAGE "pluginifdemo"
+
+
+#ifdef VERSION
+#undef VERSION
+#endif
+
+/* Version number of package */
+#define VERSION "0.0.1"
diff --git a/plugins/pluginifdemo/plugin.rc.in b/plugins/pluginifdemo/plugin.rc.in
new file mode 100644
index 0000000000..cac1f406ac
--- /dev/null
+++ b/plugins/pluginifdemo/plugin.rc.in
@@ -0,0 +1,34 @@
+#include "winver.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @RC_MODULE_VERSION@
+ PRODUCTVERSION @RC_VERSION@
+ FILEFLAGSMASK 0x0L
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0
+#endif
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_DLL
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "The Wireshark developer community, http://www.wireshark.org/\0"
+ VALUE "FileDescription", "@PACKAGE@ dissector\0"
+ VALUE "FileVersion", "@MODULE_VERSION@\0"
+ VALUE "InternalName", "@PACKAGE@ @MODULE_VERSION@\0"
+ VALUE "LegalCopyright", "Copyright © 1998 Gerald Combs <gerald@wireshark.org>, Gilbert Ramirez <gram@alumni.rice.edu> and others\0"
+ VALUE "OriginalFilename", "@PLUGIN_NAME@.dll\0"
+ VALUE "ProductName", "Wireshark\0"
+ VALUE "ProductVersion", "@VERSION@\0"
+ VALUE "Comments", "Built with @MSVC_VARIANT@\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/plugins/pluginifdemo/pluginifdemo.c b/plugins/pluginifdemo/pluginifdemo.c
new file mode 100644
index 0000000000..548677a80c
--- /dev/null
+++ b/plugins/pluginifdemo/pluginifdemo.c
@@ -0,0 +1,157 @@
+/* pluginifdemo.c
+ * Routines for plugin_if demo capability
+ * 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 <stdio.h>
+
+#include <epan/packet.h>
+#include <epan/prefs.h>
+#include <epan/tap.h>
+#include <epan/plugin_if.h>
+#include "pluginifdemo.h"
+
+#include <ui/uihandler.h>
+
+void proto_register_pluginifdemo(void);
+void proto_reg_handoff_pluginifdemo(void);
+
+static int proto_pluginifdemo = -1;
+
+void toolbar_cb(gpointer object, gpointer item_data, gpointer user_data);
+
+void
+menu_cb(ext_menubar_gui_type gui_type, gpointer gui_data, gpointer user_data _U_)
+{
+ pluginifdemo_ui_main(gui_type, gui_data);
+}
+
+void
+about_cb(ext_menubar_gui_type gui_type _U_, gpointer gui_data _U_, gpointer user_data _U_)
+{
+ pluginifdemo_ui_about(gui_type, gui_data);
+}
+
+void
+proto_register_pluginifdemo(void)
+{
+ static hf_register_info hf[] = {
+ };
+
+ static gint *ett[] = {
+ };
+
+#if 0
+ module_t *pluginif_module = NULL;
+#endif
+ ext_menu_t * ext_menu = NULL;
+
+ proto_pluginifdemo = proto_register_protocol("Plugin IF Demo Protocol", "Pluginifdemo", "pluginifdemo");
+
+ proto_register_field_array(proto_pluginifdemo, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ ext_menu = ext_menubar_register_menu ( proto_pluginifdemo, "Plugin IF Demonstration", TRUE );
+ ext_menubar_set_parentmenu (ext_menu, "Tools");
+
+ ext_menubar_add_entry(ext_menu, "Toolbar Action Demonstrator", "Action demonstrator for the plugin toolbar", menu_cb, NULL);
+ ext_menubar_add_separator(ext_menu);
+ ext_menubar_add_website(ext_menu, "Wireshark Development", "See Wireshark Development", "https://www.wireshark.org/develop.html");
+ ext_menubar_add_separator(ext_menu);
+ ext_menubar_add_entry(ext_menu, "&About Plugin IF Demonstration", "Further information", about_cb, NULL);
+#if 0
+ pluginif_module = prefs_register_protocol(proto_pluginifdemo, NULL);
+#endif
+
+
+ ext_toolbar_t * tb = ext_toolbar_register_toolbar("Plugin Interface Demo Toolbar");
+
+ ext_toolbar_add_entry(tb, EXT_TOOLBAR_BUTTON, "Test Button", 0, "Button to press", FALSE, 0, FALSE, 0, toolbar_cb, 0);
+ ext_toolbar_add_entry(tb, EXT_TOOLBAR_BUTTON, "Test 2 Button", 0, "Button 2 to press", TRUE, 0, FALSE, 0, toolbar_cb, 0);
+ ext_toolbar_add_entry(tb, EXT_TOOLBAR_BOOLEAN, "Test CheckBox", 0, "CheckBox to Select", FALSE, 0, FALSE, 0, toolbar_cb, 0);
+ ext_toolbar_add_entry(tb, EXT_TOOLBAR_STRING, "Reg String", "Default String", "Test Testbox", FALSE, 0, TRUE, 0, toolbar_cb, 0);
+ ext_toolbar_add_entry(tb, EXT_TOOLBAR_STRING, "Test Textbox", "ABC", "Box with Validation", FALSE, 0, FALSE, "^[A-Z]+", toolbar_cb, 0);
+ GList * entries = 0;
+ entries = ext_toolbar_add_val( entries, "1", "ABCD", FALSE );
+ entries = ext_toolbar_add_val(entries, "2", "EFG", FALSE );
+ entries = ext_toolbar_add_val(entries, "3", "HIJ", TRUE );
+ entries = ext_toolbar_add_val(entries, "4", "KLM", FALSE );
+ entries = ext_toolbar_add_val(entries, "5", "NOP", FALSE );
+ entries = ext_toolbar_add_val(entries, "6", "QRS", FALSE );
+ entries = ext_toolbar_add_val(entries, "7", "TUVW", FALSE );
+ entries = ext_toolbar_add_val(entries, "8", "XYZ", FALSE );
+ ext_toolbar_add_entry(tb, EXT_TOOLBAR_SELECTOR, "Test Selector", 0, "Selector to choose from", FALSE, entries, FALSE, 0, toolbar_cb, 0);
+
+ pluginifdemo_toolbar_register(tb);
+}
+
+void toolbar_cb(gpointer toolbar_item, gpointer item_data, gpointer user_data _U_)
+{
+ if ( ! toolbar_item )
+ return;
+
+ gchar * message = 0;
+ ext_toolbar_t * entry = (ext_toolbar_t *)toolbar_item;
+
+ if ( entry->item_type == EXT_TOOLBAR_BUTTON )
+ pluginifdemo_toolbar_log ( "Button pressed at toolbar" );
+ else if ( entry->item_type == EXT_TOOLBAR_BOOLEAN )
+ {
+ gboolean data = *((gboolean *)item_data);
+ message = g_strdup_printf( "Checkbox selected value: %d", (int) (data) );
+ pluginifdemo_toolbar_log(message);
+ }
+ else if ( entry->item_type == EXT_TOOLBAR_STRING )
+ {
+ gchar * data = (gchar *)item_data;
+ message = g_strdup_printf( "String entered in toolbar: %s", data );
+ pluginifdemo_toolbar_log(message);
+ }
+ else if ( entry->item_type == EXT_TOOLBAR_SELECTOR )
+ {
+ ext_toolbar_value_t * data = (ext_toolbar_value_t *)item_data;
+ message = g_strdup_printf( "Value from toolbar: %s", data->value );
+ pluginifdemo_toolbar_log(message);
+ }
+
+ g_free(message);
+}
+
+void
+proto_reg_handoff_pluginifdemo(void)
+{
+
+}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/plugins/pluginifdemo/pluginifdemo.h b/plugins/pluginifdemo/pluginifdemo.h
new file mode 100644
index 0000000000..59b2a649c1
--- /dev/null
+++ b/plugins/pluginifdemo/pluginifdemo.h
@@ -0,0 +1,23 @@
+/* pluginifdemo.h
+ * Definitions for plugin_if_demo structures and routines
+ * By Steve Limkemann <stevelim@dgtech.com>
+ * Copyright 1998 Steve Limkemann
+ *
+ * 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.
+ */
diff --git a/plugins/pluginifdemo/ui/pluginifdemo_about.cpp b/plugins/pluginifdemo/ui/pluginifdemo_about.cpp
new file mode 100644
index 0000000000..3284b3bebc
--- /dev/null
+++ b/plugins/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 *button _U_)
+{
+ 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/pluginifdemo/ui/pluginifdemo_about.h b/plugins/pluginifdemo/ui/pluginifdemo_about.h
new file mode 100644
index 0000000000..aa4bb4726d
--- /dev/null
+++ b/plugins/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/pluginifdemo/ui/pluginifdemo_about.ui b/plugins/pluginifdemo/ui/pluginifdemo_about.ui
new file mode 100644
index 0000000000..2353dd76ac
--- /dev/null
+++ b/plugins/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/pluginifdemo/ui/pluginifdemo_main.cpp b/plugins/pluginifdemo/ui/pluginifdemo_main.cpp
new file mode 100644
index 0000000000..33f88356e1
--- /dev/null
+++ b/plugins/pluginifdemo/ui/pluginifdemo_main.cpp
@@ -0,0 +1,320 @@
+/* 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_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));
+}
+
+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)
+ 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 );
+}
+
+/*
+ * 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/pluginifdemo/ui/pluginifdemo_main.h b/plugins/pluginifdemo/ui/pluginifdemo_main.h
new file mode 100644
index 0000000000..439712e556
--- /dev/null
+++ b/plugins/pluginifdemo/ui/pluginifdemo_main.h
@@ -0,0 +1,133 @@
+/* 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 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/pluginifdemo/ui/pluginifdemo_main.ui b/plugins/pluginifdemo/ui/pluginifdemo_main.ui
new file mode 100644
index 0000000000..0871ee8e81
--- /dev/null
+++ b/plugins/pluginifdemo/ui/pluginifdemo_main.ui
@@ -0,0 +1,315 @@
+<?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>
+ <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="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <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>
+ <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/pluginifdemo/ui/uiclasshandler.cpp b/plugins/pluginifdemo/ui/uiclasshandler.cpp
new file mode 100644
index 0000000000..e88f17a35e
--- /dev/null
+++ b/plugins/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/pluginifdemo/ui/uihandler.cpp b/plugins/pluginifdemo/ui/uihandler.cpp
new file mode 100644
index 0000000000..8dc3940669
--- /dev/null
+++ b/plugins/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/pluginifdemo/ui/uihandler.h b/plugins/pluginifdemo/ui/uihandler.h
new file mode 100644
index 0000000000..ce78a23940
--- /dev/null
+++ b/plugins/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:
+ */