Add About window for Wireshark Qt

svn path=/trunk/; revision=54557
This commit is contained in:
Alexis La Goutte 2014-01-02 17:04:10 +00:00
parent 5490a6636d
commit f5c6f39201
11 changed files with 686 additions and 6 deletions

6
image/about.qrc Normal file
View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/about">
<file>wssplash.png</file>
<file>wssplash_dev.png</file>
</qresource>
</RCC>

View File

@ -24,6 +24,7 @@
# All .h files which inherit from QObject aka which use the Q_OBJECT macro
# need to go here.
set(WIRESHARK_QT_HEADERS
about_dialog.h
accordion_frame.h
byte_view_tab.h
byte_view_text.h
@ -97,6 +98,7 @@ set(WIRESHARK_QT_HEADERS
)
set(WIRESHARK_QT_SRC
about_dialog.cpp
accordion_frame.cpp
byte_view_tab.cpp
byte_view_text.cpp
@ -181,6 +183,7 @@ set(DIRTY_FILES
)
set(WIRESHARK_QT_UI
about_dialog.ui
capture_preferences_frame.ui
capture_interfaces_dialog.ui
column_preferences_frame.ui
@ -219,6 +222,7 @@ set(WIRESHARK_QT_UI
)
set(WIRESHARK_QT_QRC
../../image/about.qrc
../../image/display_filter.qrc
../../image/layout.qrc
../../image/status.qrc

View File

@ -127,6 +127,8 @@ ui_%.h: %.ui
#moc_%.cpp: %.h
# $(MOC) $< -o $@
about_dialog.cpp about_dialog.h: ui_about_dialog.h
capture_interfaces_dialog.cpp capture_interfaces_dialog.h: ui_capture_interfaces_dialog.h
capture_preferences_frame.cpp capture_preferences_frame.h: ui_capture_preferences_frame.h

View File

@ -31,6 +31,7 @@ GENERATED_HEADER_FILES =
# Generated header files that we don't want in the distribution.
NODIST_GENERATED_HEADER_FILES = \
ui_about_dialog.h \
ui_capture_interfaces_dialog.h \
ui_capture_preferences_frame.h \
ui_column_preferences_frame.h \
@ -101,6 +102,7 @@ GENERATOR_FILES =
# Headers that have to be run through moc.
#
MOC_HDRS = \
about_dialog.h \
accordion_frame.h \
byte_view_tab.h \
byte_view_text.h \
@ -173,6 +175,7 @@ MOC_HDRS = \
# .ui files.
#
UI_FILES = \
about_dialog.ui \
capture_interfaces_dialog.ui \
capture_preferences_frame.ui \
column_preferences_frame.ui \
@ -221,12 +224,13 @@ MOC_SRC = $(MOC_HDRS:.h=.moc.cpp)
# .qrc files.
#
# Should QRC_FILES or QRC_SRC depend on QRC_IMAGES?
QRC_FILES = \
../../image/display_filter.qrc \
../../image/layout.qrc \
../../image/status.qrc \
../../image/toolbar.qrc \
i18n.qrc \
QRC_FILES = \
../../image/about.qrc \
../../image/display_filter.qrc \
../../image/layout.qrc \
../../image/status.qrc \
../../image/toolbar.qrc \
i18n.qrc \
welcome.qrc
#
@ -258,6 +262,7 @@ QM_FILES = \
QRC_SRC = $(QRC_FILES:.qrc=.rcc.cpp)
WIRESHARK_QT_SRC = \
about_dialog.cpp \
accordion_frame.cpp \
byte_view_tab.cpp \
byte_view_text.cpp \

View File

@ -221,6 +221,7 @@ HEADERS_WS_C = \
../../wsutil/privileges.h
FORMS += \
about_dialog.ui \
capture_preferences_frame.ui \
capture_interfaces_dialog.ui \
column_preferences_frame.ui \
@ -258,6 +259,7 @@ FORMS += \
tcp_stream_dialog.ui
HEADERS += $$HEADERS_WS_C \
about_dialog.h \
accordion_frame.h \
capture_interfaces_dialog.h \
capture_preferences_frame.h \
@ -467,6 +469,7 @@ win32 {
}
RESOURCES += \
../../image/about.qrc \
../../image/display_filter.qrc \
../../image/layout.qrc \
../../image/status.qrc \
@ -551,6 +554,7 @@ HEADERS += \
SOURCES += \
about_dialog.cpp \
accordion_frame.cpp \
byte_view_tab.cpp \
byte_view_text.cpp \

281
ui/qt/about_dialog.cpp Normal file
View File

@ -0,0 +1,281 @@
/* about_dialog.cpp
*
* $Id$
*
* 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 "about_dialog.h"
#include "ui_about_dialog.h"
#include "wireshark_application.h"
#include "main.cpp"
#include <wsutil/filesystem.h>
#ifdef HAVE_LIBSMI
#include <epan/oids.h>
#endif
#ifdef HAVE_GEOIP
#include <epan/geoip_db.h>
#endif
#ifdef HAVE_LUA
#include <epan/wslua/init_wslua.h>
#endif
#include "../log.h"
#include "../version_info.h"
#include "../register.h"
#include "ui/text_import_scanner.h"
#include "ui/last_open_dir.h"
#include "ui/alert_box.h"
#include "ui/help_url.h"
#include "file.h"
#include "wsutil/file_util.h"
#include "wsutil/tempfile.h"
#include "wsutil/plugins.h"
#include <QtGui>
#include <QTextStream>
// To do:
// - Found better solution to reuse comp_info_str and runtime_info_str (Remove ugly hack...)
// - Tweat and enhance ui...
void AboutDialog::about_folders_row(const char *name, const char *dir, const char *typ_file)
{
ui->tbFolders->setRowCount(ui->tbFolders->rowCount() + 1);
ui->tbFolders->setItem(ui->tbFolders->rowCount()-1, 0, new QTableWidgetItem(name));
ui->tbFolders->setItem(ui->tbFolders->rowCount()-1, 1, new QTableWidgetItem(dir));
ui->tbFolders->setItem(ui->tbFolders->rowCount()-1, 2, new QTableWidgetItem(typ_file));
}
void plugins_add_description(const char *name, const char *version,
const char *types, const char *filename,
void *user_data _U_ )
{
QTableWidget *tbPlugins = (QTableWidget *)user_data;
tbPlugins->setRowCount(tbPlugins->rowCount() + 1);
tbPlugins->setItem(tbPlugins->rowCount()-1, 0, new QTableWidgetItem(name));
tbPlugins->setItem(tbPlugins->rowCount()-1, 1, new QTableWidgetItem(version));
tbPlugins->setItem(tbPlugins->rowCount()-1, 2, new QTableWidgetItem(types));
tbPlugins->setItem(tbPlugins->rowCount()-1, 3, new QTableWidgetItem(filename));
}
void AboutDialog::plugins_scan()
{
#ifdef HAVE_PLUGINS
plugins_get_descriptions(plugins_add_description, ui->tbPlugins);
#endif
#ifdef HAVE_LUA
wslua_plugins_get_descriptions(plugins_add_description, ui->tbPlugins);
#endif
}
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
QFile f_authors;
QFile f_license;
char *path = NULL;
const char *constpath;
gchar *message;
const char *version;
#if defined (HAVE_LIBSMI) || defined (HAVE_GEOIP)
gint i;
gchar **resultArray;
#endif
/* Wireshark tab */
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
// Ugly hack... copy from ui/qt/main.cpp */
get_compiled_version_info(comp_info_str, get_qt_compiled_info, get_gui_compiled_info);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
get_runtime_version_info(runtime_info_str, get_gui_runtime_info);
/* Construct the message string */
message = g_strdup_printf(
"Version " VERSION "%s\n"
"\n"
"%s"
"\n"
"%s"
"\n"
"%s"
"\n"
"Wireshark is Open Source Software released under the GNU General Public License.\n"
"\n"
"Check the man page and http://www.wireshark.org for more information.",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
ui->label_wireshark->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->label_wireshark->setText(message);
/* VERSION_MINOR is const char * with CMake and int with Autofoo.... */
version = (const char *)VERSION_MINOR;
/* Check if Dev release... (VERSION_MINOR is odd) */
if ( atoi(version) % 2 == 1)
{
ui->label_logo->setPixmap( QPixmap( ":/about/wssplash_dev.png" ) );
}
/* Authors */
f_authors.setFileName(get_datafile_path("AUTHORS-SHORT"));
f_authors.open(QFile::ReadOnly | QFile::Text);
QTextStream ReadFile_authors(&f_authors);
ui->pte_Authors->insertPlainText(ReadFile_authors.readAll());
ui->pte_Authors->moveCursor(QTextCursor::Start);
/* Folders */
/* set column widths */
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
ui->tbFolders->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
#else
ui->tbFolders->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
#endif
ui->tbFolders->setRowCount(0);
/* "file open" */
about_folders_row("\"File\" dialogs", get_last_open_dir(), "capture files");
/* temp */
about_folders_row("Temp", g_get_tmp_dir(), "untitled capture files");
/* pers conf */
path = get_persconffile_path("", FALSE);
about_folders_row("Personal configuration", path, "\"dfilters\", \"preferences\", \"ethers\", ...");
g_free(path);
/* global conf */
constpath = get_datafile_dir();
if (constpath != NULL) {
about_folders_row("Global configuration", constpath, "\"dfilters\", \"preferences\", \"manuf\", ...");
}
/* system */
constpath = get_systemfile_dir();
about_folders_row("System", constpath, "\"ethers\", \"ipxnets\"");
/* program */
constpath = get_progfile_dir();
about_folders_row("Program", constpath, "program files");
#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
/* pers plugins */
path = get_plugins_pers_dir();
about_folders_row("Personal Plugins", path, "dissector plugins");
g_free(path);
/* global plugins */
about_folders_row("Global Plugins", get_plugin_dir(), "dissector plugins");
#endif
#ifdef HAVE_PYTHON
/* global python bindings */
about_folders_row("Python Bindings", get_wspython_dir(), "python bindings");
#endif
#ifdef HAVE_GEOIP
/* GeoIP */
path = geoip_db_get_paths();
resultArray = g_strsplit(path, G_SEARCHPATH_SEPARATOR_S, 10);
for(i = 0; resultArray[i]; i++)
about_folders_row("GeoIP path", g_strstrip(resultArray[i]), "GeoIP database search path");
g_strfreev(resultArray);
g_free(path);
#endif
#ifdef HAVE_LIBSMI
/* SMI MIBs/PIBs */
path = oid_get_default_mib_path();
resultArray = g_strsplit(path, G_SEARCHPATH_SEPARATOR_S, 10);
for(i = 0; resultArray[i]; i++)
about_folders_row("MIB/PIB path", g_strstrip(resultArray[i]), "SMI MIB/PIB search path");
g_strfreev(resultArray);
g_free(path);
#endif
/* Plugins */
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
ui->tbPlugins->horizontalHeader()->setResizeMode(3, QHeaderView::Stretch);
#else
ui->tbPlugins->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
#endif
plugins_scan();
/* License */
#if defined(_WIN32)
f_license.setFileName(get_datafile_path("COPYING.txt"));
#else
f_license.setFileName(get_datafile_path("COPYING"));
#endif
f_license.open(QFile::ReadOnly | QFile::Text);
QTextStream ReadFile_license(&f_license);
ui->pte_License->insertPlainText(ReadFile_license.readAll());
ui->pte_License->moveCursor(QTextCursor::Start);
}
AboutDialog::~AboutDialog()
{
delete ui;
}
/*
* 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:
*/

60
ui/qt/about_dialog.h Normal file
View File

@ -0,0 +1,60 @@
/* about_dialog.h
*
* $Id$
*
* 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 ABOUT_DIALOG_H
#define ABOUT_DIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
void about_folders_row(const char *, const char *dir, const char *typ_file);
void plugins_scan();
private:
Ui::AboutDialog *ui;
};
#endif // ABOUT_DIALOG_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:
*/

296
ui/qt/about_dialog.ui Normal file
View File

@ -0,0 +1,296 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>About Wireshark</string>
</property>
<property name="windowIcon">
<iconset resource="../../image/toolbar.qrc">
<normaloff>:/menu/help/wsicon16.png</normaloff>:/menu/help/wsicon16.png</iconset>
</property>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>581</width>
<height>541</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>371</width>
<height>231</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_wireshark">
<property name="enabled">
<bool>true</bool>
</property>
<attribute name="title">
<string>Wireshark</string>
</attribute>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>561</width>
<height>82</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_logo">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../image/about.qrc">:/about/wssplash.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_title">
<property name="text">
<string>&lt;span size=\&quot;x-large\&quot; weight=\&quot;bold\&quot;&gt;Network Protocol Analyzer&lt;/span&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label_wireshark">
<property name="geometry">
<rect>
<x>8</x>
<y>100</y>
<width>561</width>
<height>401</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_folders">
<attribute name="title">
<string>Folders</string>
</attribute>
<widget class="QTableWidget" name="tbFolders">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>561</width>
<height>501</height>
</rect>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="rowCount">
<number>0</number>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Folder</string>
</property>
</column>
<column>
<property name="text">
<string>Typical Files</string>
</property>
</column>
</widget>
</widget>
<widget class="QWidget" name="tab_authors">
<attribute name="title">
<string>Authors</string>
</attribute>
<widget class="QPlainTextEdit" name="pte_Authors">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>561</width>
<height>491</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_plugins">
<attribute name="title">
<string>Plugins</string>
</attribute>
<widget class="QTableWidget" name="tbPlugins">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>561</width>
<height>491</height>
</rect>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="rowCount">
<number>0</number>
</property>
<property name="columnCount">
<number>4</number>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Version</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
</widget>
</widget>
<widget class="QWidget" name="tab_license">
<attribute name="title">
<string>License</string>
</attribute>
<widget class="QPlainTextEdit" name="pte_License">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>561</width>
<height>491</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<y>560</y>
<width>581</width>
<height>30</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item alignment="Qt::AlignHCenter">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../../image/about.qrc"/>
<include location="../../image/toolbar.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AboutDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -59,6 +59,7 @@
#include "summary_dialog.h"
#include "follow_stream_dialog.h"
#include "capture_interfaces_dialog.h"
#include "about_dialog.h"
class QAction;
@ -114,6 +115,7 @@ private:
SummaryDialog summary_dialog_;
ByteViewTab *byte_view_tab_;
QWidget empty_pane_;
AboutDialog about_dialog_;
bool capture_stopping_;
bool capture_filter_valid_;
@ -307,6 +309,7 @@ private slots:
void on_actionHelpDownloads_triggered();
void on_actionHelpWiki_triggered();
void on_actionHelpSampleCaptures_triggered();
void on_actionHelpAbout_triggered();
#ifdef HAVE_SOFTWARE_UPDATE
void on_actionHelpCheckForUpdates_triggered();
@ -354,6 +357,7 @@ private slots:
void on_actionTelephonySMPPOperations_triggered();
void on_actionTelephonyUCPMessages_triggered();
};
#endif // MAINWINDOW_H
/*

View File

@ -2032,6 +2032,23 @@ void MainWindow::on_actionHelpCheckForUpdates_triggered()
}
#endif
void MainWindow::on_actionHelpAbout_triggered()
{
//about_dialog_.UpdateValues();
if (about_dialog_.isMinimized() == true)
{
about_dialog_.showNormal();
}
else
{
about_dialog_.show();
}
about_dialog_.raise();
about_dialog_.activateWindow();
}
void MainWindow::on_actionGoGoToPacket_triggered() {
if (packet_list_->model()->rowCount() < 1) {
return;

View File

@ -560,6 +560,7 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
{
wsApp = this;
Q_INIT_RESOURCE(about);
Q_INIT_RESOURCE(display_filter);
Q_INIT_RESOURCE(i18n);
Q_INIT_RESOURCE(layout);