aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2022-01-31 19:30:09 -0800
committerGerald Combs <gerald@wireshark.org>2022-04-04 09:39:27 -0700
commit80de95ca71c5e04f79abd141e2c6406ee2df98bd (patch)
treebfa0a0f5fdd402c5bcdef12ebf34017b74620099 /ui/qt
parentca426d68a977c3462bba9954a97ffca260706f7d (diff)
Qt: Split MainApplication out from WiresharkApplication.
Move WiresharkApplication.{cpp,h} to MainApplication.{cpp,h}. Add back WiresharkApplication as a thin superclass of MainApplication, similar to LogsharkApplication. Change all of our wsApp references to mainApp. We will likely have to change many or most of them back, but that's a commit for another time.
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/CMakeLists.txt2
-rw-r--r--ui/qt/about_dialog.cpp6
-rw-r--r--ui/qt/address_editor_frame.cpp5
-rw-r--r--ui/qt/byte_view_tab.cpp20
-rw-r--r--ui/qt/capture_file_dialog.cpp22
-rw-r--r--ui/qt/capture_file_properties_dialog.cpp4
-rw-r--r--ui/qt/capture_info_dialog.cpp4
-rw-r--r--ui/qt/capture_options_dialog.cpp10
-rw-r--r--ui/qt/capture_preferences_frame.cpp4
-rw-r--r--ui/qt/coloring_rules_dialog.cpp15
-rw-r--r--ui/qt/column_editor_frame.cpp9
-rw-r--r--ui/qt/column_preferences_frame.cpp4
-rw-r--r--ui/qt/compiled_filter_output.cpp6
-rw-r--r--ui/qt/conversation_dialog.cpp8
-rw-r--r--ui/qt/conversation_hash_tables_dialog.cpp4
-rw-r--r--ui/qt/credentials_dialog.cpp2
-rw-r--r--ui/qt/decode_as_dialog.cpp8
-rw-r--r--ui/qt/display_filter_expression_dialog.cpp14
-rw-r--r--ui/qt/dissector_tables_dialog.cpp4
-rw-r--r--ui/qt/enabled_protocols_dialog.cpp6
-rw-r--r--ui/qt/endpoint_dialog.cpp6
-rw-r--r--ui/qt/expert_info_dialog.cpp6
-rw-r--r--ui/qt/export_dissection_dialog.cpp8
-rw-r--r--ui/qt/export_object_dialog.cpp16
-rw-r--r--ui/qt/extcap_options_dialog.cpp12
-rw-r--r--ui/qt/file_set_dialog.cpp8
-rw-r--r--ui/qt/filter_action.cpp12
-rw-r--r--ui/qt/filter_dialog.cpp16
-rw-r--r--ui/qt/filter_expression_frame.cpp8
-rw-r--r--ui/qt/firewall_rules_dialog.cpp10
-rw-r--r--ui/qt/follow_stream_dialog.cpp8
-rw-r--r--ui/qt/font_color_preferences_frame.cpp6
-rw-r--r--ui/qt/funnel_statistics.cpp16
-rw-r--r--ui/qt/funnel_string_dialog.cpp4
-rw-r--r--ui/qt/funnel_text_dialog.cpp6
-rw-r--r--ui/qt/gsm_map_summary_dialog.cpp2
-rw-r--r--ui/qt/iax2_analysis_dialog.cpp14
-rw-r--r--ui/qt/import_text_dialog.cpp8
-rw-r--r--ui/qt/interface_frame.cpp8
-rw-r--r--ui/qt/interface_toolbar.cpp4
-rw-r--r--ui/qt/io_graph_dialog.cpp14
-rw-r--r--ui/qt/lbm_lbtrm_transport_dialog.cpp2
-rw-r--r--ui/qt/lbm_lbtru_transport_dialog.cpp2
-rw-r--r--ui/qt/lbm_stream_dialog.cpp2
-rw-r--r--ui/qt/lte_mac_statistics_dialog.cpp4
-rw-r--r--ui/qt/lte_rlc_graph_dialog.cpp8
-rw-r--r--ui/qt/lte_rlc_statistics_dialog.cpp4
-rw-r--r--ui/qt/main.cpp6
-rw-r--r--ui/qt/main_application.cpp1373
-rw-r--r--ui/qt/main_application.h238
-rw-r--r--ui/qt/main_status_bar.cpp14
-rw-r--r--ui/qt/main_status_bar.h2
-rw-r--r--ui/qt/main_window.cpp132
-rw-r--r--ui/qt/main_window.h2
-rw-r--r--ui/qt/main_window_preferences_frame.cpp2
-rw-r--r--ui/qt/main_window_slots.cpp148
-rw-r--r--ui/qt/manage_interfaces_dialog.cpp6
-rw-r--r--ui/qt/manager/wireshark_preference.cpp8
-rw-r--r--ui/qt/models/dissector_tables_model.cpp2
-rw-r--r--ui/qt/models/enabled_protocols_model.cpp4
-rw-r--r--ui/qt/models/interface_sort_filter_model.cpp4
-rw-r--r--ui/qt/models/interface_tree_cache_model.cpp6
-rw-r--r--ui/qt/models/interface_tree_model.cpp6
-rw-r--r--ui/qt/models/packet_list_model.cpp12
-rw-r--r--ui/qt/models/related_packet_delegate.cpp11
-rw-r--r--ui/qt/module_preferences_scroll_area.cpp8
-rw-r--r--ui/qt/multicast_statistics_dialog.cpp4
-rw-r--r--ui/qt/packet_comment_dialog.cpp6
-rw-r--r--ui/qt/packet_diagram.cpp20
-rw-r--r--ui/qt/packet_dialog.cpp6
-rw-r--r--ui/qt/packet_list.cpp22
-rw-r--r--ui/qt/preference_editor_frame.cpp12
-rw-r--r--ui/qt/preferences_dialog.cpp22
-rw-r--r--ui/qt/print_dialog.cpp8
-rw-r--r--ui/qt/profile_dialog.cpp18
-rw-r--r--ui/qt/progress_frame.cpp4
-rw-r--r--ui/qt/proto_tree.cpp22
-rw-r--r--ui/qt/protocol_hierarchy_dialog.cpp8
-rw-r--r--ui/qt/protocol_preferences_menu.cpp12
-rw-r--r--ui/qt/resolved_addresses_dialog.cpp6
-rw-r--r--ui/qt/response_time_delay_dialog.cpp4
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp12
-rw-r--r--ui/qt/rtp_player_dialog.cpp26
-rw-r--r--ui/qt/rtp_stream_dialog.cpp14
-rw-r--r--ui/qt/sctp_all_assocs_dialog.cpp2
-rw-r--r--ui/qt/sctp_chunk_statistics_dialog.cpp2
-rw-r--r--ui/qt/sctp_graph_dialog.cpp8
-rw-r--r--ui/qt/search_frame.cpp14
-rw-r--r--ui/qt/sequence_dialog.cpp10
-rw-r--r--ui/qt/service_response_time_dialog.cpp4
-rw-r--r--ui/qt/show_packet_bytes_dialog.cpp18
-rw-r--r--ui/qt/simple_dialog.cpp16
-rw-r--r--ui/qt/simple_statistics_dialog.cpp4
-rw-r--r--ui/qt/supported_protocols_dialog.cpp4
-rw-r--r--ui/qt/tap_parameter_dialog.cpp12
-rw-r--r--ui/qt/tcp_stream_dialog.cpp10
-rw-r--r--ui/qt/time_shift_dialog.cpp6
-rw-r--r--ui/qt/traffic_table_dialog.cpp12
-rw-r--r--ui/qt/uat_dialog.cpp6
-rw-r--r--ui/qt/uat_frame.cpp6
-rw-r--r--ui/qt/utils/color_utils.cpp2
-rw-r--r--ui/qt/voip_calls_dialog.cpp8
-rw-r--r--ui/qt/welcome_page.cpp20
-rw-r--r--ui/qt/widgets/additional_toolbar.cpp6
-rw-r--r--ui/qt/widgets/byte_view_text.cpp2
-rw-r--r--ui/qt/widgets/capture_filter_combo.cpp6
-rw-r--r--ui/qt/widgets/capture_filter_edit.cpp10
-rw-r--r--ui/qt/widgets/display_filter_combo.cpp4
-rw-r--r--ui/qt/widgets/display_filter_edit.cpp27
-rw-r--r--ui/qt/widgets/filter_expression_toolbar.cpp6
-rw-r--r--ui/qt/widgets/follow_stream_text.cpp4
-rw-r--r--ui/qt/widgets/packet_list_header.cpp4
-rw-r--r--ui/qt/widgets/splash_overlay.cpp8
-rw-r--r--ui/qt/widgets/wireless_timeline.cpp10
-rw-r--r--ui/qt/wireless_frame.cpp6
-rw-r--r--ui/qt/wireshark_application.cpp1353
-rw-r--r--ui/qt/wireshark_application.h218
-rw-r--r--ui/qt/wireshark_dialog.cpp6
-rw-r--r--ui/qt/wlan_statistics_dialog.cpp4
119 files changed, 2236 insertions, 2183 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index 5df1019077..9bf01d2b5c 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -186,6 +186,7 @@ set(WIRESHARK_QT_HEADERS
lte_mac_statistics_dialog.h
lte_rlc_graph_dialog.h
lte_rlc_statistics_dialog.h
+ main_application.h
main_status_bar.h
main_window_preferences_frame.h
main_window.h
@@ -420,6 +421,7 @@ set(WIRESHARK_QT_SRC
lte_mac_statistics_dialog.cpp
lte_rlc_graph_dialog.cpp
lte_rlc_statistics_dialog.cpp
+ main_application.cpp
main_status_bar.cpp
main_window_layout.cpp
main_window_preferences_frame.cpp
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index 61fb29126f..9c9b9adb8f 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -12,7 +12,7 @@
#include "about_dialog.h"
#include <ui_about_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <wsutil/filesystem.h>
#include <QDesktopServices>
@@ -165,7 +165,7 @@ ShortcutListModel::ShortcutListModel(QObject * parent):
AStringListListModel(parent)
{
QMap<QString, QPair<QString, QString> > shortcuts; // name -> (shortcut, description)
- foreach (const QWidget *child, wsApp->mainWindow()->findChildren<QWidget *>()) {
+ foreach (const QWidget *child, mainApp->mainWindow()->findChildren<QWidget *>()) {
// Recent items look funny here.
if (child->objectName().compare("menuOpenRecentCaptureFile") == 0) continue;
foreach (const QAction *action, child->actions()) {
@@ -257,7 +257,7 @@ FolderListModel::FolderListModel(QObject * parent):
#ifdef Q_OS_MAC
/* Mac Extras */
- QString extras_path = wsApp->applicationDirPath() + "/../Resources/Extras";
+ QString extras_path = mainApp->applicationDirPath() + "/../Resources/Extras";
appendRow(QStringList() << tr("macOS Extras") << QDir::cleanPath(extras_path) << tr("Extra macOS packages"));
#endif
diff --git a/ui/qt/address_editor_frame.cpp b/ui/qt/address_editor_frame.cpp
index 265eb5ed45..03bda8a65c 100644
--- a/ui/qt/address_editor_frame.cpp
+++ b/ui/qt/address_editor_frame.cpp
@@ -18,6 +18,8 @@
#include "epan/epan_dissect.h"
#include "epan/frame_data.h"
+#include "main_application.h"
+
#include "address_editor_frame.h"
#include <ui_address_editor_frame.h>
@@ -25,7 +27,6 @@
#include <QKeyEvent>
#include <ui/qt/utils/qt_ui_utils.h>
-#include <ui/qt/wireshark_application.h>
// To do:
// - Fill in currently resolved address.
@@ -170,7 +171,7 @@ void AddressEditorFrame::on_buttonBox_accepted()
QString name = ui->nameLineEdit->text();
if (!cf_add_ip_name_from_string(cap_file_, addr.toUtf8().constData(), name.toUtf8().constData())) {
QString error_msg = tr("Can't assign %1 to %2.").arg(name).arg(addr);
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, error_msg);
+ mainApp->pushStatus(MainApplication::TemporaryStatus, error_msg);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
return;
}
diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp
index e7af2fd30a..aefdd09737 100644
--- a/ui/qt/byte_view_tab.cpp
+++ b/ui/qt/byte_view_tab.cpp
@@ -18,7 +18,7 @@
#include "epan/epan_dissect.h"
#include "epan/tvbuff-int.h"
-#include <wireshark_application.h>
+#include <main_application.h>
#include <ui/qt/utils/variant_pointer.h>
#include <ui/qt/widgets/byte_view_text.h>
@@ -45,7 +45,7 @@ ByteViewTab::ByteViewTab(QWidget *parent, epan_dissect_t *edt_fixed) :
setMinimumSize(one_em, one_em);
if (!edt_fixed) {
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
}
}
@@ -55,16 +55,16 @@ ByteViewTab::ByteViewTab(QWidget *parent, epan_dissect_t *edt_fixed) :
void ByteViewTab::connectToMainWindow()
{
connect(this, SIGNAL(fieldSelected(FieldInformation *)),
- wsApp->mainWindow(), SIGNAL(fieldSelected(FieldInformation *)));
+ mainApp->mainWindow(), SIGNAL(fieldSelected(FieldInformation *)));
connect(this, SIGNAL(fieldHighlight(FieldInformation *)),
- wsApp->mainWindow(), SIGNAL(fieldHighlight(FieldInformation *)));
+ mainApp->mainWindow(), SIGNAL(fieldHighlight(FieldInformation *)));
/* Connect change of packet selection */
- connect(wsApp->mainWindow(), SIGNAL(framesSelected(QList<int>)), this, SLOT(selectedFrameChanged(QList<int>)));
- connect(wsApp->mainWindow(), SIGNAL(setCaptureFile(capture_file*)), this, SLOT(setCaptureFile(capture_file*)));
- connect(wsApp->mainWindow(), SIGNAL(fieldSelected(FieldInformation *)), this, SLOT(selectedFieldChanged(FieldInformation *)));
+ connect(mainApp->mainWindow(), SIGNAL(framesSelected(QList<int>)), this, SLOT(selectedFrameChanged(QList<int>)));
+ connect(mainApp->mainWindow(), SIGNAL(setCaptureFile(capture_file*)), this, SLOT(setCaptureFile(capture_file*)));
+ connect(mainApp->mainWindow(), SIGNAL(fieldSelected(FieldInformation *)), this, SLOT(selectedFieldChanged(FieldInformation *)));
- connect(wsApp->mainWindow(), SIGNAL(captureActive(int)), this, SLOT(captureActive(int)));
+ connect(mainApp->mainWindow(), SIGNAL(captureActive(int)), this, SLOT(captureActive(int)));
}
void ByteViewTab::captureActive(int cap)
@@ -105,13 +105,13 @@ void ByteViewTab::addTab(const char *name, tvbuff_t *tvb) {
ByteViewText * byte_view_text = new ByteViewText(data, encoding, this);
byte_view_text->setAccessibleName(name);
- byte_view_text->setMonospaceFont(wsApp->monospaceFont(true));
+ byte_view_text->setMonospaceFont(mainApp->monospaceFont(true));
if (tvb)
{
byte_view_text->setProperty(tvb_data_property, VariantPointer<tvbuff_t>::asQVariant(tvb));
- connect(wsApp, SIGNAL(zoomMonospaceFont(QFont)), byte_view_text, SLOT(setMonospaceFont(QFont)));
+ connect(mainApp, SIGNAL(zoomMonospaceFont(QFont)), byte_view_text, SLOT(setMonospaceFont(QFont)));
connect(byte_view_text, SIGNAL(byteHovered(int)), this, SLOT(byteViewTextHovered(int)));
connect(byte_view_text, SIGNAL(byteSelected(int)), this, SLOT(byteViewTextMarked(int)));
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 304b64be99..a70f4da404 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -47,7 +47,7 @@
#include "epan/prefs.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include <wireshark_application.h>
+#include <main_application.h>
CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString &display_filter) :
WiresharkFileDialog(parent),
@@ -70,7 +70,7 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString
* use the "last opened" directory saved in the preferences file if
* there was one.
*/
- setDirectory(wsApp->lastOpenDir());
+ setDirectory(mainApp->lastOpenDir());
break;
case FO_STYLE_SPECIFIED:
@@ -275,7 +275,7 @@ wtap_compression_type CaptureFileDialog::compressionType() {
}
int CaptureFileDialog::open(QString &file_name, unsigned int &type) {
- QString title_str = wsApp->windowTitleString(tr("Open Capture File"));
+ QString title_str = mainApp->windowTitleString(tr("Open Capture File"));
GString *fname = g_string_new(file_name.toUtf8().constData());
GString *dfilter = g_string_new(display_filter_.toUtf8().constData());
gboolean wof_status;
@@ -292,7 +292,7 @@ int CaptureFileDialog::open(QString &file_name, unsigned int &type) {
}
check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_support_all_comments) {
- QString title_str = wsApp->windowTitleString(tr("Save Capture File As"));
+ QString title_str = mainApp->windowTitleString(tr("Save Capture File As"));
GString *fname = g_string_new(file_name.toUtf8().constData());
gboolean wsf_status;
@@ -309,7 +309,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo
}
check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, packet_range_t *range, QString selRange) {
- QString title_str = wsApp->windowTitleString(tr("Export Specified Packets"));
+ QString title_str = mainApp->windowTitleString(tr("Export Specified Packets"));
GString *fname = g_string_new(file_name.toUtf8().constData());
gboolean wespf_status;
@@ -331,7 +331,7 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name,
}
int CaptureFileDialog::merge(QString &file_name) {
- QString title_str = wsApp->windowTitleString(tr("Merge Capture File"));
+ QString title_str = mainApp->windowTitleString(tr("Merge Capture File"));
GString *fname = g_string_new(file_name.toUtf8().constData());
GString *dfilter = g_string_new(display_filter_.toUtf8().constData());
gboolean wmf_status;
@@ -700,7 +700,7 @@ QDialogButtonBox *CaptureFileDialog::addHelpButton(topic_action_e help_topic)
}
int CaptureFileDialog::open(QString &file_name, unsigned int &type) {
- setWindowTitle(wsApp->windowTitleString(tr("Open Capture File")));
+ setWindowTitle(mainApp->windowTitleString(tr("Open Capture File")));
setNameFilters(buildFileOpenTypeList());
setFileMode(QFileDialog::ExistingFile);
@@ -730,7 +730,7 @@ int CaptureFileDialog::open(QString &file_name, unsigned int &type) {
}
check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_support_all_comments) {
- setWindowTitle(wsApp->windowTitleString(tr("Save Capture File As")));
+ setWindowTitle(mainApp->windowTitleString(tr("Save Capture File As")));
// XXX There doesn't appear to be a way to use setNameFilters without restricting
// what the user can select. We might want to use our own combobox instead and
// let the user select anything.
@@ -773,7 +773,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo
check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, packet_range_t *range, QString selRange) {
QDialogButtonBox *button_box;
- setWindowTitle(wsApp->windowTitleString(tr("Export Specified Packets")));
+ setWindowTitle(mainApp->windowTitleString(tr("Export Specified Packets")));
// XXX See comment in ::saveAs regarding setNameFilters
setNameFilters(buildFileSaveAsTypeList(false));
setAcceptMode(QFileDialog::AcceptSave);
@@ -821,7 +821,7 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name,
}
int CaptureFileDialog::merge(QString &file_name) {
- setWindowTitle(wsApp->windowTitleString(tr("Merge Capture File")));
+ setWindowTitle(mainApp->windowTitleString(tr("Merge Capture File")));
setNameFilters(buildFileOpenTypeList());
setFileMode(QFileDialog::ExistingFile);
@@ -1025,7 +1025,7 @@ void CaptureFileDialog::preview(const QString & path)
void CaptureFileDialog::on_buttonBox_helpRequested()
{
- if (help_topic_ != TOPIC_ACTION_NONE) wsApp->helpTopicAction(help_topic_);
+ if (help_topic_ != TOPIC_ACTION_NONE) mainApp->helpTopicAction(help_topic_);
}
#endif // ! Q_OS_WIN
diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp
index 5bffed8f73..eb42bd9c33 100644
--- a/ui/qt/capture_file_properties_dialog.cpp
+++ b/ui/qt/capture_file_properties_dialog.cpp
@@ -19,7 +19,7 @@
#include "ui/version_info.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QPushButton>
#include <QScrollBar>
@@ -604,7 +604,7 @@ void CaptureFilePropertiesDialog::changeEvent(QEvent* event)
void CaptureFilePropertiesDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_STATS_SUMMARY_DIALOG);
+ mainApp->helpTopicAction(HELP_STATS_SUMMARY_DIALOG);
}
void CaptureFilePropertiesDialog::on_buttonBox_accepted()
diff --git a/ui/qt/capture_info_dialog.cpp b/ui/qt/capture_info_dialog.cpp
index 4a04ce1249..81c2ae61b7 100644
--- a/ui/qt/capture_info_dialog.cpp
+++ b/ui/qt/capture_info_dialog.cpp
@@ -21,7 +21,7 @@
#include "capture_info_dialog.h"
#include "ui_capture_info_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/models/sparkline_delegate.h"
@@ -92,7 +92,7 @@ CaptureInfoDialog::CaptureInfoDialog(struct _capture_info *cap_info, struct _cap
{
ui->setupUi(this);
loadGeometry();
- setWindowTitle(wsApp->windowTitleString(tr("Capture Information")));
+ setWindowTitle(mainApp->windowTitleString(tr("Capture Information")));
QPushButton *button = ui->buttonBox->button(QDialogButtonBox::Abort);
button->setText(tr("Stop Capture"));
diff --git a/ui/qt/capture_options_dialog.cpp b/ui/qt/capture_options_dialog.cpp
index cc228ebec6..b86498aad6 100644
--- a/ui/qt/capture_options_dialog.cpp
+++ b/ui/qt/capture_options_dialog.cpp
@@ -17,7 +17,7 @@
#include "compiled_filter_output.h"
#include "manage_interfaces_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include "extcap.h"
@@ -161,7 +161,7 @@ public:
}
void setApplicable(int column, bool applicable = false) {
- QPalette palette = wsApp->palette();
+ QPalette palette = mainApp->palette();
if (applicable) {
setText(column, QString());
@@ -181,7 +181,7 @@ CaptureOptionsDialog::CaptureOptionsDialog(QWidget *parent) :
{
ui->setupUi(this);
loadGeometry();
- setWindowTitle(wsApp->windowTitleString(tr("Capture Options")));
+ setWindowTitle(mainApp->windowTitleString(tr("Capture Options")));
stat_timer_ = NULL;
stat_cache_ = NULL;
@@ -230,7 +230,7 @@ CaptureOptionsDialog::CaptureOptionsDialog(QWidget *parent) :
connect(&interface_item_delegate_, SIGNAL(filterChanged(QString)),
this, SIGNAL(captureFilterTextEdited(QString)));
connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList()));
- connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces()));
+ connect(mainApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces()));
connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
connect(ui->interfaceTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemClicked(QTreeWidgetItem*,int)));
connect(ui->interfaceTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*)));
@@ -635,7 +635,7 @@ void CaptureOptionsDialog::on_buttonBox_rejected()
void CaptureOptionsDialog::on_buttonBox_helpRequested()
{
// Probably the wrong URL.
- wsApp->helpTopicAction(HELP_CAPTURE_OPTIONS_DIALOG);
+ mainApp->helpTopicAction(HELP_CAPTURE_OPTIONS_DIALOG);
}
void CaptureOptionsDialog::updateInterfaces()
diff --git a/ui/qt/capture_preferences_frame.cpp b/ui/qt/capture_preferences_frame.cpp
index 59694e2909..e5fbd5a76e 100644
--- a/ui/qt/capture_preferences_frame.cpp
+++ b/ui/qt/capture_preferences_frame.cpp
@@ -18,7 +18,7 @@
#include "capture_preferences_frame.h"
#include <ui/qt/models/pref_models.h>
#include <ui_capture_preferences_frame.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QSpacerItem>
@@ -76,7 +76,7 @@ void CapturePreferencesFrame::updateWidgets()
* see whether any have showed up (or privileges have changed
* to allow us to access them).
*/
- wsApp->refreshLocalInterfaces();
+ mainApp->refreshLocalInterfaces();
}
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
device = &g_array_index(global_capture_opts.all_ifaces, interface_t, i);
diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp
index 9a7c92d325..8dc1628dbe 100644
--- a/ui/qt/coloring_rules_dialog.cpp
+++ b/ui/qt/coloring_rules_dialog.cpp
@@ -20,7 +20,8 @@
#include "wsutil/filesystem.h"
#include "epan/dfilter/dfilter.h"
-#include "wireshark_application.h"
+#include "main_application.h"
+
#include "ui/qt/utils/qt_ui_utils.h"
#include "ui/qt/widgets/copy_from_profile_button.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
@@ -50,7 +51,7 @@ ColoringRulesDialog::ColoringRulesDialog(QWidget *parent, QString add_filter) :
ui->setupUi(this);
if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 4 / 5);
- setWindowTitle(wsApp->windowTitleString(tr("Coloring Rules %1").arg(get_profile_name())));
+ setWindowTitle(mainApp->windowTitleString(tr("Coloring Rules %1").arg(get_profile_name())));
ui->coloringRulesTreeView->setModel(&colorRuleModel_);
ui->coloringRulesTreeView->setItemDelegate(&colorRuleDelegate_);
@@ -433,8 +434,8 @@ void ColoringRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
QString err;
if (button == import_button_) {
- QString file_name = WiresharkFileDialog::getOpenFileName(this, wsApp->windowTitleString(tr("Import Coloring Rules")),
- wsApp->lastOpenDir().path());
+ QString file_name = WiresharkFileDialog::getOpenFileName(this, mainApp->windowTitleString(tr("Import Coloring Rules")),
+ mainApp->lastOpenDir().path());
if (!file_name.isEmpty()) {
if (!colorRuleModel_.importColors(file_name, err)) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err.toUtf8().constData());
@@ -452,9 +453,9 @@ void ColoringRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
if (num_items < 1)
return;
- QString caption = wsApp->windowTitleString(tr("Export %1 Coloring Rules").arg(num_items));
+ QString caption = mainApp->windowTitleString(tr("Export %1 Coloring Rules").arg(num_items));
QString file_name = WiresharkFileDialog::getSaveFileName(this, caption,
- wsApp->lastOpenDir().path());
+ mainApp->lastOpenDir().path());
if (!file_name.isEmpty()) {
if (!colorRuleModel_.exportColors(file_name, err)) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err.toUtf8().constData());
@@ -473,5 +474,5 @@ void ColoringRulesDialog::on_buttonBox_accepted()
void ColoringRulesDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_COLORING_RULES_DIALOG);
+ mainApp->helpTopicAction(HELP_COLORING_RULES_DIALOG);
}
diff --git a/ui/qt/column_editor_frame.cpp b/ui/qt/column_editor_frame.cpp
index be28b62458..00491d1d78 100644
--- a/ui/qt/column_editor_frame.cpp
+++ b/ui/qt/column_editor_frame.cpp
@@ -17,7 +17,8 @@
#include <ui/recent.h>
#include <ui/preference_utils.h>
-#include <ui/qt/wireshark_application.h>
+
+#include "main_application.h"
#include "column_editor_frame.h"
#include <ui_column_editor_frame.h>
@@ -168,11 +169,11 @@ void ColumnEditorFrame::keyPressEvent(QKeyEvent *event)
if (ui->buttonBox->button(QDialogButtonBox::Ok)->isEnabled()) {
on_buttonBox_accepted();
} else if (ui->fieldsNameLineEdit->syntaxState() == SyntaxLineEdit::Empty) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, tr("Missing fields."));
+ mainApp->pushStatus(MainApplication::FilterSyntax, tr("Missing fields."));
} else if (ui->fieldsNameLineEdit->syntaxState() != SyntaxLineEdit::Valid) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, tr("Invalid fields."));
+ mainApp->pushStatus(MainApplication::FilterSyntax, tr("Invalid fields."));
} else if (ui->occurrenceLineEdit->syntaxState() == SyntaxLineEdit::Invalid) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, tr("Invalid occurrence value."));
+ mainApp->pushStatus(MainApplication::FilterSyntax, tr("Invalid occurrence value."));
}
}
}
diff --git a/ui/qt/column_preferences_frame.cpp b/ui/qt/column_preferences_frame.cpp
index 4e3e14be93..e71f681300 100644
--- a/ui/qt/column_preferences_frame.cpp
+++ b/ui/qt/column_preferences_frame.cpp
@@ -24,7 +24,7 @@
#include <ui/qt/widgets/syntax_line_edit.h>
#include <ui/qt/widgets/field_filter_edit.h>
#include <ui/qt/models/column_list_model.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QComboBox>
#include <QTreeWidgetItemIterator>
@@ -84,7 +84,7 @@ ColumnPreferencesFrame::~ColumnPreferencesFrame()
void ColumnPreferencesFrame::unstash()
{
model_->saveColumns();
- wsApp->emitAppSignal(WiresharkApplication::ColumnsChanged);
+ mainApp->emitAppSignal(MainApplication::ColumnsChanged);
}
void ColumnPreferencesFrame::on_newToolButton_clicked()
diff --git a/ui/qt/compiled_filter_output.cpp b/ui/qt/compiled_filter_output.cpp
index 3a8f349c59..5b6a7e4e46 100644
--- a/ui/qt/compiled_filter_output.cpp
+++ b/ui/qt/compiled_filter_output.cpp
@@ -20,7 +20,7 @@
#include <wiretap/wtap.h>
#include "ui/capture_globals.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QClipboard>
#include <QPushButton>
@@ -34,7 +34,7 @@ CompiledFilterOutput::CompiledFilterOutput(QWidget *parent, QStringList &intList
ui->setupUi(this);
loadGeometry();
setAttribute(Qt::WA_DeleteOnClose, true);
- ui->filterList->setCurrentFont(wsApp->monospaceFont());
+ ui->filterList->setCurrentFont(mainApp->monospaceFont());
copy_bt_ = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
copy_bt_->setToolTip(tr("Copy filter text to the clipboard."));
@@ -113,5 +113,5 @@ void CompiledFilterOutput::on_interfaceList_currentItemChanged(QListWidgetItem *
void CompiledFilterOutput::copyFilterText()
{
- wsApp->clipboard()->setText(ui->filterList->toPlainText());
+ mainApp->clipboard()->setText(ui->filterList->toPlainText());
}
diff --git a/ui/qt/conversation_dialog.cpp b/ui/qt/conversation_dialog.cpp
index c8df7e2cf7..6e05c0022d 100644
--- a/ui/qt/conversation_dialog.cpp
+++ b/ui/qt/conversation_dialog.cpp
@@ -20,7 +20,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/models/timeline_delegate.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QCheckBox>
#include <QDateTime>
@@ -64,7 +64,7 @@ ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli
graph_bt_->setToolTip(tr("Graph a TCP conversation."));
connect(graph_bt_, SIGNAL(clicked()), this, SLOT(graphTcp()));
- connect(wsApp->mainWindow(), SIGNAL(displayFilterSuccess(bool)),
+ connect(mainApp->mainWindow(), SIGNAL(displayFilterSuccess(bool)),
this, SLOT(displayFilterSuccess(bool)));
absoluteTimeCheckBox()->show();
@@ -306,7 +306,7 @@ void ConversationDialog::on_displayFilterCheckBox_toggled(bool checked)
void ConversationDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_STATS_CONVERSATIONS_DIALOG);
+ mainApp->helpTopicAction(HELP_STATS_CONVERSATIONS_DIALOG);
}
void ConversationDialog::displayFilterSuccess(bool success)
@@ -323,7 +323,7 @@ void ConversationDialog::displayFilterSuccess(bool success)
void init_conversation_table(struct register_ct* ct, const char *filter)
{
- wsApp->emitStatCommandSignal("Conversations", filter, GINT_TO_POINTER(get_conversation_proto_id(ct)));
+ mainApp->emitStatCommandSignal("Conversations", filter, GINT_TO_POINTER(get_conversation_proto_id(ct)));
}
diff --git a/ui/qt/conversation_hash_tables_dialog.cpp b/ui/qt/conversation_hash_tables_dialog.cpp
index d2be6c7fa6..4ded5073c9 100644
--- a/ui/qt/conversation_hash_tables_dialog.cpp
+++ b/ui/qt/conversation_hash_tables_dialog.cpp
@@ -18,7 +18,7 @@
#include <epan/conversation_debug.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
ConversationHashTablesDialog::ConversationHashTablesDialog(QWidget *parent) :
GeometryStateDialog(parent),
@@ -27,7 +27,7 @@ ConversationHashTablesDialog::ConversationHashTablesDialog(QWidget *parent) :
ui->setupUi(this);
if (parent) loadGeometry(parent->width() * 3 / 4, parent->height() * 3 / 4);
setAttribute(Qt::WA_DeleteOnClose, true);
- setWindowTitle(wsApp->windowTitleString(tr("Conversation Hash Tables")));
+ setWindowTitle(mainApp->windowTitleString(tr("Conversation Hash Tables")));
QString html;
diff --git a/ui/qt/credentials_dialog.cpp b/ui/qt/credentials_dialog.cpp
index 28446a1f2d..6627dbc355 100644
--- a/ui/qt/credentials_dialog.cpp
+++ b/ui/qt/credentials_dialog.cpp
@@ -17,7 +17,7 @@
#include "credentials_dialog.h"
#include <ui_credentials_dialog.h>
#include <ui/tap-credentials.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include "ui/qt/models/credentials_model.h"
#include <ui/qt/models/url_link_delegate.h>
diff --git a/ui/qt/decode_as_dialog.cpp b/ui/qt/decode_as_dialog.cpp
index 8f2af90975..edc6ccc798 100644
--- a/ui/qt/decode_as_dialog.cpp
+++ b/ui/qt/decode_as_dialog.cpp
@@ -20,7 +20,7 @@
#include <ui/qt/widgets/copy_from_profile_button.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/variant_pointer.h>
@@ -63,7 +63,7 @@ DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf, bool create_ne
ui->pathLabel->setAttribute(Qt::WA_MacSmallSize, true);
#endif
- setWindowTitle(wsApp->windowTitleString(tr("Decode As…")));
+ setWindowTitle(mainApp->windowTitleString(tr("Decode As…")));
QString abs_path = gchar_free_to_qstring(get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE));
if (file_exists(abs_path.toUtf8().constData())) {
@@ -200,7 +200,7 @@ void DecodeAsDialog::on_clearToolButton_clicked()
void DecodeAsDialog::applyChanges()
{
model_->applyChanges();
- wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->queueAppSignal(MainApplication::PacketDissectionChanged);
}
void DecodeAsDialog::on_buttonBox_clicked(QAbstractButton *button)
@@ -223,7 +223,7 @@ void DecodeAsDialog::on_buttonBox_clicked(QAbstractButton *button)
}
break;
case QDialogButtonBox::Help:
- wsApp->helpTopicAction(HELP_DECODE_AS_SHOW_DIALOG);
+ mainApp->helpTopicAction(HELP_DECODE_AS_SHOW_DIALOG);
break;
default:
break;
diff --git a/ui/qt/display_filter_expression_dialog.cpp b/ui/qt/display_filter_expression_dialog.cpp
index 166843ae93..3fcb5eaafc 100644
--- a/ui/qt/display_filter_expression_dialog.cpp
+++ b/ui/qt/display_filter_expression_dialog.cpp
@@ -20,7 +20,7 @@
#include <wsutil/utf8_entities.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/variant_pointer.h>
@@ -64,8 +64,8 @@ DisplayFilterExpressionDialog::DisplayFilterExpressionDialog(QWidget *parent) :
if (parent) loadGeometry(parent->width() * 2 / 3, parent->height());
setAttribute(Qt::WA_DeleteOnClose, true);
- setWindowTitle(wsApp->windowTitleString(tr("Display Filter Expression")));
- setWindowIcon(wsApp->normalIcon());
+ setWindowTitle(mainApp->windowTitleString(tr("Display Filter Expression")));
+ setWindowIcon(mainApp->normalIcon());
proto_initialize_all_prefixes();
@@ -126,7 +126,7 @@ void DisplayFilterExpressionDialog::fillTree()
proto_list << proto_ti;
}
- wsApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
+ mainApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
ui->fieldTreeWidget->invisibleRootItem()->addChildren(proto_list);
ui->fieldTreeWidget->sortByColumn(0, Qt::AscendingOrder);
@@ -149,14 +149,14 @@ void DisplayFilterExpressionDialog::fillTree()
field_count++;
if (field_count % 10000 == 0) {
- wsApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
+ mainApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
}
}
std::sort(field_list.begin(), field_list.end());
proto_ti->addChildren(field_list);
}
- wsApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
+ mainApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
ui->fieldTreeWidget->sortByColumn(0, Qt::AscendingOrder);
updateWidgets();
@@ -446,5 +446,5 @@ void DisplayFilterExpressionDialog::on_buttonBox_accepted()
void DisplayFilterExpressionDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_FILTER_EXPRESSION_DIALOG);
+ mainApp->helpTopicAction(HELP_FILTER_EXPRESSION_DIALOG);
}
diff --git a/ui/qt/dissector_tables_dialog.cpp b/ui/qt/dissector_tables_dialog.cpp
index 30d0ce3d92..51e5cf7ea9 100644
--- a/ui/qt/dissector_tables_dialog.cpp
+++ b/ui/qt/dissector_tables_dialog.cpp
@@ -12,7 +12,7 @@
#include <ui/qt/dissector_tables_dialog.h>
#include <ui_dissector_tables_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
DissectorTablesDialog::DissectorTablesDialog(QWidget *parent) :
GeometryStateDialog(parent),
@@ -24,7 +24,7 @@ DissectorTablesDialog::DissectorTablesDialog(QWidget *parent) :
loadGeometry(parent->width() * 3 / 4, parent->height() * 3 / 4);
setAttribute(Qt::WA_DeleteOnClose, true);
- setWindowTitle(wsApp->windowTitleString(tr("Dissector Tables")));
+ setWindowTitle(mainApp->windowTitleString(tr("Dissector Tables")));
proxyModel_ = new DissectorTablesProxyModel(this);
proxyModel_->setSourceModel(new DissectorTablesModel(this));
diff --git a/ui/qt/enabled_protocols_dialog.cpp b/ui/qt/enabled_protocols_dialog.cpp
index 984fcb9bce..e503991d0f 100644
--- a/ui/qt/enabled_protocols_dialog.cpp
+++ b/ui/qt/enabled_protocols_dialog.cpp
@@ -14,7 +14,7 @@
#include <epan/prefs.h>
-#include "wireshark_application.h"
+#include "main_application.h"
EnabledProtocolsDialog::EnabledProtocolsDialog(QWidget *parent) :
GeometryStateDialog(parent),
@@ -28,7 +28,7 @@ EnabledProtocolsDialog::EnabledProtocolsDialog(QWidget *parent) :
proxyModel_->setSourceModel(enabled_protocols_model_);
ui->protocol_tree_->setModel(proxyModel_);
- setWindowTitle(wsApp->windowTitleString(tr("Enabled Protocols")));
+ setWindowTitle(mainApp->windowTitleString(tr("Enabled Protocols")));
// Some protocols have excessively long names. Instead of calling
// resizeColumnToContents, pick a reasonable-ish em width and apply it.
@@ -121,5 +121,5 @@ void EnabledProtocolsDialog::on_buttonBox_accepted()
void EnabledProtocolsDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_ENABLED_PROTOCOLS_DIALOG);
+ mainApp->helpTopicAction(HELP_ENABLED_PROTOCOLS_DIALOG);
}
diff --git a/ui/qt/endpoint_dialog.cpp b/ui/qt/endpoint_dialog.cpp
index c5fd48333a..0d56c7369a 100644
--- a/ui/qt/endpoint_dialog.cpp
+++ b/ui/qt/endpoint_dialog.cpp
@@ -24,7 +24,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/utils/variant_pointer.h>
#include <ui/qt/widgets/wireshark_file_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QCheckBox>
#include <QDesktopServices>
@@ -293,12 +293,12 @@ void EndpointDialog::saveMap()
void EndpointDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_STATS_ENDPOINTS_DIALOG);
+ mainApp->helpTopicAction(HELP_STATS_ENDPOINTS_DIALOG);
}
void init_endpoint_table(struct register_ct* ct, const char *filter)
{
- wsApp->emitStatCommandSignal("Endpoints", filter, GINT_TO_POINTER(get_conversation_proto_id(ct)));
+ mainApp->emitStatCommandSignal("Endpoints", filter, GINT_TO_POINTER(get_conversation_proto_id(ct)));
}
// EndpointTreeWidgetItem
diff --git a/ui/qt/expert_info_dialog.cpp b/ui/qt/expert_info_dialog.cpp
index f5f2eef024..012729b906 100644
--- a/ui/qt/expert_info_dialog.cpp
+++ b/ui/qt/expert_info_dialog.cpp
@@ -17,7 +17,7 @@
#include <epan/stat_tap_ui.h>
#include <epan/tap.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QAction>
#include <QHash>
@@ -321,14 +321,14 @@ void ExpertInfoDialog::on_searchLineEdit_textChanged(const QString &search_re)
void ExpertInfoDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_EXPERT_INFO_DIALOG);
+ mainApp->helpTopicAction(HELP_EXPERT_INFO_DIALOG);
}
// Stat command + args
static void
expert_info_init(const char *, void*) {
- wsApp->emitStatCommandSignal("ExpertInfo", NULL, NULL);
+ mainApp->emitStatCommandSignal("ExpertInfo", NULL, NULL);
}
static stat_tap_ui expert_info_stat_ui = {
diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp
index e76da7a289..a4653eeab8 100644
--- a/ui/qt/export_dissection_dialog.cpp
+++ b/ui/qt/export_dissection_dialog.cpp
@@ -31,7 +31,7 @@
#endif // Q_OS_WIN
#include <epan/prefs.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#if !defined(Q_OS_WIN)
static const QStringList export_extensions = QStringList()
@@ -56,7 +56,7 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca
, sel_range_(selRange)
#endif /* Q_OS_WIN */
{
- setWindowTitle(wsApp->windowTitleString(tr("Export Packet Dissections")));
+ setWindowTitle(mainApp->windowTitleString(tr("Export Packet Dissections")));
switch (prefs.gui_fileopen_style) {
@@ -67,7 +67,7 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca
* use the "last opened" directory saved in the preferences file if
* there was one.
*/
- setDirectory(wsApp->lastOpenDir());
+ setDirectory(mainApp->lastOpenDir());
break;
case FO_STYLE_SPECIFIED:
@@ -284,6 +284,6 @@ void ExportDissectionDialog::checkValidity()
void ExportDissectionDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_EXPORT_FILE_DIALOG);
+ mainApp->helpTopicAction(HELP_EXPORT_FILE_DIALOG);
}
#endif // Q_OS_WIN
diff --git a/ui/qt/export_object_dialog.cpp b/ui/qt/export_object_dialog.cpp
index a7e484f1d1..2b9ca4ac5f 100644
--- a/ui/qt/export_object_dialog.cpp
+++ b/ui/qt/export_object_dialog.cpp
@@ -13,7 +13,7 @@
#include <ui/alert_box.h>
#include <wsutil/utf8_entities.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include <ui/qt/widgets/export_objects_view.h>
#include <ui/qt/models/export_objects_model.h>
@@ -73,7 +73,7 @@ ExportObjectDialog::ExportObjectDialog(QWidget &parent, CaptureFile &cf, registe
contentTypes << tr("All Content-Types");
eo_ui_->cmbContentType->addItems(contentTypes);
- setWindowTitle(wsApp->windowTitleString(QStringList() << tr("Export") << tr("%1 object list").arg(proto_get_protocol_short_name(find_protocol_by_id(get_eo_proto_id(eo))))));
+ setWindowTitle(mainApp->windowTitleString(QStringList() << tr("Export") << tr("%1 object list").arg(proto_get_protocol_short_name(find_protocol_by_id(get_eo_proto_id(eo))))));
if (save_bt_) save_bt_->setEnabled(false);
if (save_all_bt_) save_all_bt_->setEnabled(false);
@@ -100,7 +100,7 @@ void ExportObjectDialog::currentHasChanged(QModelIndex current)
QString mime_type = sibl.sibling(current.row(), ExportObjectModel::colContent).data().toString();
eo_ui_->buttonBox->button(QDialogButtonBox::Open)->setEnabled(mimeTypeIsPreviewable(mime_type));
}
- wsApp->gotoFrame(sibl.data().toInt());
+ mainApp->gotoFrame(sibl.data().toInt());
}
}
@@ -201,7 +201,7 @@ void ExportObjectDialog::captureEvent(CaptureEvent e)
void ExportObjectDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_EXPORT_OBJECT_LIST);
+ mainApp->helpTopicAction(HELP_EXPORT_OBJECT_LIST);
}
void ExportObjectDialog::on_buttonBox_clicked(QAbstractButton *button)
@@ -244,7 +244,7 @@ void ExportObjectDialog::on_cmbContentType_currentIndexChanged(int index)
void ExportObjectDialog::saveCurrentEntry(QString *tempFile)
{
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QModelIndex proxyIndex = eo_ui_->objectTree->currentIndex();
if (!proxyIndex.isValid())
@@ -262,7 +262,7 @@ void ExportObjectDialog::saveCurrentEntry(QString *tempFile)
if (!tempFile)
{
GString *safe_filename = eo_massage_str(entry_filename.toUtf8().constData(), EXPORT_OBJECT_MAXFILELEN, 0);
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Object As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Object As…")),
safe_filename->str);
g_string_free(safe_filename, TRUE);
} else {
@@ -279,7 +279,7 @@ void ExportObjectDialog::saveCurrentEntry(QString *tempFile)
void ExportObjectDialog::saveAllEntries()
{
- QDir save_in_dir(wsApp->lastOpenDir());
+ QDir save_in_dir(mainApp->lastOpenDir());
QString save_in_path;
//
@@ -292,7 +292,7 @@ void ExportObjectDialog::saveAllEntries()
// as the native dialog is used, and it supports that; does
// that also work on Windows and with Qt's own dialog?
//
- save_in_path = WiresharkFileDialog::getExistingDirectory(this, wsApp->windowTitleString(tr("Save All Objects In…")),
+ save_in_path = WiresharkFileDialog::getExistingDirectory(this, mainApp->windowTitleString(tr("Save All Objects In…")),
save_in_dir.canonicalPath(),
QFileDialog::ShowDirsOnly);
diff --git a/ui/qt/extcap_options_dialog.cpp b/ui/qt/extcap_options_dialog.cpp
index aa00e40e9d..eaf0df7767 100644
--- a/ui/qt/extcap_options_dialog.cpp
+++ b/ui/qt/extcap_options_dialog.cpp
@@ -14,7 +14,7 @@
#include <extcap_options_dialog.h>
#include <ui_extcap_options_dialog.h>
-#include <wireshark_application.h>
+#include <main_application.h>
#include <QMessageBox>
#include <QHash>
@@ -47,7 +47,7 @@
#include <epan/prefs.h>
#include <ui/preference_utils.h>
-#include <ui/qt/wireshark_application.h>
+#include <ui/qt/main_application.h>
#include <ui/qt/utils/variant_pointer.h>
#include <ui/qt/extcap_argument.h>
@@ -63,7 +63,7 @@ ExtcapOptionsDialog::ExtcapOptionsDialog(bool startCaptureOnClose, QWidget *pare
{
ui->setupUi(this);
- setWindowTitle(wsApp->windowTitleString(tr("Interface Options")));
+ setWindowTitle(mainApp->windowTitleString(tr("Interface Options")));
ui->checkSaveOnStart->setCheckState(prefs.extcap_save_on_start ? Qt::Checked : Qt::Unchecked);
@@ -101,7 +101,7 @@ ExtcapOptionsDialog * ExtcapOptionsDialog::createForDevice(QString &dev_name, bo
resultDialog->device_name = QString(dev_name);
resultDialog->device_idx = if_idx;
- resultDialog->setWindowTitle(wsApp->windowTitleString(tr("Interface Options") + ": " + device->display_name));
+ resultDialog->setWindowTitle(mainApp->windowTitleString(tr("Interface Options") + ": " + device->display_name));
resultDialog->updateWidgets();
@@ -410,7 +410,7 @@ void ExtcapOptionsDialog::on_buttonBox_helpRequested()
interface_help = QString(extcap_get_help_for_ifname(device->name));
/* The extcap interface didn't provide an help. Let's go with the default */
if (interface_help.isEmpty()) {
- wsApp->helpTopicAction(HELP_EXTCAP_OPTIONS_DIALOG);
+ mainApp->helpTopicAction(HELP_EXTCAP_OPTIONS_DIALOG);
return;
}
@@ -611,7 +611,7 @@ void ExtcapOptionsDialog::storeValues()
if (g_hash_table_size(entries) > 0)
{
if (prefs_store_ext_multiple("extcap", entries))
- wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
+ mainApp->emitAppSignal(MainApplication::PreferencesChanged);
}
}
diff --git a/ui/qt/file_set_dialog.cpp b/ui/qt/file_set_dialog.cpp
index ea8ea505da..70f3891418 100644
--- a/ui/qt/file_set_dialog.cpp
+++ b/ui/qt/file_set_dialog.cpp
@@ -21,7 +21,7 @@
#include "file_set_dialog.h"
#include <ui_file_set_dialog.h>
#include "models/fileset_entry_model.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QDialogButtonBox>
#include <QPushButton>
@@ -108,7 +108,7 @@ void FileSetDialog::addFile(fileset_entry *entry) {
void FileSetDialog::beginAddFile()
{
cur_idx_ = -1;
- setWindowTitle(wsApp->windowTitleString(tr("No files in Set")));
+ setWindowTitle(mainApp->windowTitleString(tr("No files in Set")));
fs_ui_->directoryLabel->setText(tr("No capture loaded"));
fs_ui_->directoryLabel->setEnabled(false);
}
@@ -116,7 +116,7 @@ void FileSetDialog::beginAddFile()
void FileSetDialog::endAddFile()
{
if (fileset_entry_model_->entryCount() > 0) {
- setWindowTitle(wsApp->windowTitleString(tr("%Ln File(s) in Set", "",
+ setWindowTitle(mainApp->windowTitleString(tr("%Ln File(s) in Set", "",
fileset_entry_model_->entryCount())));
}
@@ -153,5 +153,5 @@ void FileSetDialog::selectionChanged(const QItemSelection &selected, const QItem
void FileSetDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_FILESET_DIALOG);
+ mainApp->helpTopicAction(HELP_FILESET_DIALOG);
}
diff --git a/ui/qt/filter_action.cpp b/ui/qt/filter_action.cpp
index 2e13145b21..08e24a1cc6 100644
--- a/ui/qt/filter_action.cpp
+++ b/ui/qt/filter_action.cpp
@@ -9,7 +9,7 @@
#include "filter_action.h"
-#include <ui/qt/wireshark_application.h>
+#include <ui/qt/main_application.h>
#include <ui/qt/main_window.h>
#include <QMenu>
@@ -187,9 +187,9 @@ QActionGroup * FilterAction::createFilterGroup(QString filter, bool prepare, boo
enabled = false;
bool filterEmpty = false;
- if (wsApp)
+ if (mainApp)
{
- QWidget * mainWin = wsApp->mainWindow();
+ QWidget * mainWin = mainApp->mainWindow();
if (qobject_cast<MainWindow *>(mainWin))
filterEmpty = qobject_cast<MainWindow *>(mainWin)->getFilter().isEmpty();
}
@@ -245,7 +245,7 @@ QMenu * FilterAction::createFilterMenu(FilterAction::Action act, QString filter,
void FilterAction::groupTriggered(QAction * action)
{
- if (action && wsApp)
+ if (action && mainApp)
{
if (action->property("filterType").canConvert<FilterAction::ActionType>() &&
sender()->property("filterAction").canConvert<FilterAction::Action>())
@@ -254,7 +254,7 @@ void FilterAction::groupTriggered(QAction * action)
FilterAction::ActionType type = action->property("filterType").value<FilterAction::ActionType>();
QString filter = sender()->property("filter").toString();
- QWidget * mainWin = wsApp->mainWindow();
+ QWidget * mainWin = mainApp->mainWindow();
if (qobject_cast<MainWindow *>(mainWin))
{
MainWindow * mw = qobject_cast<MainWindow *>(mainWin);
@@ -285,5 +285,5 @@ void FilterAction::copyActionTriggered()
QString filter = sendAction->property("filter").toString();
if (filter.length() > 0)
- wsApp->clipboard()->setText(filter);
+ mainApp->clipboard()->setText(filter);
}
diff --git a/ui/qt/filter_dialog.cpp b/ui/qt/filter_dialog.cpp
index eff1eae1b7..36d138d7b5 100644
--- a/ui/qt/filter_dialog.cpp
+++ b/ui/qt/filter_dialog.cpp
@@ -28,7 +28,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/widgets/capture_filter_edit.h>
#include <ui/qt/widgets/display_filter_edit.h>
-#include "wireshark_application.h"
+#include "main_application.h"
FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, QString new_filter_) :
GeometryStateDialog(parent),
@@ -39,7 +39,7 @@ FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, QString new_
ui->setupUi(this);
if (parent) loadGeometry(parent->width() * 2 / 3, parent->height() * 2 / 3);
- setWindowIcon(wsApp->normalIcon());
+ setWindowIcon(mainApp->normalIcon());
ui->newToolButton->setStockIcon("list-add");
ui->deleteToolButton->setStockIcon("list-remove");
@@ -65,12 +65,12 @@ FilterDialog::FilterDialog(QWidget *parent, FilterType filter_type, QString new_
const gchar * filename = NULL;
QString newFilterText;
if (filter_type == CaptureFilter) {
- setWindowTitle(wsApp->windowTitleString(tr("Capture Filters")));
+ setWindowTitle(mainApp->windowTitleString(tr("Capture Filters")));
filename = CFILTER_FILE_NAME;
newFilterText = tr("New capture filter");
model_ = new FilterListModel(FilterListModel::Capture, this);
} else {
- setWindowTitle(wsApp->windowTitleString(tr("Display Filters")));
+ setWindowTitle(mainApp->windowTitleString(tr("Display Filters")));
filename = DFILTER_FILE_NAME;
newFilterText = tr("New display filter");
model_ = new FilterListModel(FilterListModel::Display, this);
@@ -176,18 +176,18 @@ void FilterDialog::on_buttonBox_accepted()
model_->saveList();
if (filter_type_ == CaptureFilter) {
- wsApp->emitAppSignal(WiresharkApplication::CaptureFilterListChanged);
+ mainApp->emitAppSignal(MainApplication::CaptureFilterListChanged);
} else {
- wsApp->emitAppSignal(WiresharkApplication::DisplayFilterListChanged);
+ mainApp->emitAppSignal(MainApplication::DisplayFilterListChanged);
}
}
void FilterDialog::on_buttonBox_helpRequested()
{
if (filter_type_ == CaptureFilter) {
- wsApp->helpTopicAction(HELP_CAPTURE_FILTERS_DIALOG);
+ mainApp->helpTopicAction(HELP_CAPTURE_FILTERS_DIALOG);
} else {
- wsApp->helpTopicAction(HELP_DISPLAY_FILTERS_DIALOG);
+ mainApp->helpTopicAction(HELP_DISPLAY_FILTERS_DIALOG);
}
}
diff --git a/ui/qt/filter_expression_frame.cpp b/ui/qt/filter_expression_frame.cpp
index 2279acabfe..38975977fb 100644
--- a/ui/qt/filter_expression_frame.cpp
+++ b/ui/qt/filter_expression_frame.cpp
@@ -15,7 +15,7 @@
#include <ui/qt/models/uat_model.h>
#include <ui/qt/models/pref_models.h>
-#include <ui/qt/wireshark_application.h>
+#include <ui/qt/main_application.h>
#include <QPushButton>
#include <QKeyEvent>
@@ -170,11 +170,11 @@ void FilterExpressionFrame::keyPressEvent(QKeyEvent *event)
if (ui->buttonBox->button(QDialogButtonBox::Ok)->isEnabled()) {
on_buttonBox_accepted();
} else if (ui->labelLineEdit->text().length() == 0) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, tr("Missing label."));
+ mainApp->pushStatus(MainApplication::FilterSyntax, tr("Missing label."));
} else if (ui->displayFilterLineEdit->syntaxState() == SyntaxLineEdit::Empty) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, tr("Missing filter expression."));
+ mainApp->pushStatus(MainApplication::FilterSyntax, tr("Missing filter expression."));
} else if (ui->displayFilterLineEdit->syntaxState() != SyntaxLineEdit::Valid) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, tr("Invalid filter expression."));
+ mainApp->pushStatus(MainApplication::FilterSyntax, tr("Invalid filter expression."));
}
}
}
diff --git a/ui/qt/firewall_rules_dialog.cpp b/ui/qt/firewall_rules_dialog.cpp
index 615a14a65a..a55efbc173 100644
--- a/ui/qt/firewall_rules_dialog.cpp
+++ b/ui/qt/firewall_rules_dialog.cpp
@@ -22,7 +22,7 @@
#include "wsutil/file_util.h"
#include "wsutil/utf8_entities.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include <QClipboard>
@@ -172,7 +172,7 @@ void FirewallRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
.arg(firewall_product_name(prod_));
QByteArray file_name = WiresharkFileDialog::getSaveFileName(this,
save_title,
- wsApp->lastOpenDir().canonicalPath(),
+ mainApp->lastOpenDir().canonicalPath(),
tr("Text file (*.txt);;All Files (" ALL_FILES_WILDCARD ")")
).toUtf8();
if (file_name.length() > 0) {
@@ -189,18 +189,18 @@ void FirewallRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
}
/* Save the directory name for future file dialogs. */
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
} else if (button == ui->buttonBox->button(QDialogButtonBox::Apply)) {
if (ui->textBrowser->textCursor().hasSelection()) {
ui->textBrowser->copy();
} else {
- wsApp->clipboard()->setText(ui->textBrowser->toPlainText());
+ mainApp->clipboard()->setText(ui->textBrowser->toPlainText());
}
}
}
void FirewallRulesDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_FIREWALL_DIALOG);
+ mainApp->helpTopicAction(HELP_FIREWALL_DIALOG);
}
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index 1f3bcc759f..2159a16b99 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -10,8 +10,8 @@
#include "follow_stream_dialog.h"
#include <ui_follow_stream_dialog.h>
+#include "main_application.h"
#include "main_window.h"
-#include "wireshark_application.h"
#include "frame_tvbuff.h"
#include "epan/follow.h"
@@ -307,7 +307,7 @@ void FollowStreamDialog::findText(bool go_back)
void FollowStreamDialog::saveAs()
{
- QString file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Stream Content As…")));
+ QString file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Stream Content As…")));
if (file_name.isEmpty()) {
return;
}
@@ -332,7 +332,7 @@ void FollowStreamDialog::saveAs()
void FollowStreamDialog::helpButton()
{
- wsApp->helpTopicAction(HELP_FOLLOW_STREAM_DIALOG);
+ mainApp->helpTopicAction(HELP_FOLLOW_STREAM_DIALOG);
}
void FollowStreamDialog::backButton()
@@ -1269,7 +1269,7 @@ FollowStreamDialog::readFollowStream()
return frs_return;
if (elapsed_timer.elapsed() > info_update_freq_) {
fillHintLabel(ui->teStreamContent->textCursor().position());
- wsApp->processEvents();
+ mainApp->processEvents();
elapsed_timer.start();
}
}
diff --git a/ui/qt/font_color_preferences_frame.cpp b/ui/qt/font_color_preferences_frame.cpp
index 4f7df3c5c2..f76f18a0bd 100644
--- a/ui/qt/font_color_preferences_frame.cpp
+++ b/ui/qt/font_color_preferences_frame.cpp
@@ -14,7 +14,7 @@
#include <ui/qt/models/pref_models.h>
#include <ui_font_color_preferences_frame.h>
#include <ui/qt/utils/color_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <functional>
#include <QFontDialog>
@@ -70,7 +70,7 @@ void FontColorPreferencesFrame::showEvent(QShowEvent *)
QString pangram = QString(font_pangrams_[g_rand_int_range(rand_state, 0, num_font_pangrams_)]) + " 0123456789";
ui->fontSampleLineEdit->setText(pangram);
ui->fontSampleLineEdit->setCursorPosition(0);
- ui->fontSampleLineEdit->setMinimumWidth(wsApp->monospaceTextSize(pangram.toUtf8().constData()) + wsApp->monospaceTextSize(" "));
+ ui->fontSampleLineEdit->setMinimumWidth(mainApp->monospaceTextSize(pangram.toUtf8().constData()) + mainApp->monospaceTextSize(" "));
g_rand_free(rand_state);
updateWidgets();
@@ -317,7 +317,7 @@ void FontColorPreferencesFrame::colorChanged(pref_t *pref, const QColor &cc)
void FontColorPreferencesFrame::on_fontPushButton_clicked()
{
bool ok;
- QFont new_font = QFontDialog::getFont(&ok, cur_font_, this, wsApp->windowTitleString(tr("Font")));
+ QFont new_font = QFontDialog::getFont(&ok, cur_font_, this, mainApp->windowTitleString(tr("Font")));
if (ok) {
prefs_set_string_value(pref_qt_gui_font_name_, new_font.toString().toStdString().c_str(), pref_stashed);
cur_font_ = new_font;
diff --git a/ui/qt/funnel_statistics.cpp b/ui/qt/funnel_statistics.cpp
index b113bd002f..752858e862 100644
--- a/ui/qt/funnel_statistics.cpp
+++ b/ui/qt/funnel_statistics.cpp
@@ -32,7 +32,7 @@
#include <QDesktopServices>
#include <QUrl>
-#include "wireshark_application.h"
+#include "main_application.h"
// To do:
// - Handle menu paths. Do we create a new path (GTK+) or use the base element?
@@ -196,12 +196,12 @@ void FunnelStatistics::reloadPackets()
void FunnelStatistics::redissectPackets()
{
// This will trigger a packet redissection.
- wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->emitAppSignal(MainApplication::PacketDissectionChanged);
}
void FunnelStatistics::reloadLuaPlugins()
{
- wsApp->reloadLuaPluginsDelayed();
+ mainApp->reloadLuaPluginsDelayed();
}
void FunnelStatistics::emitApplyDisplayFilter()
@@ -261,7 +261,7 @@ void funnel_statistics_retap_packets(funnel_ops_id_t *ops_id) {
}
void funnel_statistics_copy_to_clipboard(GString *text) {
- wsApp->clipboard()->setText(text->str);
+ mainApp->clipboard()->setText(text->str);
}
const gchar *funnel_statistics_get_filter(funnel_ops_id_t *ops_id) {
@@ -356,11 +356,11 @@ static void register_menu_cb(const char *name,
gpointer callback_data,
gboolean retap)
{
- FunnelAction *funnel_action = new FunnelAction(name, callback, callback_data, retap, wsApp);
+ FunnelAction *funnel_action = new FunnelAction(name, callback, callback_data, retap, mainApp);
if (menus_registered) {
- wsApp->appendDynamicMenuGroupItem(group, funnel_action);
+ mainApp->appendDynamicMenuGroupItem(group, funnel_action);
} else {
- wsApp->addDynamicMenuGroupItem(group, funnel_action);
+ mainApp->addDynamicMenuGroupItem(group, funnel_action);
}
if (!funnel_actions_.contains(group)) {
funnel_actions_[group] = QList<FunnelAction *>();
@@ -377,7 +377,7 @@ static void deregister_menu_cb(funnel_menu_callback callback)
if (funnel_action->callback() == callback) {
// Must set back to title to find the correct sub-menu in Tools
funnel_action->setText(funnel_action->title());
- wsApp->removeDynamicMenuGroupItem(group, funnel_action);
+ mainApp->removeDynamicMenuGroupItem(group, funnel_action);
it = funnel_actions_[group].erase(it);
} else {
++it;
diff --git a/ui/qt/funnel_string_dialog.cpp b/ui/qt/funnel_string_dialog.cpp
index 02defaaae7..de52e73fab 100644
--- a/ui/qt/funnel_string_dialog.cpp
+++ b/ui/qt/funnel_string_dialog.cpp
@@ -14,7 +14,7 @@
#include <QLineEdit>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
// Helper object used for sending close signal to open dialogs from a C function
static FunnelStringDialogHelper dialog_helper_;
@@ -28,7 +28,7 @@ FunnelStringDialog::FunnelStringDialog(QWidget *parent, const QString title, con
dialog_cb_data_free_(dialog_data_free_cb)
{
ui->setupUi(this);
- setWindowTitle(wsApp->windowTitleString(title));
+ setWindowTitle(mainApp->windowTitleString(title));
int one_em = fontMetrics().height();
int row = 0;
diff --git a/ui/qt/funnel_text_dialog.cpp b/ui/qt/funnel_text_dialog.cpp
index 527d5a5513..84bbb941b4 100644
--- a/ui/qt/funnel_text_dialog.cpp
+++ b/ui/qt/funnel_text_dialog.cpp
@@ -16,7 +16,7 @@
#include <QTextCursor>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
// To do:
// - Add "Find next" to highlighting.
@@ -35,11 +35,11 @@ FunnelTextDialog::FunnelTextDialog(QWidget *parent, const QString &title) :
if (!title.isEmpty()) {
loadGeometry(0, 0, QString("Funnel %1").arg(title));
}
- setWindowTitle(wsApp->windowTitleString(title));
+ setWindowTitle(mainApp->windowTitleString(title));
funnel_text_window_.funnel_text_dialog = this;
- ui->textEdit->setFont(wsApp->monospaceFont());
+ ui->textEdit->setFont(mainApp->monospaceFont());
ui->textEdit->setReadOnly(true);
ui->textEdit->setAcceptRichText(false);
}
diff --git a/ui/qt/gsm_map_summary_dialog.cpp b/ui/qt/gsm_map_summary_dialog.cpp
index 8e46d9dfc3..2c220c64d4 100644
--- a/ui/qt/gsm_map_summary_dialog.cpp
+++ b/ui/qt/gsm_map_summary_dialog.cpp
@@ -31,7 +31,7 @@
#include "ui/simple_dialog.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QTextStream>
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp
index 5622a71a26..b7084044e1 100644
--- a/ui/qt/iax2_analysis_dialog.cpp
+++ b/ui/qt/iax2_analysis_dialog.cpp
@@ -36,7 +36,7 @@
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/utils/stock_icon.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
/*
@@ -551,7 +551,7 @@ void Iax2AnalysisDialog::on_actionSaveGraph_triggered()
ui->tabWidget->setCurrentWidget(ui->graphTab);
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString pdf_filter = tr("Portable Document Format (*.pdf)");
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
@@ -567,7 +567,7 @@ void Iax2AnalysisDialog::on_actionSaveGraph_triggered()
if (!file_closed_) {
save_file += QString("/%1").arg(cap_file_.fileBaseName());
}
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Graph As…")),
save_file, filter, &extension);
if (!file_name.isEmpty()) {
@@ -586,14 +586,14 @@ void Iax2AnalysisDialog::on_actionSaveGraph_triggered()
// ui->streamGraph->legend->setVisible(false);
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
}
void Iax2AnalysisDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_IAX2_ANALYSIS_DIALOG);
+ mainApp->helpTopicAction(HELP_IAX2_ANALYSIS_DIALOG);
}
void Iax2AnalysisDialog::tapReset(void *tapinfoptr)
@@ -877,7 +877,7 @@ void Iax2AnalysisDialog::saveAudio(Iax2AnalysisDialog::StreamDirection direction
}
QString sel_filter;
QString file_path = WiresharkFileDialog::getSaveFileName(
- this, caption, wsApp->lastOpenDir().absoluteFilePath("Saved RTP Audio.au"),
+ this, caption, mainApp->lastOpenDir().absoluteFilePath("Saved RTP Audio.au"),
ext_filter, &sel_filter);
if (file_path.isEmpty()) return;
@@ -1147,7 +1147,7 @@ void Iax2AnalysisDialog::saveCsv(Iax2AnalysisDialog::StreamDirection direction)
}
QString file_path = WiresharkFileDialog::getSaveFileName(
- this, caption, wsApp->lastOpenDir().absoluteFilePath("RTP Packet Data.csv"),
+ this, caption, mainApp->lastOpenDir().absoluteFilePath("RTP Packet Data.csv"),
tr("Comma-separated values (*.csv)"));
if (file_path.isEmpty()) return;
diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp
index 359308ba6f..7f84e0d80f 100644
--- a/ui/qt/import_text_dialog.cpp
+++ b/ui/qt/import_text_dialog.cpp
@@ -30,7 +30,7 @@
#include "wsutil/filesystem.h"
#include <ui_import_text_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/qt_ui_utils.h>
#include "ui/qt/widgets/wireshark_file_dialog.h"
@@ -76,7 +76,7 @@ ImportTextDialog::ImportTextDialog(QWidget *parent) :
int file_type_subtype;
ti_ui_->setupUi(this);
- setWindowTitle(wsApp->windowTitleString(tr("Import From Hex Dump")));
+ setWindowTitle(mainApp->windowTitleString(tr("Import From Hex Dump")));
memset(&import_info_, 0, sizeof(import_info_));
import_button_ = ti_ui_->buttonBox->button(QDialogButtonBox::Open);
@@ -627,7 +627,7 @@ void ImportTextDialog::on_textFileBrowseButton_clicked()
}
}
- QString file_name = WiresharkFileDialog::getOpenFileName(this, wsApp->windowTitleString(tr("Import Text File")), open_dir);
+ QString file_name = WiresharkFileDialog::getOpenFileName(this, mainApp->windowTitleString(tr("Import Text File")), open_dir);
ti_ui_->textFileLineEdit->setText(file_name);
}
@@ -1084,5 +1084,5 @@ void ImportTextDialog::on_maxLengthLineEdit_textChanged(const QString &max_frame
void ImportTextDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_IMPORT_DIALOG);
+ mainApp->helpTopicAction(HELP_IMPORT_DIALOG);
}
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index 3c5667f36e..00892d3a5e 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -19,7 +19,7 @@
#include "ui/qt/interface_frame.h"
#include <ui/qt/simple_dialog.h>
-#include <ui/qt/wireshark_application.h>
+#include <ui/qt/main_application.h>
#include <ui/qt/models/interface_tree_model.h>
#include <ui/qt/models/sparkline_delegate.h>
@@ -106,8 +106,8 @@ InterfaceFrame::InterfaceFrame(QWidget * parent)
ui->interfaceTree->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->interfaceTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(interfaceListChanged()));
- connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(interfaceListChanged()));
+ connect(mainApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
connect(ui->interfaceTree->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(interfaceTreeSelectionChanged(const QItemSelection &, const QItemSelection &)));
@@ -305,7 +305,7 @@ void InterfaceFrame::resetInterfaceTreeDisplay()
// used if __APPLE__ is defined, so that it reflects the
// new message text.
//
- QString install_chmodbpf_path = wsApp->applicationDirPath() + "/../Resources/Extras/Install ChmodBPF.pkg";
+ QString install_chmodbpf_path = mainApp->applicationDirPath() + "/../Resources/Extras/Install ChmodBPF.pkg";
ui->warningLabel->setText(tr(
"<p>"
"You don't have permission to capture on local interfaces."
diff --git a/ui/qt/interface_toolbar.cpp b/ui/qt/interface_toolbar.cpp
index 0f5d68e934..911b0bb56d 100644
--- a/ui/qt/interface_toolbar.cpp
+++ b/ui/qt/interface_toolbar.cpp
@@ -14,7 +14,7 @@
#include "interface_toolbar.h"
#include <ui/qt/widgets/interface_toolbar_lineedit.h>
#include "simple_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui_interface_toolbar.h>
#include "capture_opts.h"
@@ -554,7 +554,7 @@ void InterfaceToolbar::controlReceived(QString ifname, int num, int command, QBy
break;
case commandStatusMessage:
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, payload);
+ mainApp->pushStatus(MainApplication::TemporaryStatus, payload);
break;
case commandInformationMessage:
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index 291ac6597a..69efd22d95 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -26,7 +26,7 @@
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/widgets/qcustomplot.h>
#include "progress_frame.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <wsutil/report_message.h>
#include <ui/qt/utils/tango_colors.h> //provides some default colors
@@ -1499,14 +1499,14 @@ void IOGraphDialog::on_actionCrosshairs_triggered()
void IOGraphDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_STATS_IO_GRAPH_DIALOG);
+ mainApp->helpTopicAction(HELP_STATS_IO_GRAPH_DIALOG);
}
// XXX - We have similar code in tcp_stream_dialog and packet_diagram. Should this be a common routine?
void IOGraphDialog::on_buttonBox_accepted()
{
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString pdf_filter = tr("Portable Document Format (*.pdf)");
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
@@ -1524,7 +1524,7 @@ void IOGraphDialog::on_buttonBox_accepted()
if (!file_closed_) {
save_file += QString("/%1").arg(cap_file_.fileBaseName());
}
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Graph As…")),
save_file, filter, &extension);
if (file_name.length() > 0) {
@@ -1542,7 +1542,7 @@ void IOGraphDialog::on_buttonBox_accepted()
}
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
}
@@ -1590,7 +1590,7 @@ void IOGraphDialog::copyAsCsvClicked()
QString csv;
QTextStream stream(&csv, QIODevice::Text);
makeCsv(stream);
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
bool IOGraphDialog::saveCsv(const QString &file_name) const
@@ -2249,7 +2249,7 @@ void IOGraph::tapDraw(void *iog_ptr)
static void
io_graph_init(const char *, void*) {
- wsApp->emitStatCommandSignal("IOGraph", NULL, NULL);
+ mainApp->emitStatCommandSignal("IOGraph", NULL, NULL);
}
static stat_tap_ui io_stat_ui = {
diff --git a/ui/qt/lbm_lbtrm_transport_dialog.cpp b/ui/qt/lbm_lbtrm_transport_dialog.cpp
index 6ccb7e784c..0af05cb9f7 100644
--- a/ui/qt/lbm_lbtrm_transport_dialog.cpp
+++ b/ui/qt/lbm_lbtrm_transport_dialog.cpp
@@ -15,7 +15,7 @@
#include "file.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QClipboard>
#include <QMenu>
diff --git a/ui/qt/lbm_lbtru_transport_dialog.cpp b/ui/qt/lbm_lbtru_transport_dialog.cpp
index 23abb8d9a3..fa5d99e60c 100644
--- a/ui/qt/lbm_lbtru_transport_dialog.cpp
+++ b/ui/qt/lbm_lbtru_transport_dialog.cpp
@@ -15,7 +15,7 @@
#include "file.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QClipboard>
#include <QMessageBox>
diff --git a/ui/qt/lbm_stream_dialog.cpp b/ui/qt/lbm_stream_dialog.cpp
index af9b2ab10f..fd6a4c02eb 100644
--- a/ui/qt/lbm_stream_dialog.cpp
+++ b/ui/qt/lbm_stream_dialog.cpp
@@ -17,7 +17,7 @@
#include "file.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QClipboard>
#include <QMessageBox>
diff --git a/ui/qt/lte_mac_statistics_dialog.cpp b/ui/qt/lte_mac_statistics_dialog.cpp
index 14a2716ccd..0a33b9cc78 100644
--- a/ui/qt/lte_mac_statistics_dialog.cpp
+++ b/ui/qt/lte_mac_statistics_dialog.cpp
@@ -19,7 +19,7 @@
#include <QTreeWidgetItem>
#include <ui/qt/models/percent_bar_delegate.h>
-#include "wireshark_application.h"
+#include "main_application.h"
// TODO: have never tested in a live capture.
@@ -903,7 +903,7 @@ lte_mac_statistics_init(const char *args, void*) {
if (args_l.length() > 2) {
filter = QStringList(args_l.mid(2)).join(",").toUtf8();
}
- wsApp->emitStatCommandSignal("LteMacStatistics", filter.constData(), NULL);
+ mainApp->emitStatCommandSignal("LteMacStatistics", filter.constData(), NULL);
}
static stat_tap_ui lte_mac_statistics_ui = {
diff --git a/ui/qt/lte_rlc_graph_dialog.cpp b/ui/qt/lte_rlc_graph_dialog.cpp
index ee9a388ed0..9d58797285 100644
--- a/ui/qt/lte_rlc_graph_dialog.cpp
+++ b/ui/qt/lte_rlc_graph_dialog.cpp
@@ -26,7 +26,7 @@
#include <wsutil/utf8_entities.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "simple_dialog.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
@@ -850,7 +850,7 @@ void LteRlcGraphDialog::on_otherDirectionButton_clicked()
void LteRlcGraphDialog::on_buttonBox_accepted()
{
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString pdf_filter = tr("Portable Document Format (*.pdf)");
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
@@ -862,7 +862,7 @@ void LteRlcGraphDialog::on_buttonBox_accepted()
.arg(bmp_filter)
.arg(jpeg_filter);
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Graph As…")),
path.canonicalPath(), filter, &extension);
if (file_name.length() > 0) {
@@ -878,7 +878,7 @@ void LteRlcGraphDialog::on_buttonBox_accepted()
}
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
}
diff --git a/ui/qt/lte_rlc_statistics_dialog.cpp b/ui/qt/lte_rlc_statistics_dialog.cpp
index ae36c4e4f4..137767fe13 100644
--- a/ui/qt/lte_rlc_statistics_dialog.cpp
+++ b/ui/qt/lte_rlc_statistics_dialog.cpp
@@ -19,7 +19,7 @@
#include <QTreeWidgetItem>
#include <QPushButton>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/recent.h"
@@ -985,7 +985,7 @@ lte_rlc_statistics_init(const char *args, void*) {
if (args_l.length() > 2) {
filter = QStringList(args_l.mid(2)).join(",").toUtf8();
}
- wsApp->emitStatCommandSignal("LteRlcStatistics", filter.constData(), NULL);
+ mainApp->emitStatCommandSignal("LteRlcStatistics", filter.constData(), NULL);
}
static stat_tap_ui lte_rlc_statistics_ui = {
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index f639db8fc2..912e59762e 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -262,18 +262,18 @@ gather_wireshark_runtime_info(feature_list l)
gather_airpcap_runtime_info(l);
#endif
- if (wsApp) {
+ if (mainApp) {
// Display information
const char *display_mode = ColorUtils::themeIsDark() ? "dark" : "light";
with_feature(l, "%s display mode", display_mode);
int hidpi_count = 0;
- foreach (QScreen *screen, wsApp->screens()) {
+ foreach (QScreen *screen, mainApp->screens()) {
if (screen->devicePixelRatio() > 1.0) {
hidpi_count++;
}
}
- if (hidpi_count == wsApp->screens().count()) {
+ if (hidpi_count == mainApp->screens().count()) {
with_feature(l, "HiDPI");
} else if (hidpi_count) {
with_feature(l, "mixed DPI");
diff --git a/ui/qt/main_application.cpp b/ui/qt/main_application.cpp
new file mode 100644
index 0000000000..1c4b37955c
--- /dev/null
+++ b/ui/qt/main_application.cpp
@@ -0,0 +1,1373 @@
+/* main_application.cpp
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4267)
+#endif
+
+#include "main_application.h"
+
+#include <algorithm>
+#include <errno.h>
+
+#include "wsutil/filesystem.h"
+
+#include "epan/addr_resolv.h"
+#include "epan/column-utils.h"
+#include "epan/disabled_protos.h"
+#include "epan/ftypes/ftypes.h"
+#include "epan/prefs.h"
+#include "epan/proto.h"
+#include "epan/tap.h"
+#include "epan/timestamp.h"
+#include "epan/decode_as.h"
+
+#include "ui/decode_as_utils.h"
+#include "ui/preference_utils.h"
+#include "ui/iface_lists.h"
+#include "ui/language.h"
+#include "ui/recent.h"
+#include "ui/simple_dialog.h"
+#include "ui/util.h"
+
+#include <ui/qt/utils/qt_ui_utils.h>
+#include <ui/qt/utils/color_utils.h>
+#include "coloring_rules_dialog.h"
+
+#include "epan/color_filters.h"
+#include "recent_file_status.h"
+
+#include "extcap.h"
+#ifdef HAVE_LIBPCAP
+#include <capture/iface_monitor.h>
+#endif
+
+#include "ui/filter_files.h"
+#include "ui/capture_globals.h"
+#include "ui/software_update.h"
+#include "ui/last_open_dir.h"
+#include "ui/recent_utils.h"
+
+#ifdef HAVE_LIBPCAP
+#include "ui/capture.h"
+#endif
+
+#include "wsutil/utf8_entities.h"
+
+#ifdef _WIN32
+# include "ui/win32/console_win32.h"
+# include "wsutil/file_util.h"
+# include <QMessageBox>
+# include <QSettings>
+#endif /* _WIN32 */
+
+#include <ui/qt/capture_file.h>
+
+#include <ui/qt/main_window.h>
+#include <ui_main_window.h>
+
+#include <QAction>
+#include <QApplication>
+#include <QColorDialog>
+#include <QDesktopServices>
+#include <QDir>
+#include <QEvent>
+#include <QFileOpenEvent>
+#include <QFontInfo>
+#include <QFontMetrics>
+#include <QLibraryInfo>
+#include <QLocale>
+#include <QMainWindow>
+#include <QMutableListIterator>
+#include <QSocketNotifier>
+#include <QThreadPool>
+#include <QUrl>
+#include <qmath.h>
+
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+#include <QFontDatabase>
+#endif
+#include <QMimeDatabase>
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
+#include <QStyleHints>
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+MainApplication *mainApp = NULL;
+
+// XXX - Copied from ui/gtk/file_dlg.c
+
+// MUST be UTF-8
+static char *last_open_dir = NULL;
+static QList<recent_item_status *> recent_captures_;
+static QHash<int, QList<QAction *> > dynamic_menu_groups_;
+static QHash<int, QList<QAction *> > added_menu_groups_;
+static QHash<int, QList<QAction *> > removed_menu_groups_;
+
+QString MainApplication::window_title_separator_ = QString::fromUtf8(" " UTF8_MIDDLE_DOT " ");
+
+// QMimeDatabase parses a large-ish XML file and can be slow to initialize.
+// Do so in a worker thread as early as possible.
+// https://github.com/lxde/pcmanfm-qt/issues/415
+class MimeDatabaseInitThread : public QRunnable
+{
+private:
+ void run()
+ {
+ QMimeDatabase mime_db;
+ mime_db.mimeTypeForData(QByteArray());
+ }
+};
+
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+// Populating the font database can be slow as well.
+class FontDatabaseInitThread : public QRunnable
+{
+private:
+ void run()
+ {
+ QFontDatabase font_db;
+ }
+};
+#endif
+
+void
+topic_action(topic_action_e action)
+{
+ if (mainApp) mainApp->helpTopicAction(action);
+}
+
+extern "C" char *
+get_last_open_dir(void)
+{
+ return last_open_dir;
+}
+
+void
+set_last_open_dir(const char *dirname)
+{
+ if (mainApp) mainApp->setLastOpenDir(dirname);
+}
+
+/*
+ * Add the capture filename to the application-wide "Recent Files" list.
+ * Contrary to the name this isn't limited to the "recent" menu.
+ */
+/*
+ * XXX - We might want to call SHAddToRecentDocs under Windows 7:
+ * https://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
+ */
+extern "C" void
+add_menu_recent_capture_file(const gchar *cf_name) {
+ QString normalized_cf_name = QString::fromUtf8(cf_name);
+ QDir cf_path;
+
+ cf_path.setPath(normalized_cf_name);
+ normalized_cf_name = cf_path.absolutePath();
+ normalized_cf_name = QDir::cleanPath(normalized_cf_name);
+ normalized_cf_name = QDir::toNativeSeparators(normalized_cf_name);
+
+ /* Iterate through the recent items list, removing duplicate entries and every
+ * item above count_max
+ */
+ unsigned int cnt = 1;
+ QMutableListIterator<recent_item_status *> rii(recent_captures_);
+ while (rii.hasNext()) {
+ recent_item_status *ri = rii.next();
+ /* if this element string is one of our special items (separator, ...) or
+ * already in the list or
+ * this element is above maximum count (too old), remove it
+ */
+ if (ri->filename.length() < 1 ||
+#ifdef _WIN32
+ /* do a case insensitive compare on win32 */
+ ri->filename.compare(normalized_cf_name, Qt::CaseInsensitive) == 0 ||
+#else /* _WIN32 */
+ /*
+ * Do a case sensitive compare on UN*Xes.
+ *
+ * XXX - on UN*Xes such as macOS, where you can use pathconf()
+ * to check whether a given file system is case-sensitive or
+ * not, we should check whether this particular file system
+ * is case-sensitive and do the appropriate comparison.
+ */
+ ri->filename.compare(normalized_cf_name) == 0 ||
+#endif
+ cnt >= prefs.gui_recent_files_count_max) {
+ rii.remove();
+ delete(ri);
+ cnt--;
+ }
+ cnt++;
+ }
+ mainApp->addRecentItem(normalized_cf_name, 0, false);
+}
+
+/* write all capture filenames of the menu to the user's recent file */
+extern "C" void menu_recent_file_write_all(FILE *rf) {
+
+ /* we have to iterate backwards through the children's list,
+ * so we get the latest item last in the file.
+ */
+ QListIterator<recent_item_status *> rii(recent_captures_);
+ rii.toBack();
+ while (rii.hasPrevious()) {
+ QString cf_name;
+ /* get capture filename from the menu item label */
+ cf_name = rii.previous()->filename;
+ if (!cf_name.isNull()) {
+ fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", qUtf8Printable(cf_name));
+ }
+ }
+}
+
+#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
+/** Check to see if Wireshark can shut down safely (e.g. offer to save the
+ * current capture).
+ */
+extern "C" int software_update_can_shutdown_callback(void) {
+ return mainApp->softwareUpdateCanShutdown();
+}
+
+/** Shut down Wireshark in preparation for an upgrade.
+ */
+extern "C" void software_update_shutdown_request_callback(void) {
+ mainApp->softwareUpdateShutdownRequest();
+}
+#endif // HAVE_SOFTWARE_UPDATE && Q_OS_WIN
+
+// Check each recent item in a separate thread so that we don't hang while
+// calling stat(). This is called periodically because files and entire
+// volumes can disappear and reappear at any time.
+void MainApplication::refreshRecentCaptures() {
+ recent_item_status *ri;
+ RecentFileStatus *rf_status;
+
+ // We're in the middle of a capture. Don't create traffic.
+ if (active_captures_ > 0) return;
+
+ foreach (ri, recent_captures_) {
+ if (ri->in_thread) {
+ continue;
+ }
+ rf_status = new RecentFileStatus(ri->filename, this);
+ QThreadPool::globalInstance()->start(rf_status);
+ }
+}
+
+void MainApplication::refreshPacketData()
+{
+ if (host_name_lookup_process()) {
+ emit addressResolutionChanged();
+ } else if (col_data_changed()) {
+ emit columnDataChanged();
+ }
+}
+
+void MainApplication::updateTaps()
+{
+ draw_tap_listeners(FALSE);
+}
+
+QDir MainApplication::lastOpenDir() {
+ return QDir(last_open_dir);
+}
+
+void MainApplication::setLastOpenDirFromFilename(const QString file_name)
+{
+ QString directory = QFileInfo(file_name).absolutePath();
+ setLastOpenDir(qUtf8Printable(directory));
+}
+
+void MainApplication::helpTopicAction(topic_action_e action)
+{
+ QString url = gchar_free_to_qstring(topic_action_url(action));
+
+ if (!url.isEmpty()) {
+ QDesktopServices::openUrl(QUrl(url));
+ }
+}
+
+const QFont MainApplication::monospaceFont(bool zoomed) const
+{
+ if (zoomed) {
+ return zoomed_font_;
+ }
+ return mono_font_;
+}
+
+void MainApplication::setMonospaceFont(const char *font_string) {
+
+ if (font_string && strlen(font_string) > 0) {
+ mono_font_.fromString(font_string);
+
+ // Only accept the font name if it actually exists.
+ if (mono_font_.family() == QFontInfo(mono_font_).family()) {
+ return;
+ }
+ }
+
+ // https://en.wikipedia.org/wiki/Category:Monospaced_typefaces
+ const char *win_default_font = "Consolas";
+ const char *win_alt_font = "Lucida Console";
+ // SF Mono might be a system font someday. Right now (Oct 2016) it appears
+ // to be limited to Xcode and Terminal.
+ // http://www.openradar.me/26790072
+ // http://www.openradar.me/26862220
+ const char *osx_default_font = "SF Mono";
+ const QStringList osx_alt_fonts = QStringList() << "Menlo" << "Monaco";
+ // XXX Detect Ubuntu systems (e.g. via /etc/os-release and/or
+ // /etc/lsb_release) and add "Ubuntu Mono Regular" there.
+ // https://design.ubuntu.com/font/
+ const char *x11_default_font = "Liberation Mono";
+ const QStringList x11_alt_fonts = QStringList() << "DejaVu Sans Mono" << "Bitstream Vera Sans Mono";
+ const QStringList fallback_fonts = QStringList() << "Lucida Sans Typewriter" << "Inconsolata" << "Droid Sans Mono" << "Andale Mono" << "Courier New" << "monospace";
+ QStringList substitutes;
+ int font_size_adjust = 0;
+
+ // Try to pick the latest, shiniest fixed-width font for our OS.
+#if defined(Q_OS_WIN)
+ const char *default_font = win_default_font;
+ substitutes << win_alt_font << osx_default_font << osx_alt_fonts << x11_default_font << x11_alt_fonts << fallback_fonts;
+ font_size_adjust = 2;
+#elif defined(Q_OS_MAC)
+ const char *default_font = osx_default_font;
+ substitutes << osx_alt_fonts << win_default_font << win_alt_font << x11_default_font << x11_alt_fonts << fallback_fonts;
+#else
+ const char *default_font = x11_default_font;
+ substitutes << x11_alt_fonts << win_default_font << win_alt_font << osx_default_font << osx_alt_fonts << fallback_fonts;
+#endif
+
+ mono_font_.setFamily(default_font);
+ mono_font_.insertSubstitutions(default_font, substitutes);
+ mono_font_.setPointSize(mainApp->font().pointSize() + font_size_adjust);
+ mono_font_.setBold(false);
+
+ // Retrieve the effective font and apply it.
+ mono_font_.setFamily(QFontInfo(mono_font_).family());
+
+ g_free(prefs.gui_qt_font_name);
+ prefs.gui_qt_font_name = qstring_strdup(mono_font_.toString());
+}
+
+int MainApplication::monospaceTextSize(const char *str)
+{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
+ return QFontMetrics(mono_font_).horizontalAdvance(str);
+#else
+ return QFontMetrics(mono_font_).width(str);
+#endif
+}
+
+void MainApplication::setConfigurationProfile(const gchar *profile_name, bool write_recent_file)
+{
+ char *rf_path;
+ int rf_open_errno;
+ gchar *err_msg = NULL;
+
+ gboolean prev_capture_no_interface_load;
+ gboolean prev_capture_no_extcap;
+
+ /* First check if profile exists */
+ if (!profile_exists(profile_name, FALSE)) {
+ if (profile_exists(profile_name, TRUE)) {
+ char *pf_dir_path, *pf_dir_path2, *pf_filename;
+ /* Copy from global profile */
+ if (create_persconffile_profile(profile_name, &pf_dir_path) == -1) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "Can't create directory\n\"%s\":\n%s.",
+ pf_dir_path, g_strerror(errno));
+
+ g_free(pf_dir_path);
+ }
+
+ if (copy_persconffile_profile(profile_name, profile_name, TRUE, &pf_filename,
+ &pf_dir_path, &pf_dir_path2) == -1) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
+ pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
+
+ g_free(pf_filename);
+ g_free(pf_dir_path);
+ g_free(pf_dir_path2);
+ }
+ } else {
+ /* No personal and no global profile exists */
+ return;
+ }
+ }
+
+ /* Then check if changing to another profile */
+ if (profile_name && strcmp (profile_name, get_profile_name()) == 0) {
+ return;
+ }
+
+ prev_capture_no_interface_load = prefs.capture_no_interface_load;
+ prev_capture_no_extcap = prefs.capture_no_extcap;
+
+ /* Get the current geometry, before writing it to disk */
+ emit profileChanging();
+
+ if (write_recent_file && profile_exists(get_profile_name(), FALSE))
+ {
+ /* Write recent file for profile we are leaving, if it still exists */
+ write_profile_recent();
+ }
+
+ /* Set profile name and update the status bar */
+ set_profile_name (profile_name);
+ emit profileNameChanged(profile_name);
+
+ /* Apply new preferences */
+ readConfigurationFiles(true);
+
+ if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
+ simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "Could not open common recent file\n\"%s\": %s.",
+ rf_path, g_strerror(rf_open_errno));
+ g_free(rf_path);
+ }
+ if (recent.gui_fileopen_remembered_dir &&
+ test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
+ set_last_open_dir(recent.gui_fileopen_remembered_dir);
+ }
+ timestamp_set_type(recent.gui_time_format);
+ timestamp_set_precision(recent.gui_time_precision);
+ timestamp_set_seconds_type (recent.gui_seconds_format);
+ tap_update_timer_.setInterval(prefs.tap_update_interval);
+
+ prefs_to_capture_opts();
+ prefs_apply_all();
+#ifdef HAVE_LIBPCAP
+ update_local_interfaces();
+#endif
+
+ setMonospaceFont(prefs.gui_qt_font_name);
+
+ emit columnsChanged();
+ emit preferencesChanged();
+ emit recentPreferencesRead();
+ emit filterExpressionsChanged();
+ emit checkDisplayFilter();
+ emit captureFilterListChanged();
+ emit displayFilterListChanged();
+
+ /* Reload color filters */
+ if (!color_filters_reload(&err_msg, color_filter_add_cb)) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg);
+ g_free(err_msg);
+ }
+
+ /* Load interfaces if settings have changed */
+ if (!prefs.capture_no_interface_load &&
+ ((prefs.capture_no_interface_load != prev_capture_no_interface_load) ||
+ (prefs.capture_no_extcap != prev_capture_no_extcap))) {
+ refreshLocalInterfaces();
+ }
+
+ emit localInterfaceListChanged();
+ emit packetDissectionChanged();
+
+ /* Write recent_common file to ensure last used profile setting is stored. */
+ write_recent();
+}
+
+void MainApplication::reloadLuaPluginsDelayed()
+{
+ QTimer::singleShot(0, this, SIGNAL(reloadLuaPlugins()));
+}
+
+const QIcon &MainApplication::normalIcon()
+{
+ if (normal_icon_.isNull()) {
+ initializeIcons();
+ }
+ return normal_icon_;
+}
+
+const QIcon &MainApplication::captureIcon()
+{
+ if (capture_icon_.isNull()) {
+ initializeIcons();
+ }
+ return capture_icon_;
+}
+
+const QString MainApplication::windowTitleString(QStringList title_parts)
+{
+ QMutableStringListIterator tii(title_parts);
+ while (tii.hasNext()) {
+ QString ti = tii.next();
+ if (ti.isEmpty()) tii.remove();
+ }
+ title_parts.prepend(applicationName());
+ return title_parts.join(window_title_separator_);
+}
+
+void MainApplication::applyCustomColorsFromRecent()
+{
+ int i = 0;
+ bool ok;
+ for (GList *custom_color = recent.custom_colors; custom_color; custom_color = custom_color->next) {
+ QRgb rgb = QString((const char *)custom_color->data).toUInt(&ok, 16);
+ if (ok) {
+ QColorDialog::setCustomColor(i++, QColor(rgb));
+ }
+ }
+}
+
+// Return the first top-level QMainWindow.
+QWidget *MainApplication::mainWindow()
+{
+ foreach (QWidget *tlw, topLevelWidgets()) {
+ QMainWindow *tlmw = qobject_cast<QMainWindow *>(tlw);
+ if (tlmw && tlmw->isVisible()) {
+ return tlmw;
+ }
+ }
+ return 0;
+}
+
+void MainApplication::storeCustomColorsInRecent()
+{
+ if (QColorDialog::customCount()) {
+ prefs_clear_string_list(recent.custom_colors);
+ recent.custom_colors = NULL;
+ for (int i = 0; i < QColorDialog::customCount(); i++) {
+ QRgb rgb = QColorDialog::customColor(i).rgb();
+ recent.custom_colors = g_list_append(recent.custom_colors, ws_strdup_printf("%08x", rgb));
+ }
+ }
+}
+
+void MainApplication::setLastOpenDir(const char *dir_name)
+{
+ qint64 len;
+ gchar *new_last_open_dir;
+
+ if (dir_name && dir_name[0]) {
+ len = strlen(dir_name);
+ if (dir_name[len-1] == G_DIR_SEPARATOR) {
+ new_last_open_dir = g_strconcat(dir_name, (char *)NULL);
+ }
+ else {
+ new_last_open_dir = g_strconcat(dir_name,
+ G_DIR_SEPARATOR_S, (char *)NULL);
+ }
+ } else {
+ new_last_open_dir = NULL;
+ }
+
+ g_free(last_open_dir);
+ last_open_dir = new_last_open_dir;
+}
+
+bool MainApplication::event(QEvent *event)
+{
+ QString display_filter = NULL;
+ if (event->type() == QEvent::FileOpen) {
+ QFileOpenEvent *foe = static_cast<QFileOpenEvent *>(event);
+ if (foe && foe->file().length() > 0) {
+ QString cf_path(foe->file());
+ if (initialized_) {
+ emit openCaptureFile(cf_path, display_filter, WTAP_TYPE_AUTO);
+ } else {
+ pending_open_files_.append(cf_path);
+ }
+ }
+ return true;
+ }
+ return QApplication::event(event);
+}
+
+void MainApplication::clearRecentCaptures() {
+ qDeleteAll(recent_captures_);
+ recent_captures_.clear();
+ emit updateRecentCaptureStatus(NULL, 0, false);
+}
+
+void MainApplication::cleanup()
+{
+ software_update_cleanup();
+ storeCustomColorsInRecent();
+ // Write the user's recent file(s) to disk.
+ write_profile_recent();
+ write_recent();
+
+ qDeleteAll(recent_captures_);
+ recent_captures_.clear();
+ // We might end up here via exit_application.
+ QThreadPool::globalInstance()->waitForDone();
+}
+
+void MainApplication::itemStatusFinished(const QString filename, qint64 size, bool accessible) {
+ recent_item_status *ri;
+
+ foreach (ri, recent_captures_) {
+ if (filename == ri->filename && (size != ri->size || accessible != ri->accessible)) {
+ ri->size = size;
+ ri->accessible = accessible;
+ ri->in_thread = false;
+
+ emit updateRecentCaptureStatus(filename, size, accessible);
+ }
+ }
+}
+
+MainApplication::MainApplication(int &argc, char **argv) :
+ QApplication(argc, argv),
+ initialized_(false),
+ is_reloading_lua_(false),
+ if_notifier_(NULL),
+ active_captures_(0)
+{
+ mainApp = this;
+
+ MimeDatabaseInitThread *mime_db_init_thread = new(MimeDatabaseInitThread);
+ QThreadPool::globalInstance()->start(mime_db_init_thread);
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+ FontDatabaseInitThread *font_db_init_thread = new (FontDatabaseInitThread);
+ QThreadPool::globalInstance()->start(font_db_init_thread);
+#endif
+
+ Q_INIT_RESOURCE(about);
+ Q_INIT_RESOURCE(i18n);
+ Q_INIT_RESOURCE(layout);
+ Q_INIT_RESOURCE(stock_icons);
+ Q_INIT_RESOURCE(wsicon);
+ Q_INIT_RESOURCE(languages);
+
+#ifdef Q_OS_WIN
+ /* RichEd20.DLL is needed for native file dialog filter entries. */
+ ws_load_library("riched20.dll");
+#endif // Q_OS_WIN
+
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+ setAttribute(Qt::AA_UseHighDpiPixmaps);
+#endif
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && defined(Q_OS_WIN)
+ setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
+#endif
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ setAttribute(Qt::AA_DisableWindowContextHelpButton);
+#endif
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
+ styleHints()->setShowShortcutsInContextMenus(true);
+#endif
+
+ //
+ // XXX - this means we try to check for the existence of all files
+ // in the recent list every 2 seconds; that causes noticeable network
+ // traffic if any of them are stored on file servers.
+ //
+ // QFileSystemWatcher should allow us to watch for files being
+ // removed or renamed. It uses kqueues and EVFILT_VNODE on FreeBSD,
+ // NetBSD, FSEvents on macOS, inotify on Linux if available, and
+ // FindFirstChagneNotification() on Windows. On all other platforms,
+ // it just periodically polls, as we're doing now.
+ //
+ // For unmounts:
+ //
+ // macOS and FreeBSD deliver NOTE_REVOKE notes for EVFILT_VNODE, and
+ // QFileSystemWatcher delivers signals for them, just as it does for
+ // NOTE_DELETE and NOTE_RENAME.
+ //
+ // On Linux, inotify:
+ //
+ // http://man7.org/linux/man-pages/man7/inotify.7.html
+ //
+ // appears to deliver "filesystem containing watched object was
+ // unmounted" events. It looks as if Qt turns them into "changed"
+ // events.
+ //
+ // On Windows, it's not clearly documented what happens on a handle
+ // opened with FindFirstChangeNotification() if the volume on which
+ // the path handed to FindFirstChangeNotification() is removed, or
+ // ejected, or whatever the Windowsese is for "unmounted". The
+ // handle obviously isn't valid any more, but whether it just hangs
+ // around and never delivers any notifications or delivers an
+ // event that turns into an error indication doesn't seem to be
+ // documented. If it just hangs around, I think our main loop will
+ // receive a WM_DEVICECHANGE Windows message with DBT_DEVICEREMOVECOMPLETE
+ // if an unmount occurs - even for network devices. If we need to watch
+ // for those, we can use the winEvent method of the QWidget for the
+ // top-level window to get Windows messages.
+ //
+ // Note also that remote file systems might not report file
+ // removal or renames if they're done on the server or done by
+ // another client. At least on macOS, they *will* get reported
+ // if they're done on the machine running the program doing the
+ // kqueue stuff, and, at least in newer versions, should get
+ // reported on SMB-mounted (and AFP-mounted?) file systems
+ // even if done on the server or another client.
+ //
+ // But, when push comes to shove, the file manager(s) on the
+ // OSes in question probably use the same mechanisms to
+ // monitor folders in folder windows or open/save dialogs or...,
+ // so my inclination is just to use QFileSystemWatcher.
+ //
+ // However, that wouldn't catch files that become *re*-accessible
+ // by virtue of a file system being re-mounted. The only way to
+ // catch *that* would be to watch for mounts and re-check all
+ // marked-as-inaccessible files.
+ //
+ // macOS and FreeBSD also support EVFILT_FS events, which notify you
+ // of file system mounts and unmounts. We'd need to add our own
+ // kqueue for that, if we can check those with QSocketNotifier.
+ //
+ // On Linux, at least as of 2006, you're supposed to poll /proc/mounts:
+ //
+ // https://lkml.org/lkml/2006/2/22/169
+ //
+ // to discover mounts.
+ //
+ // On Windows, you'd probably have to watch for WM_DEVICECHANGE events.
+ //
+ // Then again, with an automounter, a file system containing a
+ // recent capture might get unmounted automatically if you haven't
+ // referred to anything on that file system for a while, and get
+ // treated as inaccessible. However, if you try to access it,
+ // the automounter will attempt to re-mount it, so the access *will*
+ // succeed if the automounter can remount the file.
+ //
+ // (Speaking of automounters, repeatedly polling recent files will
+ // keep the file system from being unmounted, for what that's worth.)
+ //
+ // At least on macOS, you can determine whether a file is on an
+ // automounted file system by calling statfs() on its path and
+ // checking whether MNT_AUTOMOUNTED is set in f_flags. FreeBSD
+ // appears to support that flag as well, but no other *BSD appears
+ // to.
+ //
+ // I'm not sure what can be done on Linux.
+ //
+ recent_timer_.setParent(this);
+ connect(&recent_timer_, SIGNAL(timeout()), this, SLOT(refreshRecentCaptures()));
+ recent_timer_.start(2000);
+
+ packet_data_timer_.setParent(this);
+ connect(&packet_data_timer_, SIGNAL(timeout()), this, SLOT(refreshPacketData()));
+ packet_data_timer_.start(1000);
+
+ tap_update_timer_.setParent(this);
+ tap_update_timer_.setInterval(TAP_UPDATE_DEFAULT_INTERVAL);
+ connect(this, SIGNAL(appInitialized()), &tap_update_timer_, SLOT(start()));
+ connect(&tap_update_timer_, SIGNAL(timeout()), this, SLOT(updateTaps()));
+
+ // Application-wide style sheet
+ QString app_style_sheet = qApp->styleSheet();
+ qApp->setStyleSheet(app_style_sheet);
+
+ // If our window text is lighter than the window background, assume the theme is dark.
+ QPalette gui_pal = qApp->palette();
+ prefs_set_gui_theme_is_dark(gui_pal.windowText().color().value() > gui_pal.window().color().value());
+
+#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
+ connect(this, SIGNAL(softwareUpdateQuit()), this, SLOT(quit()), Qt::QueuedConnection);
+#endif
+
+ connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup()));
+}
+
+MainApplication::~MainApplication()
+{
+ mainApp = NULL;
+ clearDynamicMenuGroupItems();
+ free_filter_lists();
+}
+
+void MainApplication::registerUpdate(register_action_e action, const char *message)
+{
+ emit splashUpdate(action, message);
+}
+
+void MainApplication::emitAppSignal(AppSignal signal)
+{
+ switch (signal) {
+ case ColumnsChanged:
+ emit columnsChanged();
+ break;
+ case CaptureFilterListChanged:
+ emit captureFilterListChanged();
+ break;
+ case DisplayFilterListChanged:
+ emit displayFilterListChanged();
+ break;
+ case FilterExpressionsChanged:
+ emit filterExpressionsChanged();
+ break;
+ case LocalInterfacesChanged:
+ emit localInterfaceListChanged();
+ break;
+ case NameResolutionChanged:
+ emit addressResolutionChanged();
+ break;
+ case PreferencesChanged:
+ emit preferencesChanged();
+ break;
+ case PacketDissectionChanged:
+ emit packetDissectionChanged();
+ break;
+ case ProfileChanging:
+ emit profileChanging();
+ break;
+ case RecentCapturesChanged:
+ emit updateRecentCaptureStatus(NULL, 0, false);
+ break;
+ case RecentPreferencesRead:
+ emit recentPreferencesRead();
+ break;
+ case FieldsChanged:
+ emit fieldsChanged();
+ break;
+ default:
+ break;
+ }
+}
+
+// Flush any collected app signals.
+//
+// On macOS emitting PacketDissectionChanged from a dialog can
+// render the application unusable:
+// https://gitlab.com/wireshark/wireshark/-/issues/11361
+// https://gitlab.com/wireshark/wireshark/-/issues/11448
+// Work around the problem by queueing up app signals and emitting them
+// after the dialog is closed.
+//
+// The following bugs might be related although they don't describe the
+// exact behavior we're working around here:
+// https://bugreports.qt.io/browse/QTBUG-38512
+// https://bugreports.qt.io/browse/QTBUG-38600
+void MainApplication::flushAppSignals()
+{
+ while (!app_signals_.isEmpty()) {
+ mainApp->emitAppSignal(app_signals_.takeFirst());
+ }
+}
+
+void MainApplication::emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata)
+{
+ emit openStatCommandDialog(menu_path, arg, userdata);
+}
+
+void MainApplication::emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata)
+{
+ emit openTapParameterDialog(cfg_abbr, arg, userdata);
+}
+
+// XXX Combine statistics and funnel routines into addGroupItem + groupItems?
+void MainApplication::addDynamicMenuGroupItem(int group, QAction *sg_action)
+{
+ if (!dynamic_menu_groups_.contains(group)) {
+ dynamic_menu_groups_[group] = QList<QAction *>();
+ }
+ dynamic_menu_groups_[group] << sg_action;
+}
+
+void MainApplication::appendDynamicMenuGroupItem(int group, QAction *sg_action)
+{
+ if (!added_menu_groups_.contains(group)) {
+ added_menu_groups_[group] = QList<QAction *>();
+ }
+ added_menu_groups_[group] << sg_action;
+ addDynamicMenuGroupItem(group, sg_action);
+}
+
+void MainApplication::removeDynamicMenuGroupItem(int group, QAction *sg_action)
+{
+ if (!removed_menu_groups_.contains(group)) {
+ removed_menu_groups_[group] = QList<QAction *>();
+ }
+ removed_menu_groups_[group] << sg_action;
+ dynamic_menu_groups_[group].removeAll(sg_action);
+}
+
+void MainApplication::clearDynamicMenuGroupItems()
+{
+ foreach (int group, dynamic_menu_groups_.keys()) {
+ dynamic_menu_groups_[group].clear();
+ }
+}
+
+void MainApplication::initializeIcons()
+{
+ // Do this as late as possible in order to allow time for
+ // MimeDatabaseInitThread to do its work.
+ QList<int> icon_sizes = QList<int>() << 16 << 24 << 32 << 48 << 64 << 128 << 256 << 512 << 1024;
+ foreach (int icon_size, icon_sizes) {
+ QString icon_path = QString(":/wsicon/wsicon%1.png").arg(icon_size);
+ normal_icon_.addFile(icon_path);
+ icon_path = QString(":/wsicon/wsiconcap%1.png").arg(icon_size);
+ capture_icon_.addFile(icon_path);
+ }
+}
+
+QList<QAction *> MainApplication::dynamicMenuGroupItems(int group)
+{
+ if (!dynamic_menu_groups_.contains(group)) {
+ return QList<QAction *>();
+ }
+
+ QList<QAction *> sgi_list = dynamic_menu_groups_[group];
+ std::sort(sgi_list.begin(), sgi_list.end(), qActionLessThan);
+ return sgi_list;
+}
+
+QList<QAction *> MainApplication::addedMenuGroupItems(int group)
+{
+ if (!added_menu_groups_.contains(group)) {
+ return QList<QAction *>();
+ }
+
+ QList<QAction *> sgi_list = added_menu_groups_[group];
+ std::sort(sgi_list.begin(), sgi_list.end(), qActionLessThan);
+ return sgi_list;
+}
+
+QList<QAction *> MainApplication::removedMenuGroupItems(int group)
+{
+ if (!removed_menu_groups_.contains(group)) {
+ return QList<QAction *>();
+ }
+
+ QList<QAction *> sgi_list = removed_menu_groups_[group];
+ std::sort(sgi_list.begin(), sgi_list.end(), qActionLessThan);
+ return sgi_list;
+}
+
+void MainApplication::clearAddedMenuGroupItems()
+{
+ foreach (int group, added_menu_groups_.keys()) {
+ added_menu_groups_[group].clear();
+ }
+}
+
+void MainApplication::clearRemovedMenuGroupItems()
+{
+ foreach (int group, removed_menu_groups_.keys()) {
+ foreach (QAction *action, removed_menu_groups_[group]) {
+ delete action;
+ }
+ removed_menu_groups_[group].clear();
+ }
+}
+
+#ifdef HAVE_LIBPCAP
+
+static void
+iface_mon_event_cb(const char *iface, int added, int up)
+{
+ int present = 0;
+ guint ifs, j;
+ interface_t *device;
+ interface_options *interface_opts;
+
+ for (ifs = 0; ifs < global_capture_opts.all_ifaces->len; ifs++) {
+ device = &g_array_index(global_capture_opts.all_ifaces, interface_t, ifs);
+ if (strcmp(device->name, iface) == 0) {
+ present = 1;
+ if (!up) {
+ /*
+ * Interface went down or disappeared; remove all instances
+ * of it from the current list of interfaces selected
+ * for capturing.
+ */
+ for (j = 0; j < global_capture_opts.ifaces->len; j++) {
+ interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, j);
+ if (strcmp(interface_opts->name, device->name) == 0) {
+ capture_opts_del_iface(&global_capture_opts, j);
+ }
+ }
+ }
+ }
+ }
+
+ mainApp->emitLocalInterfaceEvent(iface, added, up);
+ if (present != up) {
+ /*
+ * We've been told that there's a new interface or that an old
+ * interface is gone; reload the local interface list.
+ */
+ mainApp->refreshLocalInterfaces();
+ }
+}
+
+#endif
+
+void MainApplication::ifChangeEventsAvailable()
+{
+#ifdef HAVE_LIBPCAP
+ /*
+ * Something's readable from the descriptor for interface
+ * monitoring.
+ *
+ * Have the interface-monitoring code Read whatever interface-change
+ * events are available, and call the callback for them.
+ */
+ iface_mon_event();
+#endif
+}
+
+void MainApplication::emitLocalInterfaceEvent(const char *ifname, int added, int up)
+{
+ emit localInterfaceEvent(ifname, added, up);
+}
+
+void MainApplication::refreshLocalInterfaces()
+{
+ extcap_clear_interfaces();
+
+#ifdef HAVE_LIBPCAP
+ /*
+ * Reload the local interface list.
+ */
+ scan_local_interfaces(main_window_update);
+
+ /*
+ * Now emit a signal to indicate that the list changed, so that all
+ * places displaying the list will get updated.
+ *
+ * XXX - only if it *did* change.
+ */
+ emit localInterfaceListChanged();
+#endif
+}
+
+void MainApplication::allSystemsGo()
+{
+ QString display_filter = NULL;
+ initialized_ = true;
+ emit appInitialized();
+ while (pending_open_files_.length() > 0) {
+ emit openCaptureFile(pending_open_files_.front(), display_filter, WTAP_TYPE_AUTO);
+ pending_open_files_.pop_front();
+ }
+ software_update_init();
+
+#ifdef HAVE_LIBPCAP
+ int err;
+ err = iface_mon_start(&iface_mon_event_cb);
+ if (err == 0) {
+ if_notifier_ = new QSocketNotifier(iface_mon_get_sock(),
+ QSocketNotifier::Read, this);
+ connect(if_notifier_, SIGNAL(activated(int)), SLOT(ifChangeEventsAvailable()));
+ }
+#endif
+}
+
+_e_prefs *MainApplication::readConfigurationFiles(bool reset)
+{
+ e_prefs *prefs_p;
+
+ if (reset) {
+ //
+ // Reset current preferences and enabled/disabled protocols and
+ // heuristic dissectors before reading.
+ // (Needed except when this is called at startup.)
+ //
+ prefs_reset();
+ proto_reenable_all();
+ }
+
+ /* Load libwireshark settings from the current profile. */
+ prefs_p = epan_load_settings();
+
+#ifdef _WIN32
+ /* if the user wants a console to be always there, well, we should open one for him */
+ if (prefs_p->gui_console_open == console_open_always) {
+ create_console();
+ }
+#endif
+
+ /* Read the capture filter file. */
+ read_filter_list(CFILTER_LIST);
+
+ return prefs_p;
+}
+
+QList<recent_item_status *> MainApplication::recentItems() const {
+ return recent_captures_;
+}
+
+void MainApplication::addRecentItem(const QString filename, qint64 size, bool accessible) {
+ recent_item_status *ri = new(recent_item_status);
+
+ ri->filename = filename;
+ ri->size = size;
+ ri->accessible = accessible;
+ ri->in_thread = false;
+ recent_captures_.prepend(ri);
+
+ itemStatusFinished(filename, size, accessible);
+}
+
+void MainApplication::removeRecentItem(const QString &filename)
+{
+ QMutableListIterator<recent_item_status *> rii(recent_captures_);
+
+ while (rii.hasNext()) {
+ recent_item_status *ri = rii.next();
+#ifdef _WIN32
+ /* Do a case insensitive compare on win32 */
+ if (ri->filename.compare(filename, Qt::CaseInsensitive) == 0) {
+#else
+ /* Do a case sensitive compare on UN*Xes.
+ *
+ * XXX - on UN*Xes such as macOS, where you can use pathconf()
+ * to check whether a given file system is case-sensitive or
+ * not, we should check whether this particular file system
+ * is case-sensitive and do the appropriate comparison.
+ */
+ if (ri->filename.compare(filename) == 0) {
+#endif
+ rii.remove();
+ delete(ri);
+ }
+ }
+
+ emit updateRecentCaptureStatus(NULL, 0, false);
+}
+
+static void switchTranslator(QTranslator& myTranslator, const QString& filename,
+ const QString& searchPath)
+{
+ mainApp->removeTranslator(&myTranslator);
+
+ if (myTranslator.load(filename, searchPath))
+ mainApp->installTranslator(&myTranslator);
+}
+
+void MainApplication::loadLanguage(const QString newLanguage)
+{
+ QLocale locale;
+ QString localeLanguage;
+
+ if (newLanguage.isEmpty() || newLanguage == USE_SYSTEM_LANGUAGE) {
+ localeLanguage = QLocale::system().name();
+ } else {
+ localeLanguage = newLanguage;
+ }
+
+ locale = QLocale(localeLanguage);
+ QLocale::setDefault(locale);
+ switchTranslator(mainApp->translator,
+ QString("wireshark_%1.qm").arg(localeLanguage), QString(":/i18n/"));
+ if (QFile::exists(QString("%1/%2/wireshark_%3.qm")
+ .arg(get_datafile_dir()).arg("languages").arg(localeLanguage)))
+ switchTranslator(mainApp->translator,
+ QString("wireshark_%1.qm").arg(localeLanguage), QString(get_datafile_dir()) + QString("/languages"));
+ if (QFile::exists(QString("%1/wireshark_%3.qm")
+ .arg(gchar_free_to_qstring(get_persconffile_path("languages", FALSE))).arg(localeLanguage)))
+ switchTranslator(mainApp->translator,
+ QString("wireshark_%1.qm").arg(localeLanguage), gchar_free_to_qstring(get_persconffile_path("languages", FALSE)));
+ if (QFile::exists(QString("%1/qt_%2.qm")
+ .arg(get_datafile_dir()).arg(localeLanguage))) {
+ switchTranslator(mainApp->translatorQt,
+ QString("qt_%1.qm").arg(localeLanguage), QString(get_datafile_dir()));
+ } else if (QFile::exists(QString("%1/qt_%2.qm")
+ .arg(get_datafile_dir()).arg(localeLanguage.left(localeLanguage.lastIndexOf('_'))))) {
+ switchTranslator(mainApp->translatorQt,
+ QString("qt_%1.qm").arg(localeLanguage.left(localeLanguage.lastIndexOf('_'))), QString(get_datafile_dir()));
+ } else {
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ QString translationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
+#else
+ QString translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+#endif
+ switchTranslator(mainApp->translatorQt, QString("qt_%1.qm").arg(localeLanguage), translationPath);
+ }
+}
+
+void MainApplication::doTriggerMenuItem(MainMenuItem menuItem)
+{
+ switch (menuItem)
+ {
+ case FileOpenDialog:
+ emit openCaptureFile(QString(), QString(), WTAP_TYPE_AUTO);
+ break;
+ case CaptureOptionsDialog:
+ emit openCaptureOptions();
+ break;
+ }
+}
+
+void MainApplication::zoomTextFont(int zoomLevel)
+{
+ // Scale by 10%, rounding to nearest half point, minimum 1 point.
+ // XXX Small sizes repeat. It might just be easier to create a map of multipliers.
+ qreal zoom_size = mono_font_.pointSize() * 2 * qPow(qreal(1.1), zoomLevel);
+ zoom_size = qRound(zoom_size) / qreal(2.0);
+ zoom_size = qMax(zoom_size, qreal(1.0));
+
+ zoomed_font_ = mono_font_;
+ zoomed_font_.setPointSizeF(zoom_size);
+ emit zoomMonospaceFont(zoomed_font_);
+
+ QFont zoomed_application_font = font();
+ zoomed_application_font.setPointSizeF(zoom_size);
+ emit zoomRegularFont(zoomed_application_font);
+}
+
+#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
+bool MainApplication::softwareUpdateCanShutdown() {
+ software_update_ok_ = true;
+ // At this point the update is ready to install, but WinSparkle has
+ // not yet run the installer. We need to close our "Wireshark is
+ // running" mutexes along with those of our child processes, e.g.
+ // dumpcap.
+
+ // Step 1: See if we have any open files.
+ emit softwareUpdateRequested();
+ if (software_update_ok_ == true) {
+
+ // Step 2: Close the "running" mutexes.
+ emit softwareUpdateClose();
+ close_app_running_mutex();
+ }
+ return software_update_ok_;
+}
+
+void MainApplication::softwareUpdateShutdownRequest() {
+ // At this point the installer has been launched. Neither Wireshark nor
+ // its children should have any "Wireshark is running" mutexes open.
+ // The main window should be closed.
+
+ // Step 3: Quit.
+ emit softwareUpdateQuit();
+}
+#endif
+
+void MainApplication::captureEventHandler(CaptureEvent ev)
+{
+ switch(ev.captureContext())
+ {
+#ifdef HAVE_LIBPCAP
+ case CaptureEvent::Update:
+ case CaptureEvent::Fixed:
+ switch (ev.eventType())
+ {
+ case CaptureEvent::Started:
+ active_captures_++;
+ emit captureActive(active_captures_);
+ break;
+ case CaptureEvent::Finished:
+ active_captures_--;
+ emit captureActive(active_captures_);
+ break;
+ default:
+ break;
+ }
+ break;
+#endif
+ case CaptureEvent::File:
+ case CaptureEvent::Reload:
+ case CaptureEvent::Rescan:
+ switch (ev.eventType())
+ {
+ case CaptureEvent::Started:
+ QTimer::singleShot(TAP_UPDATE_DEFAULT_INTERVAL / 5, this, SLOT(updateTaps()));
+ QTimer::singleShot(TAP_UPDATE_DEFAULT_INTERVAL / 2, this, SLOT(updateTaps()));
+ break;
+ case CaptureEvent::Finished:
+ updateTaps();
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void MainApplication::pushStatus(StatusInfo status, const QString &message, const QString &messagetip)
+{
+ if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
+ return;
+
+ MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
+ if (! mw->main_ui_ || ! mw->main_ui_->statusBar)
+ return;
+
+ MainStatusBar * bar = mw->main_ui_->statusBar;
+
+ switch(status)
+ {
+ case FilterSyntax:
+ bar->pushGenericStatus(MainStatusBar::STATUS_CTX_FILTER, message);
+ break;
+ case FieldStatus:
+ bar->pushGenericStatus(MainStatusBar::STATUS_CTX_FIELD, message);
+ break;
+ case FileStatus:
+ bar->pushGenericStatus(MainStatusBar::STATUS_CTX_FILE, message, messagetip);
+ break;
+ case ByteStatus:
+ bar->pushGenericStatus(MainStatusBar::STATUS_CTX_BYTE, message);
+ break;
+ case BusyStatus:
+ bar->pushGenericStatus(MainStatusBar::STATUS_CTX_PROGRESS, message, messagetip);
+ break;
+ case TemporaryStatus:
+ bar->pushGenericStatus(MainStatusBar::STATUS_CTX_TEMPORARY, message);
+ break;
+ }
+}
+
+void MainApplication::popStatus(StatusInfo status)
+{
+ if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
+ return;
+
+ MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
+ if (! mw->main_ui_ || ! mw->main_ui_->statusBar)
+ return;
+
+ MainStatusBar * bar = mw->main_ui_->statusBar;
+
+ switch(status)
+ {
+ case FilterSyntax:
+ bar->popGenericStatus(MainStatusBar::STATUS_CTX_FILTER);
+ break;
+ case FieldStatus:
+ bar->popGenericStatus(MainStatusBar::STATUS_CTX_FIELD);
+ break;
+ case FileStatus:
+ bar->popGenericStatus(MainStatusBar::STATUS_CTX_FILE);
+ break;
+ case ByteStatus:
+ bar->popGenericStatus(MainStatusBar::STATUS_CTX_BYTE);
+ break;
+ case BusyStatus:
+ bar->popGenericStatus(MainStatusBar::STATUS_CTX_PROGRESS);
+ break;
+ case TemporaryStatus:
+ bar->popGenericStatus(MainStatusBar::STATUS_CTX_TEMPORARY);
+ break;
+ }
+}
+
+void MainApplication::gotoFrame(int frame)
+{
+ if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
+ return;
+
+ MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
+ mw->gotoFrame(frame);
+}
diff --git a/ui/qt/main_application.h b/ui/qt/main_application.h
new file mode 100644
index 0000000000..1c4e4be435
--- /dev/null
+++ b/ui/qt/main_application.h
@@ -0,0 +1,238 @@
+/** @file
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef MAIN_APPLICATION_H
+#define MAIN_APPLICATION_H
+
+#include <config.h>
+
+#include <glib.h>
+
+#include "wsutil/feature_list.h"
+
+#include "epan/register.h"
+
+#include "ui/help_url.h"
+
+#include <QApplication>
+#include <QDir>
+#include <QFont>
+#include <QIcon>
+#include <QTimer>
+#include <QTranslator>
+
+#include "capture_event.h"
+
+struct _e_prefs;
+
+class QAction;
+class QSocketNotifier;
+
+// Recent items:
+// - Read from prefs
+// - Add from open file
+// - Check current list
+// - Signal updated item
+// -
+typedef struct _recent_item_status {
+ QString filename;
+ qint64 size;
+ bool accessible;
+ bool in_thread;
+} recent_item_status;
+
+class MainApplication : public QApplication
+{
+ Q_OBJECT
+public:
+ explicit MainApplication(int &argc, char **argv);
+ ~MainApplication();
+
+ enum AppSignal {
+ CaptureFilterListChanged,
+ ColumnsChanged,
+ DisplayFilterListChanged,
+ FieldsChanged,
+ FilterExpressionsChanged,
+ LocalInterfacesChanged,
+ NameResolutionChanged,
+ PacketDissectionChanged,
+ PreferencesChanged,
+ ProfileChanging,
+ RecentCapturesChanged,
+ RecentPreferencesRead
+ };
+
+ enum MainMenuItem {
+ FileOpenDialog,
+ CaptureOptionsDialog
+ };
+
+ enum StatusInfo {
+ FilterSyntax,
+ FieldStatus,
+ FileStatus,
+ BusyStatus,
+ ByteStatus,
+ TemporaryStatus
+ };
+
+ void registerUpdate(register_action_e action, const char *message);
+ void emitAppSignal(AppSignal signal);
+ // Emitting app signals (PacketDissectionChanged in particular) from
+ // dialogs on macOS can be problematic. Dialogs should call queueAppSignal
+ // instead.
+ void queueAppSignal(AppSignal signal) { app_signals_ << signal; }
+ void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata);
+ void emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata);
+ void addDynamicMenuGroupItem(int group, QAction *sg_action);
+ void appendDynamicMenuGroupItem(int group, QAction *sg_action);
+ void removeDynamicMenuGroupItem(int group, QAction *sg_action);
+ QList<QAction *> dynamicMenuGroupItems(int group);
+ QList<QAction *> addedMenuGroupItems(int group);
+ QList<QAction *> removedMenuGroupItems(int group);
+ void clearAddedMenuGroupItems();
+ void clearRemovedMenuGroupItems();
+
+ void allSystemsGo();
+ void emitLocalInterfaceEvent(const char *ifname, int added, int up);
+ void refreshLocalInterfaces();
+ struct _e_prefs * readConfigurationFiles(bool reset);
+ QList<recent_item_status *> recentItems() const;
+ void addRecentItem(const QString filename, qint64 size, bool accessible);
+ void removeRecentItem(const QString &filename);
+ QDir lastOpenDir();
+ void setLastOpenDir(const char *dir_name);
+ void setLastOpenDirFromFilename(QString file_name);
+ void helpTopicAction(topic_action_e action);
+ const QFont monospaceFont(bool zoomed = false) const;
+ void setMonospaceFont(const char *font_string);
+ int monospaceTextSize(const char *str);
+ void setConfigurationProfile(const gchar *profile_name, bool write_recent_file = true);
+ void reloadLuaPluginsDelayed();
+ bool isInitialized() { return initialized_; }
+ void setReloadingLua(bool is_reloading) { is_reloading_lua_ = is_reloading; }
+ bool isReloadingLua() { return is_reloading_lua_; }
+ const QIcon &normalIcon();
+ const QIcon &captureIcon();
+ const QString &windowTitleSeparator() const { return window_title_separator_; }
+ const QString windowTitleString(QStringList title_parts);
+ const QString windowTitleString(QString title_part) { return windowTitleString(QStringList() << title_part); }
+ void applyCustomColorsFromRecent();
+#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
+ void rejectSoftwareUpdate() { software_update_ok_ = false; }
+ bool softwareUpdateCanShutdown();
+ void softwareUpdateShutdownRequest();
+#endif
+ QWidget *mainWindow();
+
+ QTranslator translator;
+ QTranslator translatorQt;
+ void loadLanguage(const QString language);
+
+ void doTriggerMenuItem(MainMenuItem menuItem);
+
+ void zoomTextFont(int zoomLevel);
+
+ void pushStatus(StatusInfo sinfo, const QString &message, const QString &messagetip = QString());
+ void popStatus(StatusInfo sinfo);
+
+ void gotoFrame(int frameNum);
+
+private:
+ bool initialized_;
+ bool is_reloading_lua_;
+ QFont mono_font_;
+ QFont zoomed_font_;
+ QTimer recent_timer_;
+ QTimer packet_data_timer_;
+ QTimer tap_update_timer_;
+ QList<QString> pending_open_files_;
+ QSocketNotifier *if_notifier_;
+ QIcon normal_icon_;
+ QIcon capture_icon_;
+ static QString window_title_separator_;
+ QList<AppSignal> app_signals_;
+ int active_captures_;
+#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
+ bool software_update_ok_;
+#endif
+
+ void storeCustomColorsInRecent();
+ void clearDynamicMenuGroupItems();
+ void initializeIcons();
+
+protected:
+ bool event(QEvent *event);
+
+signals:
+ void appInitialized();
+ void localInterfaceEvent(const char *ifname, int added, int up);
+ void localInterfaceListChanged();
+ void openCaptureFile(QString cf_path, QString display_filter, unsigned int type);
+ void openCaptureOptions();
+ void recentPreferencesRead();
+ void updateRecentCaptureStatus(const QString &filename, qint64 size, bool accessible);
+ void splashUpdate(register_action_e action, const char *message);
+ void profileChanging();
+ void profileNameChanged(const gchar *profile_name);
+
+ void columnsChanged(); // XXX This recreates the packet list. We might want to rename it accordingly.
+ void captureFilterListChanged();
+ void displayFilterListChanged();
+ void filterExpressionsChanged();
+ void packetDissectionChanged();
+ void preferencesChanged();
+ void addressResolutionChanged();
+ void columnDataChanged();
+ void checkDisplayFilter();
+ void fieldsChanged();
+ void reloadLuaPlugins();
+#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
+ // Each of these are called from a separate thread.
+ void softwareUpdateRequested();
+ void softwareUpdateClose();
+ void softwareUpdateQuit();
+#endif
+
+ void openStatCommandDialog(const QString &menu_path, const char *arg, void *userdata);
+ void openTapParameterDialog(const QString cfg_str, const QString arg, void *userdata);
+
+ /* Signals activation and stop of a capture. The value provides the number of active captures */
+ void captureActive(int);
+
+ void zoomRegularFont(const QFont & font);
+ void zoomMonospaceFont(const QFont & font);
+
+public slots:
+ void clearRecentCaptures();
+ void refreshRecentCaptures();
+
+ void captureEventHandler(CaptureEvent);
+
+ // Flush queued app signals. Should be called from the main window after
+ // each dialog that calls queueAppSignal closes.
+ void flushAppSignals();
+
+private slots:
+ void updateTaps();
+
+ void cleanup();
+ void ifChangeEventsAvailable();
+ void itemStatusFinished(const QString filename = "", qint64 size = 0, bool accessible = false);
+ void refreshPacketData();
+};
+
+extern MainApplication *mainApp;
+
+/** Global compile time version info */
+extern void gather_wireshark_qt_compiled_info(feature_list l);
+/** Global runtime version info */
+extern void gather_wireshark_runtime_info(feature_list l);
+#endif // MAIN_APPLICATION_H
diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp
index e1e5ce4893..bd07d5f0f4 100644
--- a/ui/qt/main_status_bar.cpp
+++ b/ui/qt/main_status_bar.cpp
@@ -64,7 +64,7 @@ statusbar_push_temporary_msg(const gchar *msg_format, ...)
push_msg = QString::vasprintf(msg_format, ap);
va_end(ap);
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, push_msg);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, push_msg);
}
/*
@@ -167,11 +167,11 @@ MainStatusBar::MainStatusBar(QWidget *parent) :
progress_frame_.enableTaskbarUpdates(true);
#endif
- connect(wsApp, SIGNAL(appInitialized()), splitter, SLOT(show()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(appInitialized()));
+ connect(mainApp, SIGNAL(appInitialized()), splitter, SLOT(show()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(appInitialized()));
connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)),
this, SLOT(toggleBackground(bool)));
- connect(wsApp, SIGNAL(profileNameChanged(const gchar *)),
+ connect(mainApp, SIGNAL(profileNameChanged(const gchar *)),
this, SLOT(setProfileName()));
connect(&profile_status_, SIGNAL(clickedAt(QPoint,Qt::MouseButton)),
this, SLOT(showProfileMenu(QPoint,Qt::MouseButton)));
@@ -352,7 +352,7 @@ void MainStatusBar::setProfileName()
void MainStatusBar::appInitialized()
{
setProfileName();
- connect(wsApp->mainWindow(), SIGNAL(framesSelected(QList<int>)), this, SLOT(selectedFrameChanged(QList<int>)));
+ connect(mainApp->mainWindow(), SIGNAL(framesSelected(QList<int>)), this, SLOT(selectedFrameChanged(QList<int>)));
}
void MainStatusBar::selectedFrameChanged(QList<int>)
@@ -365,7 +365,7 @@ void MainStatusBar::showCaptureStatistics()
QString packets_str;
QList<int> rows;
- MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
+ MainWindow * mw = qobject_cast<MainWindow *>(mainApp->mainWindow());
if (mw)
rows = mw->selectedRows(true);
@@ -607,7 +607,7 @@ void MainStatusBar::switchToProfile()
if (pa && pa->property("profile_name").isValid()) {
QString profile = pa->property("profile_name").toString();
- wsApp->setConfigurationProfile(profile.toUtf8().constData());
+ mainApp->setConfigurationProfile(profile.toUtf8().constData());
}
}
diff --git a/ui/qt/main_status_bar.h b/ui/qt/main_status_bar.h
index 0ae7f9991e..cc0a915e18 100644
--- a/ui/qt/main_status_bar.h
+++ b/ui/qt/main_status_bar.h
@@ -96,7 +96,7 @@ private slots:
void manageProfile();
void showProfileMenu(const QPoint &global_pos, Qt::MouseButton button);
- friend WiresharkApplication;
+ friend MainApplication;
};
#endif // MAIN_STATUS_BAR_H
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 82c197c2a2..139005332b 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -7,6 +7,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "main_application.h"
#include "main_window.h"
/*
@@ -67,7 +68,6 @@ DIAG_ON(frame-larger-than=)
#include "tap_parameter_dialog.h"
#include "wireless_frame.h"
#include <ui/qt/widgets/wireless_timeline.h>
-#include "wireshark_application.h"
#include <ui/qt/widgets/additional_toolbar.h>
#include <ui/qt/widgets/display_filter_edit.h>
@@ -129,8 +129,8 @@ DIAG_OFF_CAST_AWAY_CONST
{
unsigned int changed_flags = prefs_store_ext(module_name, pref_name, pref_value);
if (changed_flags) {
- wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
- wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
+ mainApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
}
}
DIAG_ON_CAST_AWAY_CONST
@@ -349,9 +349,9 @@ MainWindow::MainWindow(QWidget *parent) :
#endif
{
if (!gbl_cur_main_window_) {
- connect(wsApp, SIGNAL(openStatCommandDialog(QString, const char*, void*)),
+ connect(mainApp, SIGNAL(openStatCommandDialog(QString, const char*, void*)),
this, SLOT(openStatCommandDialog(QString, const char*, void*)));
- connect(wsApp, SIGNAL(openTapParameterDialog(QString, const QString, void*)),
+ connect(mainApp, SIGNAL(openTapParameterDialog(QString, const QString, void*)),
this, SLOT(openTapParameterDialog(QString, const QString, void*)));
}
gbl_cur_main_window_ = this;
@@ -375,7 +375,7 @@ MainWindow::MainWindow(QWidget *parent) :
main_ui_->menuView->removeAction(main_ui_->actionViewWirelessToolbar);
#endif
- setWindowIcon(wsApp->normalIcon());
+ setWindowIcon(mainApp->normalIcon());
setTitlebarForCaptureFile();
setMenusForCaptureFile();
setForCapturedPackets(false);
@@ -396,30 +396,30 @@ MainWindow::MainWindow(QWidget *parent) :
//To prevent users use features before initialization complete
//Otherwise unexpected problems may occur
setFeaturesEnabled(false);
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(setFeaturesEnabled()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(applyGlobalCommandLineOptions()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(zoomText()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(initViewColorizeMenu()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(addStatsPluginsToMenu()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(addDynamicMenus()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(addPluginIFStructures()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(initConversationMenus()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(initExportObjectsMenus()));
-
- connect(wsApp, SIGNAL(profileChanging()), this, SLOT(saveWindowGeometry()));
- connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(layoutPanes()));
- connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(layoutToolbars()));
- connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(updatePreferenceActions()));
- connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(zoomText()));
- connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(setTitlebarForCaptureFile()));
-
- connect(wsApp, SIGNAL(updateRecentCaptureStatus(const QString &, qint64, bool)), this, SLOT(updateRecentCaptures()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(setFeaturesEnabled()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(applyGlobalCommandLineOptions()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(zoomText()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(initViewColorizeMenu()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(addStatsPluginsToMenu()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(addDynamicMenus()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(addPluginIFStructures()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(initConversationMenus()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(initExportObjectsMenus()));
+
+ connect(mainApp, SIGNAL(profileChanging()), this, SLOT(saveWindowGeometry()));
+ connect(mainApp, SIGNAL(preferencesChanged()), this, SLOT(layoutPanes()));
+ connect(mainApp, SIGNAL(preferencesChanged()), this, SLOT(layoutToolbars()));
+ connect(mainApp, SIGNAL(preferencesChanged()), this, SLOT(updatePreferenceActions()));
+ connect(mainApp, SIGNAL(preferencesChanged()), this, SLOT(zoomText()));
+ connect(mainApp, SIGNAL(preferencesChanged()), this, SLOT(setTitlebarForCaptureFile()));
+
+ connect(mainApp, SIGNAL(updateRecentCaptureStatus(const QString &, qint64, bool)), this, SLOT(updateRecentCaptures()));
updateRecentCaptures();
#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
- connect(wsApp, SIGNAL(softwareUpdateRequested()), this, SLOT(softwareUpdateRequested()),
+ connect(mainApp, SIGNAL(softwareUpdateRequested()), this, SLOT(softwareUpdateRequested()),
Qt::BlockingQueuedConnection);
- connect(wsApp, SIGNAL(softwareUpdateClose()), this, SLOT(close()),
+ connect(mainApp, SIGNAL(softwareUpdateClose()), this, SLOT(close()),
Qt::BlockingQueuedConnection);
#endif
@@ -541,7 +541,7 @@ main_ui_->goToLineEdit->setValidator(goToLineQiv);
connect(this, &MainWindow::fieldHighlight,
main_ui_->statusBar, &MainStatusBar::highlightedFieldChanged);
- connect(wsApp, &WiresharkApplication::captureActive,
+ connect(mainApp, &WiresharkApplication::captureActive,
this, &MainWindow::captureActive);
byte_view_tab_ = new ByteViewTab(&master_split_);
@@ -564,26 +564,26 @@ main_ui_->goToLineEdit->setValidator(goToLineQiv);
connect(&capture_file_, SIGNAL(captureEvent(CaptureEvent)),
this, SLOT(captureEventHandler(CaptureEvent)));
connect(&capture_file_, SIGNAL(captureEvent(CaptureEvent)),
- wsApp, SLOT(captureEventHandler(CaptureEvent)));
+ mainApp, SLOT(captureEventHandler(CaptureEvent)));
connect(&capture_file_, SIGNAL(captureEvent(CaptureEvent)),
main_ui_->statusBar, SLOT(captureEventHandler(CaptureEvent)));
- connect(wsApp, SIGNAL(columnsChanged()),
+ connect(mainApp, SIGNAL(columnsChanged()),
packet_list_, SLOT(columnsChanged()));
- connect(wsApp, SIGNAL(preferencesChanged()),
+ connect(mainApp, SIGNAL(preferencesChanged()),
packet_list_, SLOT(preferencesChanged()));
- connect(wsApp, SIGNAL(recentPreferencesRead()),
+ connect(mainApp, SIGNAL(recentPreferencesRead()),
this, SLOT(applyRecentPaneGeometry()));
- connect(wsApp, SIGNAL(recentPreferencesRead()),
+ connect(mainApp, SIGNAL(recentPreferencesRead()),
this, SLOT(updateRecentActions()));
- connect(wsApp, SIGNAL(packetDissectionChanged()),
+ connect(mainApp, SIGNAL(packetDissectionChanged()),
this, SLOT(redissectPackets()), Qt::QueuedConnection);
- connect(wsApp, SIGNAL(checkDisplayFilter()),
+ connect(mainApp, SIGNAL(checkDisplayFilter()),
this, SLOT(checkDisplayFilter()));
- connect(wsApp, SIGNAL(fieldsChanged()),
+ connect(mainApp, SIGNAL(fieldsChanged()),
this, SLOT(fieldsChanged()));
- connect(wsApp, SIGNAL(reloadLuaPlugins()),
+ connect(mainApp, SIGNAL(reloadLuaPlugins()),
this, SLOT(reloadLuaPlugins()));
connect(main_ui_->mainStack, SIGNAL(currentChanged(int)),
@@ -615,9 +615,9 @@ main_ui_->goToLineEdit->setValidator(goToLineQiv);
connect(this, &MainWindow::setCaptureFile,
proto_tree_, &ProtoTree::setCaptureFile);
- connect(wsApp, SIGNAL(zoomMonospaceFont(QFont)),
+ connect(mainApp, SIGNAL(zoomMonospaceFont(QFont)),
packet_list_, SLOT(setMonospaceFont(QFont)));
- connect(wsApp, SIGNAL(zoomMonospaceFont(QFont)),
+ connect(mainApp, SIGNAL(zoomMonospaceFont(QFont)),
proto_tree_, SLOT(setMonospaceFont(QFont)));
connect(main_ui_->actionGoNextPacket, SIGNAL(triggered()),
@@ -815,8 +815,8 @@ void MainWindow::addInterfaceToolbar(const iface_toolbar *toolbar_entry)
menu->insertAction(before, action);
InterfaceToolbar *interface_toolbar = new InterfaceToolbar(this, toolbar_entry);
- connect(wsApp, SIGNAL(appInitialized()), interface_toolbar, SLOT(interfaceListChanged()));
- connect(wsApp, SIGNAL(localInterfaceListChanged()), interface_toolbar, SLOT(interfaceListChanged()));
+ connect(mainApp, SIGNAL(appInitialized()), interface_toolbar, SLOT(interfaceListChanged()));
+ connect(mainApp, SIGNAL(localInterfaceListChanged()), interface_toolbar, SLOT(interfaceListChanged()));
QToolBar *toolbar = new QToolBar(this);
toolbar->addWidget(interface_toolbar);
@@ -940,7 +940,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
return;
}
- if (wsApp->focusWidget() == main_ui_->goToLineEdit) {
+ if (mainApp->focusWidget() == main_ui_->goToLineEdit) {
if (event->modifiers() == Qt::NoModifier) {
if (event->key() == Qt::Key_Escape) {
on_goToCancel_clicked();
@@ -985,19 +985,19 @@ void MainWindow::closeEvent(QCloseEvent *event) {
delete welcome_page_;
// One of the many places we assume one main window.
- if (!wsApp->isInitialized()) {
+ if (!mainApp->isInitialized()) {
// If we're still initializing, QCoreApplication::quit() won't
// exit properly because we are not in the event loop. This
// means that the application won't clean up after itself. We
- // might want to call wsApp->processEvents() during startup
+ // might want to call mainApp->processEvents() during startup
// instead so that we can do a normal exit here.
exit(0);
}
- wsApp->quit();
+ mainApp->quit();
// When the main loop is not yet running (i.e. when openCaptureFile is
// executing in main.cpp), the above quit action has no effect.
// Schedule a quit action for the next execution of the main loop.
- QMetaObject::invokeMethod(wsApp, "quit", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(mainApp, "quit", Qt::QueuedConnection);
}
// XXX On windows the drag description is "Copy". It should be "Open" or
@@ -1015,7 +1015,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
// We could alternatively call setAcceptDrops(!capture_in_progress)
// in setMenusForCaptureInProgress but that wouldn't provide feedback.
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Unable to drop files during capture."));
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Unable to drop files during capture."));
event->setDropAction(Qt::IgnoreAction);
event->ignore();
return;
@@ -1169,7 +1169,7 @@ void MainWindow::saveWindowGeometry()
// shown and hidden.
void MainWindow::freeze()
{
- freeze_focus_ = wsApp->focusWidget();
+ freeze_focus_ = mainApp->focusWidget();
// XXX Alternatively we could just disable and enable the main menu.
for (int i = 0; i < freeze_actions_.size(); i++) {
@@ -1332,7 +1332,7 @@ void MainWindow::mergeCaptureFile()
}
/* Save the name of the containing directory specified in the path name. */
- wsApp->setLastOpenDirFromFilename(tmpname);
+ mainApp->setLastOpenDirFromFilename(tmpname);
g_free(tmpname);
main_ui_->statusBar->showExpert();
return;
@@ -2606,7 +2606,7 @@ void MainWindow::setMenusForFileSet(bool enable_list_files) {
}
void MainWindow::setWindowIcon(const QIcon &icon) {
- wsApp->setWindowIcon(icon);
+ mainApp->setWindowIcon(icon);
QMainWindow::setWindowIcon(icon);
}
@@ -2624,12 +2624,12 @@ void MainWindow::changeEvent(QEvent* event)
case QEvent::LanguageChange:
main_ui_->retranslateUi(this);
// make sure that the "Clear Menu" item is retranslated
- wsApp->emitAppSignal(WiresharkApplication::RecentCapturesChanged);
+ mainApp->emitAppSignal(WiresharkApplication::RecentCapturesChanged);
break;
case QEvent::LocaleChange: {
QString locale = QLocale::system().name();
locale.truncate(locale.lastIndexOf('_'));
- wsApp->loadLanguage(locale);
+ mainApp->loadLanguage(locale);
}
break;
case QEvent::WindowStateChange:
@@ -2808,32 +2808,32 @@ void MainWindow::removeMenuActions(QList<QAction *> &actions, int menu_group)
void MainWindow::addDynamicMenus()
{
// Manual additions
- wsApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_GSM, main_ui_->actionTelephonyGsmMapSummary);
- wsApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_LTE, main_ui_->actionTelephonyLteMacStatistics);
- wsApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_LTE, main_ui_->actionTelephonyLteRlcStatistics);
- wsApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_LTE, main_ui_->actionTelephonyLteRlcGraph);
- wsApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_MTP3, main_ui_->actionTelephonyMtp3Summary);
- wsApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY, main_ui_->actionTelephonySipFlows);
+ mainApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_GSM, main_ui_->actionTelephonyGsmMapSummary);
+ mainApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_LTE, main_ui_->actionTelephonyLteMacStatistics);
+ mainApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_LTE, main_ui_->actionTelephonyLteRlcStatistics);
+ mainApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_LTE, main_ui_->actionTelephonyLteRlcGraph);
+ mainApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY_MTP3, main_ui_->actionTelephonyMtp3Summary);
+ mainApp->addDynamicMenuGroupItem(REGISTER_STAT_GROUP_TELEPHONY, main_ui_->actionTelephonySipFlows);
// Fill in each menu
foreach(register_stat_group_t menu_group, menu_groups) {
- QList<QAction *>actions = wsApp->dynamicMenuGroupItems(menu_group);
+ QList<QAction *>actions = mainApp->dynamicMenuGroupItems(menu_group);
addMenuActions(actions, menu_group);
}
// Empty menus don't show up: https://bugreports.qt.io/browse/QTBUG-33728
// We've added a placeholder in order to make sure some menus are visible.
// Hide them as needed.
- if (wsApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_ANSI).length() > 0) {
+ if (mainApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_ANSI).length() > 0) {
main_ui_->actionTelephonyANSIPlaceholder->setVisible(false);
}
- if (wsApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_GSM).length() > 0) {
+ if (mainApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_GSM).length() > 0) {
main_ui_->actionTelephonyGSMPlaceholder->setVisible(false);
}
- if (wsApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_LTE).length() > 0) {
+ if (mainApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_LTE).length() > 0) {
main_ui_->actionTelephonyLTEPlaceholder->setVisible(false);
}
- if (wsApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_MTP3).length() > 0) {
+ if (mainApp->dynamicMenuGroupItems(REGISTER_STAT_GROUP_TELEPHONY_MTP3).length() > 0) {
main_ui_->actionTelephonyMTP3Placeholder->setVisible(false);
}
}
@@ -2841,15 +2841,15 @@ void MainWindow::addDynamicMenus()
void MainWindow::reloadDynamicMenus()
{
foreach(register_stat_group_t menu_group, menu_groups) {
- QList<QAction *>actions = wsApp->removedMenuGroupItems(menu_group);
+ QList<QAction *>actions = mainApp->removedMenuGroupItems(menu_group);
removeMenuActions(actions, menu_group);
- actions = wsApp->addedMenuGroupItems(menu_group);
+ actions = mainApp->addedMenuGroupItems(menu_group);
addMenuActions(actions, menu_group);
}
- wsApp->clearAddedMenuGroupItems();
- wsApp->clearRemovedMenuGroupItems();
+ mainApp->clearAddedMenuGroupItems();
+ mainApp->clearRemovedMenuGroupItems();
}
void MainWindow::externalMenuHelper(ext_menu_t * menu, QMenu * subMenu, gint depth)
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index de1a1b5597..782d295a28 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -739,7 +739,7 @@ private slots:
QString findRtpStreams(QVector<rtpstream_id_t *> *stream_ids, bool reverse);
- friend WiresharkApplication;
+ friend class MainApplication;
};
#endif // MAINWINDOW_H
diff --git a/ui/qt/main_window_preferences_frame.cpp b/ui/qt/main_window_preferences_frame.cpp
index 9cb6442d6f..e7ad9ae7b0 100644
--- a/ui/qt/main_window_preferences_frame.cpp
+++ b/ui/qt/main_window_preferences_frame.cpp
@@ -7,7 +7,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#include "wireshark_application.h"
+#include "main_application.h"
#include "main_window_preferences_frame.h"
#include <ui/qt/utils/qt_ui_utils.h>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 00cf06ec7f..67a477a25d 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -128,6 +128,7 @@ DIAG_ON(frame-larger-than=)
#include "lte_mac_statistics_dialog.h"
#include "lte_rlc_statistics_dialog.h"
#include "lte_rlc_graph_dialog.h"
+#include "main_application.h"
#include "mtp3_summary_dialog.h"
#include "multicast_statistics_dialog.h"
#include "packet_comment_dialog.h"
@@ -158,7 +159,6 @@ DIAG_ON(frame-larger-than=)
#include "time_shift_dialog.h"
#include "uat_dialog.h"
#include "voip_calls_dialog.h"
-#include "wireshark_application.h"
#include "wlan_statistics_dialog.h"
#include <ui/qt/widgets/wireless_timeline.h>
@@ -278,7 +278,7 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned
break;
}
- wsApp->setLastOpenDirFromFilename(cf_path);
+ mainApp->setLastOpenDirFromFilename(cf_path);
main_ui_->statusBar->showExpert();
@@ -480,7 +480,7 @@ void MainWindow::queuedFilterAction(QString action_filter, FilterAction::Action
colorizeWithFilter(new_filter.toUtf8());
break;
case FilterAction::ActionCopy:
- wsApp->clipboard()->setText(new_filter);
+ mainApp->clipboard()->setText(new_filter);
break;
case FilterAction::ActionFind:
main_ui_->searchFrame->findFrameWithFilter(new_filter);
@@ -507,7 +507,7 @@ void MainWindow::queuedFilterAction(QString action_filter, FilterAction::Action
void MainWindow::captureCapturePrepared(capture_session *session) {
setTitlebarForCaptureInProgress();
- setWindowIcon(wsApp->captureIcon());
+ setWindowIcon(mainApp->captureIcon());
/* Disable menu items that make no sense if you're currently running
a capture. */
@@ -546,7 +546,7 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *session) {
setForCaptureInProgress(false, handle_toolbars);
setMenusForCaptureFile();
- setWindowIcon(wsApp->normalIcon());
+ setWindowIcon(mainApp->normalIcon());
if (global_commandline_info.quit_after_cap) {
// Command line asked us to quit after capturing.
@@ -568,7 +568,7 @@ void MainWindow::captureCaptureFixedFinished(capture_session *) {
display packets */
setMenusForCaptureFile(true);
- setWindowIcon(wsApp->normalIcon());
+ setWindowIcon(mainApp->normalIcon());
if (global_commandline_info.quit_after_cap) {
// Command line asked us to quit after capturing.
@@ -586,9 +586,9 @@ void MainWindow::captureCaptureFailed(capture_session *) {
// Reset expert information indicator
main_ui_->statusBar->captureFileClosing();
- wsApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->popStatus(WiresharkApplication::FileStatus);
- setWindowIcon(wsApp->normalIcon());
+ setWindowIcon(mainApp->normalIcon());
if (global_commandline_info.quit_after_cap) {
// Command line asked us to quit after capturing.
@@ -672,11 +672,11 @@ void MainWindow::captureEventHandler(CaptureEvent ev)
case CaptureEvent::Merge:
switch (ev.eventType()) {
case CaptureEvent::Started:
- wsApp->popStatus(WiresharkApplication::FileStatus);
- wsApp->pushStatus(WiresharkApplication::FileStatus, tr("Merging files."), QString());
+ mainApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->pushStatus(WiresharkApplication::FileStatus, tr("Merging files."), QString());
break;
case CaptureEvent::Finished:
- wsApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->popStatus(WiresharkApplication::FileStatus);
break;
default:
break;
@@ -688,8 +688,8 @@ void MainWindow::captureEventHandler(CaptureEvent ev)
case CaptureEvent::Started:
{
QFileInfo file_info(ev.filePath());
- wsApp->popStatus(WiresharkApplication::FileStatus);
- wsApp->pushStatus(WiresharkApplication::FileStatus, tr("Saving %1…").arg(file_info.fileName()));
+ mainApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->pushStatus(WiresharkApplication::FileStatus, tr("Saving %1…").arg(file_info.fileName()));
break;
}
default:
@@ -754,10 +754,10 @@ void MainWindow::captureFileReadStarted(const QString &action) {
/* Set up main window for a capture file. */
// main_set_for_capture_file(TRUE);
- wsApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->popStatus(WiresharkApplication::FileStatus);
QString msg = QString(tr("%1: %2")).arg(action).arg(capture_file_.fileName());
QString msgtip = QString();
- wsApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip);
+ mainApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip);
showCapture();
main_ui_->actionAnalyzeReloadLuaPlugins->setEnabled(false);
main_ui_->wirelessTimelineWidget->captureFileReadStarted(capture_file_.capFile());
@@ -769,7 +769,7 @@ void MainWindow::captureFileReadFinished() {
add_menu_recent_capture_file(capture_file_.capFile()->filename);
/* Remember folder for next Open dialog and save it in recent */
- wsApp->setLastOpenDirFromFilename(capture_file_.capFile()->filename);
+ mainApp->setLastOpenDirFromFilename(capture_file_.capFile()->filename);
}
/* Update the appropriate parts of the main window. */
@@ -812,10 +812,10 @@ void MainWindow::captureFileClosed() {
// Reset expert information indicator
main_ui_->statusBar->captureFileClosing();
- wsApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->popStatus(WiresharkApplication::FileStatus);
setWSWindowTitle();
- setWindowIcon(wsApp->normalIcon());
+ setWindowIcon(mainApp->normalIcon());
setMenusForSelectedPacket();
setMenusForSelectedTreeRow();
@@ -860,7 +860,7 @@ void MainWindow::startCapture(QStringList interfaces _U_) {
/* did the user ever select a capture interface before? */
if (global_capture_opts.num_selected == 0) {
QString msg = QString(tr("No interface selected."));
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
main_ui_->actionCaptureStart->setChecked(false);
return;
}
@@ -885,7 +885,7 @@ void MainWindow::startCapture(QStringList interfaces _U_) {
/* If some of extcap was not configured, do not start with the capture */
if (!can_start_capture) {
QString msg = QString(tr("Configure all extcaps before start of capture."));
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
main_ui_->actionCaptureStart->setChecked(false);
return;
}
@@ -895,7 +895,7 @@ void MainWindow::startCapture(QStringList interfaces _U_) {
// case, e.g. with QtMacExtras.
if (!capture_filter_valid_) {
QString msg = QString(tr("Invalid capture filter."));
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
main_ui_->actionCaptureStart->setChecked(false);
return;
}
@@ -929,12 +929,12 @@ void MainWindow::startCapture(QStringList interfaces _U_) {
}
g_string_append(interface_names, " ");
- wsApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->popStatus(WiresharkApplication::FileStatus);
QString msg = QString("%1<live capture in progress>").arg(interface_names->str);
QString msgtip = QString("to file: ");
if (capture_opts->save_file)
msgtip += capture_opts->save_file;
- wsApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip);
+ mainApp->pushStatus(WiresharkApplication::FileStatus, msg, msgtip);
g_string_free(interface_names, TRUE);
/* The capture succeeded, which means the capture filter syntax is
@@ -1096,7 +1096,7 @@ void MainWindow::updateRecentCaptures() {
/* Iterate through the actions in menuOpenRecentCaptureFile,
* removing special items, a maybe duplicate entry and every item above count_max */
int shortcut = Qt::Key_0;
- foreach(recent_item_status *ri, wsApp->recentItems()) {
+ foreach(recent_item_status *ri, mainApp->recentItems()) {
// Add the new item
ra = new QAction(recentMenu);
ra->setData(ri->filename);
@@ -1147,7 +1147,7 @@ void MainWindow::updateRecentCaptures() {
ra = new QAction(recentMenu);
ra->setText(tr("Clear Menu"));
recentMenu->insertAction(NULL, ra);
- connect(ra, SIGNAL(triggered()), wsApp, SLOT(clearRecentCaptures()));
+ connect(ra, SIGNAL(triggered()), mainApp, SLOT(clearRecentCaptures()));
} else {
if (main_ui_->actionDummyNoFilesFound) {
recentMenu->addAction(main_ui_->actionDummyNoFilesFound);
@@ -1575,7 +1575,7 @@ void MainWindow::fieldsChanged()
void MainWindow::reloadLuaPlugins()
{
#ifdef HAVE_LUA
- if (wsApp->isReloadingLua())
+ if (mainApp->isReloadingLua())
return;
gboolean uses_lua_filehandler = FALSE;
@@ -1594,7 +1594,7 @@ void MainWindow::reloadLuaPlugins()
}
}
- wsApp->setReloadingLua(true);
+ mainApp->setReloadingLua(true);
wslua_reload_plugins(NULL, NULL);
funnel_statistics_reload_menus();
@@ -1604,7 +1604,7 @@ void MainWindow::reloadLuaPlugins()
// Preferences may have been deleted so close all widgets using prefs
main_ui_->preferenceEditorFrame->animatedHide();
- wsApp->readConfigurationFiles(true);
+ mainApp->readConfigurationFiles(true);
commandline_options_reapply();
fieldsChanged();
@@ -1620,7 +1620,7 @@ void MainWindow::reloadLuaPlugins()
redissectPackets();
}
- wsApp->setReloadingLua(false);
+ mainApp->setReloadingLua(false);
SimpleDialog::displayQueuedMessages();
#endif
}
@@ -1646,7 +1646,7 @@ void MainWindow::showAccordionFrame(AccordionFrame *show_frame, bool toggle)
void MainWindow::showColumnEditor(int column)
{
- previous_focus_ = wsApp->focusWidget();
+ previous_focus_ = mainApp->focusWidget();
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
main_ui_->columnEditorFrame->editColumn(column);
showAccordionFrame(main_ui_->columnEditorFrame);
@@ -1815,7 +1815,7 @@ void MainWindow::softwareUpdateRequested() {
// We could call testCaptureFileClose here, but that would give us yet
// another dialog. Just try again later.
if (capture_file_.capFile() && capture_file_.capFile()->state != FILE_CLOSED) {
- wsApp->rejectSoftwareUpdate();
+ mainApp->rejectSoftwareUpdate();
}
}
#endif
@@ -1920,8 +1920,8 @@ void MainWindow::on_actionFileExportPacketBytes_triggered()
if (!capture_file_.capFile() || !capture_file_.capFile()->finfo_selected) return;
file_name = WiresharkFileDialog::getSaveFileName(this,
- wsApp->windowTitleString(tr("Export Selected Packet Bytes")),
- wsApp->lastOpenDir().canonicalPath(),
+ mainApp->windowTitleString(tr("Export Selected Packet Bytes")),
+ mainApp->lastOpenDir().canonicalPath(),
tr("Raw data (*.bin *.dat *.raw);;All Files (" ALL_FILES_WILDCARD ")")
);
@@ -1933,7 +1933,7 @@ void MainWindow::on_actionFileExportPacketBytes_triggered()
write_file_binary_mode(qUtf8Printable(file_name), data_p, capture_file_.capFile()->finfo_selected->length);
/* Save the directory name for future file dialogs. */
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
@@ -1998,10 +1998,10 @@ void MainWindow::on_actionFileExportTLSSessionKeys_triggered()
return;
}
- save_title.append(wsApp->windowTitleString(tr("Export TLS Session Keys (%Ln key(s))", "", keylist_len)));
+ save_title.append(mainApp->windowTitleString(tr("Export TLS Session Keys (%Ln key(s))", "", keylist_len)));
file_name = WiresharkFileDialog::getSaveFileName(this,
save_title,
- wsApp->lastOpenDir().canonicalPath(),
+ mainApp->lastOpenDir().canonicalPath(),
tr("TLS Session Keys (*.keys *.txt);;All Files (" ALL_FILES_WILDCARD ")")
);
if (file_name.length() > 0) {
@@ -2010,7 +2010,7 @@ void MainWindow::on_actionFileExportTLSSessionKeys_triggered()
write_file_binary_mode(qUtf8Printable(file_name), keylist, keylist_length);
/* Save the directory name for future file dialogs. */
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
g_free(keylist);
}
}
@@ -2130,10 +2130,10 @@ void MainWindow::actionEditCopyTriggered(MainWindow::CopySelected selection_type
}
if (clip.length()) {
- wsApp->clipboard()->setText(clip);
+ mainApp->clipboard()->setText(clip);
} else {
QString err = tr("Couldn't copy text. Try another item.");
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
}
}
@@ -2187,7 +2187,7 @@ void MainWindow::on_actionEditFindPacket_triggered()
if (! packet_list_->model() || packet_list_->model()->rowCount() < 1) {
return;
}
- previous_focus_ = wsApp->focusWidget();
+ previous_focus_ = mainApp->focusWidget();
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
if (!main_ui_->searchFrame->isVisible()) {
showAccordionFrame(main_ui_->searchFrame, true);
@@ -2412,7 +2412,7 @@ void MainWindow::on_actionEditConfigurationProfiles_triggered()
void MainWindow::showPreferencesDialog(QString module_name)
{
PreferencesDialog *pref_dialog = new PreferencesDialog(this);
- connect(pref_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
+ connect(pref_dialog, SIGNAL(destroyed(QObject*)), mainApp, SLOT(flushAppSignals()));
saveWindowGeometry(); // Save in case the layout panes are rearranged
pref_dialog->setPane(module_name);
@@ -2584,7 +2584,7 @@ void MainWindow::setNameResolution()
if (packet_list_) {
packet_list_->resetColumns();
}
- wsApp->emitAppSignal(WiresharkApplication::NameResolutionChanged);
+ mainApp->emitAppSignal(WiresharkApplication::NameResolutionChanged);
}
void MainWindow::on_actionViewNameResolutionPhysical_triggered()
@@ -2604,7 +2604,7 @@ void MainWindow::on_actionViewNameResolutionTransport_triggered()
void MainWindow::zoomText()
{
- wsApp->zoomTextFont(recent.gui_zoom_level);
+ mainApp->zoomTextFont(recent.gui_zoom_level);
}
void MainWindow::on_actionViewZoomIn_triggered()
@@ -2655,7 +2655,7 @@ void MainWindow::colorizeConversation(bool create_rule)
guint8 cc_num = colorize_action->data().toUInt();
gchar *filter = conversation_filter_from_packet(pi);
if (filter == NULL) {
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Unable to build conversation filter."));
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Unable to build conversation filter."));
return;
}
@@ -2783,7 +2783,7 @@ void MainWindow::openPacketDialog(bool from_reference)
connect(this, SIGNAL(closePacketDialogs()),
packet_dialog, SLOT(close()));
- zoomText(); // Emits wsApp->zoomMonospaceFont(QFont)
+ zoomText(); // Emits mainApp->zoomMonospaceFont(QFont)
packet_dialog->show();
}
@@ -2890,7 +2890,7 @@ void MainWindow::matchFieldFilter(FilterAction::Action action, FilterAction::Act
if (field_filter.isEmpty()) {
QString err = tr("No filter available. Try another %1.").arg(packet_list_->contextMenuActive() ? tr("column") : tr("item"));
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
return;
}
@@ -2918,7 +2918,7 @@ void MainWindow::on_actionAnalyzeDisplayFilterMacros_triggered()
struct epan_uat* dfm_uat;
dfilter_macro_get_uat(&dfm_uat);
UatDialog *uat_dlg = new UatDialog(parentWidget(), dfm_uat);
- connect(uat_dlg, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
+ connect(uat_dlg, SIGNAL(destroyed(QObject*)), mainApp, SLOT(flushAppSignals()));
uat_dlg->setWindowModality(Qt::ApplicationModal);
uat_dlg->setAttribute(Qt::WA_DeleteOnClose);
@@ -2939,7 +2939,7 @@ void MainWindow::on_actionAnalyzeCreateAColumn_triggered()
} else {
status = tr("The \"%1\" column already exists as \"%2\".").arg(hfinfo->name).arg(get_column_title(col));
}
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, status);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, status);
if (!get_column_visible(col)) {
packet_list_->setColumnHidden(col, false);
@@ -2983,7 +2983,7 @@ void MainWindow::applyExportObject()
void MainWindow::on_actionAnalyzeEnabledProtocols_triggered()
{
EnabledProtocolsDialog *enable_proto_dialog = new EnabledProtocolsDialog(this);
- connect(enable_proto_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
+ connect(enable_proto_dialog, SIGNAL(destroyed(QObject*)), mainApp, SLOT(flushAppSignals()));
enable_proto_dialog->setWindowModality(Qt::ApplicationModal);
enable_proto_dialog->setAttribute(Qt::WA_DeleteOnClose);
@@ -2996,7 +2996,7 @@ void MainWindow::on_actionAnalyzeDecodeAs_triggered()
bool create_new = da_action && da_action->property("create_new").toBool();
DecodeAsDialog *da_dialog = new DecodeAsDialog(this, capture_file_.capFile(), create_new);
- connect(da_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
+ connect(da_dialog, SIGNAL(destroyed(QObject*)), mainApp, SLOT(flushAppSignals()));
da_dialog->setWindowModality(Qt::ApplicationModal);
da_dialog->setAttribute(Qt::WA_DeleteOnClose);
@@ -3740,78 +3740,78 @@ void MainWindow::on_actionToolsCredentials_triggered()
// Help Menu
void MainWindow::on_actionHelpContents_triggered() {
- wsApp->helpTopicAction(HELP_CONTENT);
+ mainApp->helpTopicAction(HELP_CONTENT);
}
void MainWindow::on_actionHelpMPWireshark_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_WIRESHARK);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_WIRESHARK);
}
void MainWindow::on_actionHelpMPWireshark_Filter_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_WIRESHARK_FILTER);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_WIRESHARK_FILTER);
}
void MainWindow::on_actionHelpMPCapinfos_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_CAPINFOS);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_CAPINFOS);
}
void MainWindow::on_actionHelpMPDumpcap_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_DUMPCAP);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_DUMPCAP);
}
void MainWindow::on_actionHelpMPEditcap_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_EDITCAP);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_EDITCAP);
}
void MainWindow::on_actionHelpMPMergecap_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_MERGECAP);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_MERGECAP);
}
void MainWindow::on_actionHelpMPRawshark_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_RAWSHARK);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_RAWSHARK);
}
void MainWindow::on_actionHelpMPReordercap_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_REORDERCAP);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_REORDERCAP);
}
void MainWindow::on_actionHelpMPText2pcap_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_TEXT2PCAP);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_TEXT2PCAP);
}
void MainWindow::on_actionHelpMPTShark_triggered() {
- wsApp->helpTopicAction(LOCALPAGE_MAN_TSHARK);
+ mainApp->helpTopicAction(LOCALPAGE_MAN_TSHARK);
}
void MainWindow::on_actionHelpWebsite_triggered() {
- wsApp->helpTopicAction(ONLINEPAGE_HOME);
+ mainApp->helpTopicAction(ONLINEPAGE_HOME);
}
void MainWindow::on_actionHelpFAQ_triggered() {
- wsApp->helpTopicAction(ONLINEPAGE_FAQ);
+ mainApp->helpTopicAction(ONLINEPAGE_FAQ);
}
void MainWindow::on_actionHelpAsk_triggered() {
- wsApp->helpTopicAction(ONLINEPAGE_ASK);
+ mainApp->helpTopicAction(ONLINEPAGE_ASK);
}
void MainWindow::on_actionHelpDownloads_triggered() {
- wsApp->helpTopicAction(ONLINEPAGE_DOWNLOAD);
+ mainApp->helpTopicAction(ONLINEPAGE_DOWNLOAD);
}
void MainWindow::on_actionHelpWiki_triggered() {
- wsApp->helpTopicAction(ONLINEPAGE_WIKI);
+ mainApp->helpTopicAction(ONLINEPAGE_WIKI);
}
void MainWindow::on_actionHelpSampleCaptures_triggered() {
- wsApp->helpTopicAction(ONLINEPAGE_SAMPLE_FILES);
+ mainApp->helpTopicAction(ONLINEPAGE_SAMPLE_FILES);
}
#ifdef HAVE_SOFTWARE_UPDATE
@@ -3842,7 +3842,7 @@ void MainWindow::on_actionGoGoToPacket_triggered() {
if (! packet_list_->model() || packet_list_->model()->rowCount() < 1) {
return;
}
- previous_focus_ = wsApp->focusWidget();
+ previous_focus_ = mainApp->focusWidget();
connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus()));
showAccordionFrame(main_ui_->goToFrame, true);
@@ -3881,14 +3881,14 @@ void MainWindow::goToConversationFrame(bool go_next) {
* coloring */
filter = conversation_filter_from_packet(pi);
if (filter == NULL) {
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Unable to build conversation filter."));
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Unable to build conversation filter."));
g_free(filter);
return;
}
if (!dfilter_compile(filter, &dfcode, NULL)) {
/* The attempt failed; report an error. */
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Error compiling filter for this conversation."));
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("Error compiling filter for this conversation."));
g_free(filter);
return;
}
@@ -3897,7 +3897,7 @@ void MainWindow::goToConversationFrame(bool go_next) {
if (!found_packet) {
/* We didn't find a packet */
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("No previous/next packet in conversation."));
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, tr("No previous/next packet in conversation."));
}
dfilter_free(dfcode);
@@ -3975,7 +3975,7 @@ void MainWindow::on_actionCaptureStart_triggered()
#ifdef HAVE_LIBPCAP
if (global_capture_opts.num_selected == 0) {
QString err_msg = tr("No Interface Selected.");
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err_msg);
+ mainApp->pushStatus(WiresharkApplication::TemporaryStatus, err_msg);
main_ui_->actionCaptureStart->setChecked(false);
return;
}
@@ -4096,7 +4096,7 @@ void MainWindow::on_actionCaptureOptions_triggered()
void MainWindow::on_actionCaptureRefreshInterfaces_triggered()
{
main_ui_->actionCaptureRefreshInterfaces->setEnabled(false);
- wsApp->refreshLocalInterfaces();
+ mainApp->refreshLocalInterfaces();
main_ui_->actionCaptureRefreshInterfaces->setEnabled(true);
}
#endif
@@ -4186,7 +4186,7 @@ void MainWindow::on_actionContextWikiProtocolPage_triggered()
const QString proto_abbrev = proto_registrar_get_abbrev(field_id);
- int ret = QMessageBox::question(this, wsApp->windowTitleString(tr("Wiki Page for %1").arg(proto_abbrev)),
+ int ret = QMessageBox::question(this, mainApp->windowTitleString(tr("Wiki Page for %1").arg(proto_abbrev)),
tr("<p>The Wireshark Wiki is maintained by the community.</p>"
"<p>The page you are about to load might be wonderful, "
"incomplete, wrong, or nonexistent.</p>"
diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp
index bf4905d1a1..afc6a8c14d 100644
--- a/ui/qt/manage_interfaces_dialog.cpp
+++ b/ui/qt/manage_interfaces_dialog.cpp
@@ -31,7 +31,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QDebug>
@@ -262,7 +262,7 @@ void ManageInterfacesDialog::on_buttonBox_accepted()
remoteAccepted();
#endif
prefs_main_write();
- wsApp->refreshLocalInterfaces();
+ mainApp->refreshLocalInterfaces();
emit ifsChanged();
}
@@ -307,7 +307,7 @@ void ManageInterfacesDialog::on_delPipe_clicked()
void ManageInterfacesDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG);
+ mainApp->helpTopicAction(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG);
}
#ifdef HAVE_PCAP_REMOTE
diff --git a/ui/qt/manager/wireshark_preference.cpp b/ui/qt/manager/wireshark_preference.cpp
index 392fe258cb..a1ca28f4d5 100644
--- a/ui/qt/manager/wireshark_preference.cpp
+++ b/ui/qt/manager/wireshark_preference.cpp
@@ -16,7 +16,7 @@
#include <ui/qt/manager/preference_manager.h>
#include <ui/qt/widgets/range_syntax_lineedit.h>
#include "ui/qt/widgets/wireshark_file_dialog.h"
-#include <ui/qt/wireshark_application.h>
+#include <ui/qt/main_application.h>
#include <ui/qt/uat_dialog.h>
#include <QDir>
@@ -191,7 +191,7 @@ public:
SaveFilePreference(QObject * parent = Q_NULLPTR) : WiresharkPreference(parent) {}
virtual QWidget * editor(QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index)
{
- QString filename = WiresharkFileDialog::getSaveFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
+ QString filename = WiresharkFileDialog::getSaveFileName(parent, mainApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
index.model()->data(index, Qt::DisplayRole).toString());
if (!filename.isEmpty()) {
const_cast<QAbstractItemModel*>(index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
@@ -207,7 +207,7 @@ public:
OpenFilePreference(QObject * parent = Q_NULLPTR) : WiresharkPreference(parent) {}
virtual QWidget * editor(QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index)
{
- QString filename = WiresharkFileDialog::getOpenFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
+ QString filename = WiresharkFileDialog::getOpenFileName(parent, mainApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
index.model()->data(index, Qt::DisplayRole).toString());
if (!filename.isEmpty()) {
const_cast<QAbstractItemModel*>(index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
@@ -223,7 +223,7 @@ public:
DirNamePreference(QObject * parent = Q_NULLPTR) : WiresharkPreference(parent) {}
virtual QWidget * editor(QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index)
{
- QString filename = WiresharkFileDialog::getExistingDirectory(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
+ QString filename = WiresharkFileDialog::getExistingDirectory(parent, mainApp->windowTitleString(prefs_get_title(prefsItem()->getPref())),
index.model()->data(index, Qt::DisplayRole).toString());
if (!filename.isEmpty()) {
const_cast<QAbstractItemModel*>(index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole);
diff --git a/ui/qt/models/dissector_tables_model.cpp b/ui/qt/models/dissector_tables_model.cpp
index 98b680a57c..0de02ab0b5 100644
--- a/ui/qt/models/dissector_tables_model.cpp
+++ b/ui/qt/models/dissector_tables_model.cpp
@@ -12,7 +12,7 @@
#include <epan/packet.h>
#include <ui/qt/utils/variant_pointer.h>
-#include "wireshark_application.h"
+#include "main_application.h"
static const char* CUSTOM_TABLE_NAME = "Custom Tables";
static const char* INTEGER_TABLE_NAME = "Integer Tables";
diff --git a/ui/qt/models/enabled_protocols_model.cpp b/ui/qt/models/enabled_protocols_model.cpp
index 0da4ec50e2..6c9b1fbaaf 100644
--- a/ui/qt/models/enabled_protocols_model.cpp
+++ b/ui/qt/models/enabled_protocols_model.cpp
@@ -14,7 +14,7 @@
#include <epan/disabled_protos.h>
#include <ui/qt/utils/variant_pointer.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QRegularExpression>
@@ -339,7 +339,7 @@ void EnabledProtocolsModel::saveChanges(bool writeChanges)
if (writeChanges) {
save_enabled_and_disabled_lists();
}
- wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->emitAppSignal(MainApplication::PacketDissectionChanged);
}
diff --git a/ui/qt/models/interface_sort_filter_model.cpp b/ui/qt/models/interface_sort_filter_model.cpp
index 8014529d51..dc68dd8727 100644
--- a/ui/qt/models/interface_sort_filter_model.cpp
+++ b/ui/qt/models/interface_sort_filter_model.cpp
@@ -18,7 +18,7 @@
#include <ui/preference_utils.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QAbstractItemModel>
@@ -51,7 +51,7 @@ void InterfaceSortFilterModel::setStoreOnChange(bool storeOnChange)
_storeOnChange = storeOnChange;
if (storeOnChange)
{
- connect(wsApp, &WiresharkApplication::preferencesChanged, this, &InterfaceSortFilterModel::resetPreferenceData);
+ connect(mainApp, &MainApplication::preferencesChanged, this, &InterfaceSortFilterModel::resetPreferenceData);
resetPreferenceData();
}
}
diff --git a/ui/qt/models/interface_tree_cache_model.cpp b/ui/qt/models/interface_tree_cache_model.cpp
index 40722aabf6..1a20753be3 100644
--- a/ui/qt/models/interface_tree_cache_model.cpp
+++ b/ui/qt/models/interface_tree_cache_model.cpp
@@ -21,7 +21,7 @@
#include "wiretap/wtap.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QIdentityProxyModel>
@@ -279,7 +279,7 @@ void InterfaceTreeCacheModel::save()
++it;
}
- wsApp->emitAppSignal(WiresharkApplication::LocalInterfacesChanged);
+ mainApp->emitAppSignal(MainApplication::LocalInterfacesChanged);
}
#endif
@@ -580,7 +580,7 @@ void InterfaceTreeCacheModel::deleteDevice(const QModelIndex &index)
capture_opts_free_interface_t(device);
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, row);
emit endRemoveRows();
- wsApp->emitAppSignal(WiresharkApplication::LocalInterfacesChanged);
+ mainApp->emitAppSignal(MainApplication::LocalInterfacesChanged);
}
}
#endif
diff --git a/ui/qt/models/interface_tree_model.cpp b/ui/qt/models/interface_tree_model.cpp
index b5cb51a53b..eeeac295ca 100644
--- a/ui/qt/models/interface_tree_model.cpp
+++ b/ui/qt/models/interface_tree_model.cpp
@@ -24,7 +24,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/utils/stock_icon.h>
-#include "wireshark_application.h"
+#include "main_application.h"
/* Needed for the meta type declaration of QList<int>* */
#include <ui/qt/models/sparkline_delegate.h>
@@ -45,8 +45,8 @@ InterfaceTreeModel::InterfaceTreeModel(QObject *parent) :
,stat_cache_(NULL)
#endif
{
- connect(wsApp, &WiresharkApplication::appInitialized, this, &InterfaceTreeModel::interfaceListChanged);
- connect(wsApp, &WiresharkApplication::localInterfaceListChanged, this, &InterfaceTreeModel::interfaceListChanged);
+ connect(mainApp, &MainApplication::appInitialized, this, &InterfaceTreeModel::interfaceListChanged);
+ connect(mainApp, &MainApplication::localInterfaceListChanged, this, &InterfaceTreeModel::interfaceListChanged);
}
InterfaceTreeModel::~InterfaceTreeModel(void)
diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp
index d44ca14401..206678b9be 100644
--- a/ui/qt/models/packet_list_model.cpp
+++ b/ui/qt/models/packet_list_model.cpp
@@ -26,7 +26,7 @@
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/main_window.h>
#include <ui/qt/main_status_bar.h>
#include <ui/qt/widgets/wireless_timeline.h>
@@ -82,9 +82,9 @@ PacketListModel::PacketListModel(QObject *parent, capture_file *cf) :
new_visible_rows_.reserve(1000);
number_to_row_.reserve(reserved_packets_);
- if (qobject_cast<MainWindow *>(wsApp->mainWindow()))
+ if (qobject_cast<MainWindow *>(mainApp->mainWindow()))
{
- MainWindow *mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
+ MainWindow *mw = qobject_cast<MainWindow *>(mainApp->mainWindow());
QWidget * wtWidget = mw->findChild<WirelessTimeline *>();
if (wtWidget && qobject_cast<WirelessTimeline *>(wtWidget))
{
@@ -358,7 +358,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
// something we can interrupt.
if (!col_title.isEmpty()) {
QString busy_msg = tr("Sorting \"%1\"…").arg(col_title);
- wsApp->pushStatus(WiresharkApplication::BusyStatus, busy_msg);
+ mainApp->pushStatus(MainApplication::BusyStatus, busy_msg);
}
busy_timer_.start();
@@ -382,7 +382,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
emit endResetModel();
if (!col_title.isEmpty()) {
- wsApp->popStatus(WiresharkApplication::BusyStatus);
+ mainApp->popStatus(MainApplication::BusyStatus);
}
if (cap_file_->current_frame) {
@@ -468,7 +468,7 @@ bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2)
if (busy_timer_.elapsed() > busy_timeout_) {
// What's the least amount of processing that we can do which will draw
// the busy indicator?
- wsApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
+ mainApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
busy_timer_.restart();
}
if (sort_column_ < 0) {
diff --git a/ui/qt/models/related_packet_delegate.cpp b/ui/qt/models/related_packet_delegate.cpp
index 01869fee9a..86156b6794 100644
--- a/ui/qt/models/related_packet_delegate.cpp
+++ b/ui/qt/models/related_packet_delegate.cpp
@@ -10,10 +10,11 @@
#include <ui/qt/models/related_packet_delegate.h>
#include "packet_list_record.h"
+#include <ui/qt/main_application.h>
+
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/main_window.h>
-#include <ui/qt/wireshark_application.h>
#include <QApplication>
#include <QPainter>
@@ -51,9 +52,9 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem
{
/* This prevents the drawing of related objects, if multiple lines are being selected */
- if (wsApp && wsApp->mainWindow())
+ if (mainApp && mainApp->mainWindow())
{
- MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
+ MainWindow * mw = qobject_cast<MainWindow *>(mainApp->mainWindow());
if (mw && mw->hasSelection())
{
QStyledItemDelegate::paint(painter, option, index);
@@ -256,9 +257,9 @@ QSize RelatedPacketDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
/* This prevents the sizeHint for the delegate, if multiple lines are being selected */
- if (wsApp && wsApp->mainWindow())
+ if (mainApp && mainApp->mainWindow())
{
- MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
+ MainWindow * mw = qobject_cast<MainWindow *>(mainApp->mainWindow());
if (mw && mw->selectedRows().count() > 1)
return QStyledItemDelegate::sizeHint(option, index);
}
diff --git a/ui/qt/module_preferences_scroll_area.cpp b/ui/qt/module_preferences_scroll_area.cpp
index f1a9303f53..adc0ef3a25 100644
--- a/ui/qt/module_preferences_scroll_area.cpp
+++ b/ui/qt/module_preferences_scroll_area.cpp
@@ -13,7 +13,7 @@
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include <ui/qt/utils/qt_ui_utils.h>
#include "uat_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/variant_pointer.h>
@@ -522,7 +522,7 @@ void ModulePreferencesScrollArea::saveFilenamePushButtonClicked()
pref_t *pref = VariantPointer<pref_t>::asPtr(filename_pb->property(pref_prop_));
if (!pref) return;
- QString filename = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(prefs_get_title(pref)),
+ QString filename = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(prefs_get_title(pref)),
prefs_get_string_value(pref, pref_stashed));
if (!filename.isEmpty()) {
@@ -539,7 +539,7 @@ void ModulePreferencesScrollArea::openFilenamePushButtonClicked()
pref_t *pref = VariantPointer<pref_t>::asPtr(filename_pb->property(pref_prop_));
if (!pref) return;
- QString filename = WiresharkFileDialog::getOpenFileName(this, wsApp->windowTitleString(prefs_get_title(pref)),
+ QString filename = WiresharkFileDialog::getOpenFileName(this, mainApp->windowTitleString(prefs_get_title(pref)),
prefs_get_string_value(pref, pref_stashed));
if (!filename.isEmpty()) {
prefs_set_string_value(pref, QDir::toNativeSeparators(filename).toStdString().c_str(), pref_stashed);
@@ -555,7 +555,7 @@ void ModulePreferencesScrollArea::dirnamePushButtonClicked()
pref_t *pref = VariantPointer<pref_t>::asPtr(dirname_pb->property(pref_prop_));
if (!pref) return;
- QString dirname = WiresharkFileDialog::getExistingDirectory(this, wsApp->windowTitleString(prefs_get_title(pref)),
+ QString dirname = WiresharkFileDialog::getExistingDirectory(this, mainApp->windowTitleString(prefs_get_title(pref)),
prefs_get_string_value(pref, pref_stashed));
if (!dirname.isEmpty()) {
diff --git a/ui/qt/multicast_statistics_dialog.cpp b/ui/qt/multicast_statistics_dialog.cpp
index 57c3499953..85a084534c 100644
--- a/ui/qt/multicast_statistics_dialog.cpp
+++ b/ui/qt/multicast_statistics_dialog.cpp
@@ -16,7 +16,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/widgets/syntax_line_edit.h>
-#include "wireshark_application.h"
+#include "main_application.h"
enum {
col_src_addr_,
@@ -464,7 +464,7 @@ multicast_statistics_init(const char *args, void*) {
if (args_l.length() > 2) {
filter = QStringList(args_l.mid(2)).join(",").toUtf8();
}
- wsApp->emitStatCommandSignal("MulticastStatistics", filter.constData(), NULL);
+ mainApp->emitStatCommandSignal("MulticastStatistics", filter.constData(), NULL);
}
static stat_tap_ui multicast_statistics_ui = {
diff --git a/ui/qt/packet_comment_dialog.cpp b/ui/qt/packet_comment_dialog.cpp
index b74bfc7c5b..d9dfc7dd45 100644
--- a/ui/qt/packet_comment_dialog.cpp
+++ b/ui/qt/packet_comment_dialog.cpp
@@ -10,7 +10,7 @@
#include "packet_comment_dialog.h"
#include <ui_packet_comment_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
PacketCommentDialog::PacketCommentDialog(bool isEdit, QWidget *parent, QString comment) :
GeometryStateDialog(parent),
@@ -23,7 +23,7 @@ PacketCommentDialog::PacketCommentDialog(bool isEdit, QWidget *parent, QString c
pc_ui_->setupUi(this);
loadGeometry();
- setWindowTitle(wsApp->windowTitleString(title));
+ setWindowTitle(mainApp->windowTitleString(title));
pc_ui_->commentTextEdit->setPlainText(comment);
}
@@ -40,5 +40,5 @@ QString PacketCommentDialog::text()
void PacketCommentDialog::on_buttonBox_helpRequested()
{
-// wsApp->helpTopicAction(HELP_PACKET_COMMENT_DIALOG);
+// mainApp->helpTopicAction(HELP_PACKET_COMMENT_DIALOG);
}
diff --git a/ui/qt/packet_diagram.cpp b/ui/qt/packet_diagram.cpp
index 3350c2c3fb..249e6f09e9 100644
--- a/ui/qt/packet_diagram.cpp
+++ b/ui/qt/packet_diagram.cpp
@@ -16,7 +16,7 @@
#include "wsutil/utf8_entities.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/main_window.h"
#include "ui/qt/utils/proto_node.h"
@@ -51,7 +51,7 @@ public:
padding_rems_(0.5),
span_mark_offset_rems_(0.2)
{
- setFont(wsApp->font());
+ setFont(mainApp->font());
}
void setFont(QFont font) {
@@ -357,8 +357,8 @@ PacketDiagram::PacketDiagram(QWidget *parent) :
// XXX Move to setMonospaceFont similar to ProtoTree
layout_->setFont(font());
- connect(wsApp, &WiresharkApplication::appInitialized, this, &PacketDiagram::connectToMainWindow);
- connect(wsApp, &WiresharkApplication::zoomRegularFont, this, &PacketDiagram::setFont);
+ connect(mainApp, &MainApplication::appInitialized, this, &PacketDiagram::connectToMainWindow);
+ connect(mainApp, &MainApplication::zoomRegularFont, this, &PacketDiagram::setFont);
resetScene();
}
@@ -490,7 +490,7 @@ void PacketDiagram::contextMenuEvent(QContextMenuEvent *event)
void PacketDiagram::connectToMainWindow()
{
- MainWindow *main_window = qobject_cast<MainWindow *>(wsApp->mainWindow());
+ MainWindow *main_window = qobject_cast<MainWindow *>(mainApp->mainWindow());
if (!main_window) {
return;
}
@@ -757,7 +757,7 @@ void PacketDiagram::showFieldsToggled(bool checked)
void PacketDiagram::saveAsTriggered()
{
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
// Gaze upon my beautiful graph with lossy artifacts!
@@ -769,7 +769,7 @@ void PacketDiagram::saveAsTriggered()
#endif
QString filter = fl.join(";;");
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Graph As…")),
path.canonicalPath(), filter, &extension);
if (file_name.length() > 0) {
@@ -796,7 +796,7 @@ void PacketDiagram::saveAsTriggered()
#endif
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
}
@@ -804,7 +804,7 @@ void PacketDiagram::saveAsTriggered()
void PacketDiagram::copyAsRasterTriggered()
{
QImage raster_diagram = exportToImage();
- wsApp->clipboard()->setImage(raster_diagram);
+ mainApp->clipboard()->setImage(raster_diagram);
}
#if defined(QT_SVG_LIB) && !defined(Q_OS_MAC) && 0
@@ -817,6 +817,6 @@ void PacketDiagram::copyAsSvgTriggered()
// It might be easier to just do "Save As" instead.
QMimeData *md = new QMimeData();
md->setData("image/svg+xml", svg_buf);
- wsApp->clipboard()->setMimeData(md);
+ mainApp->clipboard()->setMimeData(md);
}
#endif
diff --git a/ui/qt/packet_dialog.cpp b/ui/qt/packet_dialog.cpp
index 7c67051816..fac6a747df 100644
--- a/ui/qt/packet_dialog.cpp
+++ b/ui/qt/packet_dialog.cpp
@@ -23,7 +23,7 @@
#include "byte_view_tab.h"
#include "proto_tree.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/field_information.h>
#include <QTreeWidgetItemIterator>
@@ -97,7 +97,7 @@ PacketDialog::PacketDialog(QWidget &parent, CaptureFile &cf, frame_data *fdata)
}
ui->chkShowByteView->setCheckState(state);
- connect(wsApp, SIGNAL(zoomMonospaceFont(QFont)),
+ connect(mainApp, SIGNAL(zoomMonospaceFont(QFont)),
proto_tree_, SLOT(setMonospaceFont(QFont)));
connect(byte_view_tab_, SIGNAL(fieldSelected(FieldInformation *)),
@@ -135,7 +135,7 @@ void PacketDialog::captureFileClosing()
void PacketDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_NEW_PACKET_DIALOG);
+ mainApp->helpTopicAction(HELP_NEW_PACKET_DIALOG);
}
void PacketDialog::setHintText(FieldInformation * finfo)
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index ffd1a983d4..00c4d687d3 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -46,7 +46,7 @@
#include <ui/qt/widgets/overlay_scroll_bar.h>
#include "proto_tree.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/data_printer.h>
#include <ui/qt/utils/frame_information.h>
#include <ui/qt/utils/variant_pointer.h>
@@ -282,9 +282,9 @@ PacketList::PacketList(QWidget *parent) :
connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int)));
connect(packet_list_model_, SIGNAL(itemHeightChanged(const QModelIndex&)), this, SLOT(updateRowHeights(const QModelIndex&)));
- connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePacketsDontSelectCurrent()));
- connect(wsApp, SIGNAL(columnDataChanged()), this, SLOT(redrawVisiblePacketsDontSelectCurrent()));
- connect(wsApp, &WiresharkApplication::preferencesChanged, this, [=]() { setSortingEnabled(prefs.gui_packet_list_sortable); });
+ connect(mainApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePacketsDontSelectCurrent()));
+ connect(mainApp, SIGNAL(columnDataChanged()), this, SLOT(redrawVisiblePacketsDontSelectCurrent()));
+ connect(mainApp, &MainApplication::preferencesChanged, this, [=]() { setSortingEnabled(prefs.gui_packet_list_sortable); });
connect(header(), SIGNAL(sectionResized(int,int,int)),
this, SLOT(sectionResized(int,int,int)));
@@ -749,7 +749,7 @@ void PacketList::ctxDecodeAsDialog()
bool create_new = da_action->property("create_new").toBool();
DecodeAsDialog *da_dialog = new DecodeAsDialog(this, cap_file_, create_new);
- connect(da_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
+ connect(da_dialog, SIGNAL(destroyed(QObject*)), mainApp, SLOT(flushAppSignals()));
da_dialog->setWindowModality(Qt::ApplicationModal);
da_dialog->setAttribute(Qt::WA_DeleteOnClose);
da_dialog->show();
@@ -929,7 +929,7 @@ void PacketList::keyPressEvent(QKeyEvent *event)
}
if (content.count() > 0)
- wsApp->clipboard()->setText(content.join('\n'), QClipboard::Clipboard);
+ mainApp->clipboard()->setText(content.join('\n'), QClipboard::Clipboard);
}
}
@@ -978,7 +978,7 @@ void PacketList::setRecentColumnWidth(int col)
int fmt = get_column_format(col);
const char *long_str = get_column_width_string(fmt, col);
- QFontMetrics fm = QFontMetrics(wsApp->monospaceFont());
+ QFontMetrics fm = QFontMetrics(mainApp->monospaceFont());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
if (long_str) {
col_width = fm.horizontalAdvance(long_str);
@@ -1569,7 +1569,7 @@ void PacketList::setCaptureFile(capture_file *cf)
void PacketList::setMonospaceFont(const QFont &mono_font)
{
setFont(mono_font);
- header()->setFont(wsApp->font());
+ header()->setFont(mainApp->font());
}
void PacketList::goNextPacket(void)
@@ -1864,7 +1864,7 @@ void PacketList::sectionMoved(int logicalIndex, int oldVisualIndex, int newVisua
prefs_main_write();
- wsApp->emitAppSignal(WiresharkApplication::ColumnsChanged);
+ mainApp->emitAppSignal(MainApplication::ColumnsChanged);
// If the column with the sort indicator got shifted, mark the new column
// after updating the columns contents (via ColumnsChanged) to ensure that
@@ -1938,7 +1938,7 @@ void PacketList::copySummary()
QString copy_text = createSummaryText(currentIndex(), copy_type);
- wsApp->clipboard()->setText(copy_text);
+ mainApp->clipboard()->setText(copy_text);
}
// We need to tell when the user has scrolled the packet list, either to
@@ -1987,7 +1987,7 @@ void PacketList::drawNearOverlay()
qreal dp_ratio = overlay_sb_->devicePixelRatio();
int o_height = overlay_sb_->height() * dp_ratio;
int o_rows = qMin(packet_list_model_->rowCount(), o_height);
- QFontMetricsF fmf(wsApp->font());
+ QFontMetricsF fmf(mainApp->font());
int o_width = ((static_cast<int>(fmf.height())) * 2 * dp_ratio) + 2; // 2ems + 1-pixel border on either side.
if (recent.packet_list_colorize && o_rows > 0) {
diff --git a/ui/qt/preference_editor_frame.cpp b/ui/qt/preference_editor_frame.cpp
index c34f97b92d..9552c48ac3 100644
--- a/ui/qt/preference_editor_frame.cpp
+++ b/ui/qt/preference_editor_frame.cpp
@@ -25,7 +25,7 @@
#include <ui/qt/widgets/wireshark_file_dialog.h>
#include <wsutil/utf8_entities.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QPushButton>
#include <QKeyEvent>
@@ -148,7 +148,7 @@ void PreferenceEditorFrame::stringLineEditTextEdited(const QString &new_str)
void PreferenceEditorFrame::browsePushButtonClicked()
{
- QString caption = wsApp->windowTitleString(prefs_get_title(pref_));
+ QString caption = mainApp->windowTitleString(prefs_get_title(pref_));
QString dir = prefs_get_string_value(pref_, pref_stashed);
QString filename;
@@ -259,10 +259,10 @@ void PreferenceEditorFrame::on_buttonBox_accepted()
// Emit signals once UI is hidden
if (apply) {
if (changed_flags & PREF_EFFECT_FIELDS) {
- wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
+ mainApp->emitAppSignal(MainApplication::FieldsChanged);
}
- wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
- wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
+ mainApp->emitAppSignal(MainApplication::PacketDissectionChanged);
+ mainApp->emitAppSignal(MainApplication::PreferencesChanged);
}
}
@@ -284,7 +284,7 @@ void PreferenceEditorFrame::keyPressEvent(QKeyEvent *event)
if (ui->buttonBox->button(QDialogButtonBox::Ok)->isEnabled()) {
on_buttonBox_accepted();
} else if (ui->preferenceLineEdit->syntaxState() == SyntaxLineEdit::Invalid) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, tr("Invalid value."));
+ mainApp->pushStatus(MainApplication::FilterSyntax, tr("Invalid value."));
}
}
}
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index 7e36452769..bebf245b2d 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -24,7 +24,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
extern "C" {
// Callbacks prefs routines
@@ -101,7 +101,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) :
pd_ui_->setupUi(this);
loadGeometry();
- setWindowTitle(wsApp->windowTitleString(tr("Preferences")));
+ setWindowTitle(mainApp->windowTitleString(tr("Preferences")));
pd_ui_->advancedView->setModel(&advancedPrefsModel_);
pd_ui_->advancedView->setItemDelegate(&advancedPrefsDelegate_);
@@ -252,7 +252,7 @@ void PreferencesDialog::on_buttonBox_accepted()
//Filter expressions don't affect dissection, so there is no need to
//send any events to that effect. However, the app needs to know
//about any button changes.
- wsApp->emitAppSignal(WiresharkApplication::FilterExpressionsChanged);
+ mainApp->emitAppSignal(MainApplication::FilterExpressionsChanged);
prefs_main_write();
if (save_decode_as_entries(&err) < 0)
@@ -262,7 +262,7 @@ void PreferencesDialog::on_buttonBox_accepted()
}
write_language_prefs();
- wsApp->loadLanguage(QString(language));
+ mainApp->loadLanguage(QString(language));
#ifdef HAVE_AIRPCAP
/*
@@ -287,24 +287,24 @@ void PreferencesDialog::on_buttonBox_accepted()
// prefs_airpcap_update();
#endif
- wsApp->setMonospaceFont(prefs.gui_qt_font_name);
+ mainApp->setMonospaceFont(prefs.gui_qt_font_name);
if (redissect_flags & PREF_EFFECT_FIELDS) {
- wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
+ mainApp->queueAppSignal(MainApplication::FieldsChanged);
}
if (redissect_flags & PREF_EFFECT_DISSECTION) {
/* Redissect all the packets, and re-evaluate the display filter. */
- wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->queueAppSignal(MainApplication::PacketDissectionChanged);
}
- wsApp->queueAppSignal(WiresharkApplication::PreferencesChanged);
+ mainApp->queueAppSignal(MainApplication::PreferencesChanged);
if (redissect_flags & PREF_EFFECT_GUI_LAYOUT) {
- wsApp->queueAppSignal(WiresharkApplication::RecentPreferencesRead);
+ mainApp->queueAppSignal(MainApplication::RecentPreferencesRead);
}
if (prefs.capture_no_extcap != saved_capture_no_extcap_)
- wsApp->refreshLocalInterfaces();
+ mainApp->refreshLocalInterfaces();
}
void PreferencesDialog::on_buttonBox_rejected()
@@ -319,5 +319,5 @@ void PreferencesDialog::on_buttonBox_rejected()
void PreferencesDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_PREFERENCES_DIALOG);
+ mainApp->helpTopicAction(HELP_PREFERENCES_DIALOG);
}
diff --git a/ui/qt/print_dialog.cpp b/ui/qt/print_dialog.cpp
index 071badf4ac..84c2d90656 100644
--- a/ui/qt/print_dialog.cpp
+++ b/ui/qt/print_dialog.cpp
@@ -25,7 +25,7 @@
#include <QKeyEvent>
#include <QMessageBox>
-#include "wireshark_application.h"
+#include "main_application.h"
extern "C" {
@@ -78,7 +78,7 @@ PrintDialog::PrintDialog(QWidget *parent, capture_file *cf, QString selRange) :
Q_ASSERT(cf);
pd_ui_->setupUi(this);
- setWindowTitle(wsApp->windowTitleString(tr("Print")));
+ setWindowTitle(mainApp->windowTitleString(tr("Print")));
pd_ui_->previewLayout->insertWidget(0, preview_, Qt::AlignTop);
@@ -88,7 +88,7 @@ PrintDialog::PrintDialog(QWidget *parent, capture_file *cf, QString selRange) :
// XXX Make these configurable
header_font_.setFamily("Times");
header_font_.setPointSizeF(header_font_.pointSizeF() * 0.8);
- packet_font_ = wsApp->monospaceFont();
+ packet_font_ = mainApp->monospaceFont();
packet_font_.setPointSizeF(packet_font_.pointSizeF() * 0.8);
memset(&print_args_, 0, sizeof(print_args_));
@@ -317,7 +317,7 @@ void PrintDialog::checkValidity()
void PrintDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_PRINT_DIALOG);
+ mainApp->helpTopicAction(HELP_PRINT_DIALOG);
}
void PrintDialog::on_buttonBox_clicked(QAbstractButton *button)
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index e33e73ddc0..81fbddb133 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -25,7 +25,7 @@
#include "profile_dialog.h"
#include <ui_profile_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/simple_dialog.h>
@@ -58,7 +58,7 @@ ProfileDialog::ProfileDialog(QWidget *parent) :
{
pd_ui_->setupUi(this);
loadGeometry();
- setWindowTitle(wsApp->windowTitleString(tr("Configuration Profiles")));
+ setWindowTitle(mainApp->windowTitleString(tr("Configuration Profiles")));
ok_button_ = pd_ui_->buttonBox->button(QDialogButtonBox::Ok);
@@ -180,7 +180,7 @@ int ProfileDialog::execAction(ProfileDialog::ProfileAction profile_action)
break;
case DeleteCurrentProfile:
if (delete_current_profile()) {
- wsApp->setConfigurationProfile (Q_NULLPTR);
+ mainApp->setConfigurationProfile (Q_NULLPTR);
}
break;
}
@@ -477,7 +477,7 @@ void ProfileDialog::on_buttonBox_accepted()
if (write_recent) {
/* Get the current geometry, before writing it to disk */
- wsApp->emitAppSignal(WiresharkApplication::ProfileChanging);
+ mainApp->emitAppSignal(MainApplication::ProfileChanging);
/* Write recent file for current profile now because
* the profile may be renamed in apply_profile_changes() */
@@ -513,11 +513,11 @@ void ProfileDialog::on_buttonBox_accepted()
if (profileName.length() > 0 && model_->findByName(profileName) >= 0) {
// The new profile exists, change.
- wsApp->setConfigurationProfile (profileName.toUtf8().constData(), FALSE);
+ mainApp->setConfigurationProfile (profileName.toUtf8().constData(), FALSE);
} else if (!model_->activeProfile().isValid()) {
// The new profile does not exist, and the previous profile has
// been deleted. Change to the default profile.
- wsApp->setConfigurationProfile (Q_NULLPTR, FALSE);
+ mainApp->setConfigurationProfile (Q_NULLPTR, FALSE);
}
}
@@ -530,7 +530,7 @@ void ProfileDialog::on_buttonBox_rejected()
void ProfileDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_CONFIG_PROFILES_DIALOG);
+ mainApp->helpTopicAction(HELP_CONFIG_PROFILES_DIALOG);
}
void ProfileDialog::dataChanged(const QModelIndex &)
@@ -734,8 +734,8 @@ QString ProfileDialog::lastOpenDir()
void ProfileDialog::storeLastDir(QString dir)
{
- if (wsApp && dir.length() > 0)
- wsApp->setLastOpenDir(qUtf8Printable(dir));
+ if (mainApp && dir.length() > 0)
+ mainApp->setLastOpenDir(qUtf8Printable(dir));
}
void ProfileDialog::resetTreeView()
diff --git a/ui/qt/progress_frame.cpp b/ui/qt/progress_frame.cpp
index 9ab7d3e5fa..24d49bd688 100644
--- a/ui/qt/progress_frame.cpp
+++ b/ui/qt/progress_frame.cpp
@@ -20,7 +20,7 @@
#include <QPropertyAnimation>
#include <ui/qt/widgets/stock_icon_tool_button.h>
-#include "wireshark_application.h"
+#include "main_application.h"
// To do:
// - Add an NSProgressIndicator to the dock icon on macOS.
@@ -79,7 +79,7 @@ update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *)
/*
* Flush out the update and process any input events.
*/
- WiresharkApplication::processEvents();
+ MainApplication::processEvents();
}
/*
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index abf14b08d9..05ff209f15 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -28,7 +28,7 @@
#include <ui/all_files_wildcard.h>
#include <ui/alert_box.h>
#include <ui/urls.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QApplication>
#include <QContextMenuEvent>
@@ -92,7 +92,7 @@ ProtoTree::ProtoTree(QWidget *parent, epan_dissect_t *edt_fixed) :
connect(verticalScrollBar(), SIGNAL(sliderReleased()),
this, SLOT(updateContentWidth()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
viewport()->installEventFilter(this);
}
@@ -104,11 +104,11 @@ void ProtoTree::clear() {
void ProtoTree::connectToMainWindow()
{
- if (wsApp->mainWindow())
+ if (mainApp->mainWindow())
{
- connect(wsApp->mainWindow(), SIGNAL(fieldSelected(FieldInformation *)),
+ connect(mainApp->mainWindow(), SIGNAL(fieldSelected(FieldInformation *)),
this, SLOT(selectedFieldChanged(FieldInformation *)));
- connect(wsApp->mainWindow(), SIGNAL(framesSelected(QList<int>)),
+ connect(mainApp->mainWindow(), SIGNAL(framesSelected(QList<int>)),
this, SLOT(selectedFrameChanged(QList<int>)));
}
}
@@ -128,7 +128,7 @@ void ProtoTree::ctxCopyVisibleItems()
clip = toString();
if (clip.length() > 0)
- wsApp->clipboard()->setText(clip);
+ mainApp->clipboard()->setText(clip);
}
void ProtoTree::ctxCopyAsFilter()
@@ -143,7 +143,7 @@ void ProtoTree::ctxCopyAsFilter()
wmem_free(Q_NULLPTR, field_filter);
if (filter.length() > 0)
- wsApp->clipboard()->setText(filter);
+ mainApp->clipboard()->setText(filter);
}
}
@@ -183,7 +183,7 @@ void ProtoTree::ctxCopySelectedInfo()
}
if (clip.length() > 0)
- wsApp->clipboard()->setText(clip);
+ mainApp->clipboard()->setText(clip);
}
void ProtoTree::ctxOpenUrlWiki()
@@ -204,7 +204,7 @@ void ProtoTree::ctxOpenUrlWiki()
if (! is_field_reference)
{
- int ret = QMessageBox::question(this, wsApp->windowTitleString(tr("Wiki Page for %1").arg(proto_abbrev)),
+ int ret = QMessageBox::question(this, mainApp->windowTitleString(tr("Wiki Page for %1").arg(proto_abbrev)),
tr("<p>The Wireshark Wiki is maintained by the community.</p>"
"<p>The page you are about to load might be wonderful, "
"incomplete, wrong, or nonexistent.</p>"
@@ -628,14 +628,14 @@ void ProtoTree::itemDoubleClicked(const QModelIndex &index)
if (QApplication::queryKeyboardModifiers() & Qt::ShiftModifier) {
emit openPacketInNewWindow(true);
} else {
- wsApp->gotoFrame(finfo.fieldInfo()->value.value.uinteger);
+ mainApp->gotoFrame(finfo.fieldInfo()->value.value.uinteger);
}
} else {
QString url = finfo.url();
if (!url.isEmpty()) {
QApplication::clipboard()->setText(url);
QString push_msg = tr("Copied ") + url;
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, push_msg);
+ mainApp->pushStatus(MainApplication::TemporaryStatus, push_msg);
}
}
}
diff --git a/ui/qt/protocol_hierarchy_dialog.cpp b/ui/qt/protocol_hierarchy_dialog.cpp
index f6af0f39bc..cd8d38e850 100644
--- a/ui/qt/protocol_hierarchy_dialog.cpp
+++ b/ui/qt/protocol_hierarchy_dialog.cpp
@@ -19,7 +19,7 @@
#include <wsutil/utf8_entities.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QClipboard>
#include <QPushButton>
@@ -343,7 +343,7 @@ void ProtocolHierarchyDialog::on_actionCopyAsCsv_triggered()
if (!first) ++iter;
first = false;
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
void ProtocolHierarchyDialog::on_actionCopyAsYaml_triggered()
@@ -364,10 +364,10 @@ void ProtocolHierarchyDialog::on_actionCopyAsYaml_triggered()
if (!first) ++iter;
first = false;
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
void ProtocolHierarchyDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_STATS_PROTO_HIERARCHY_DIALOG);
+ mainApp->helpTopicAction(HELP_STATS_PROTO_HIERARCHY_DIALOG);
}
diff --git a/ui/qt/protocol_preferences_menu.cpp b/ui/qt/protocol_preferences_menu.cpp
index 14c2ddbe88..b2d80676a4 100644
--- a/ui/qt/protocol_preferences_menu.cpp
+++ b/ui/qt/protocol_preferences_menu.cpp
@@ -25,7 +25,7 @@
#include <ui/qt/models/enabled_protocols_model.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include "uat_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QActionGroup>
@@ -91,7 +91,7 @@ public:
void showUatDialog() {
UatDialog *uat_dlg = new UatDialog(parentWidget(), prefs_get_uat_value(pref_));
- connect(uat_dlg, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
+ connect(uat_dlg, SIGNAL(destroyed(QObject*)), mainApp, SLOT(flushAppSignals()));
uat_dlg->setWindowModality(Qt::ApplicationModal);
uat_dlg->setAttribute(Qt::WA_DeleteOnClose);
uat_dlg->show();
@@ -303,11 +303,11 @@ void ProtocolPreferencesMenu::boolPreferenceTriggered()
commandline_options_drop(module_->name, prefs_get_name(bpa->getPref()));
if (changed_flags & PREF_EFFECT_FIELDS) {
- wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
+ mainApp->emitAppSignal(MainApplication::FieldsChanged);
}
/* Protocol preference changes almost always affect dissection,
so don't bother checking flags */
- wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->emitAppSignal(MainApplication::PacketDissectionChanged);
}
void ProtocolPreferencesMenu::enumPreferenceTriggered()
@@ -323,11 +323,11 @@ void ProtocolPreferencesMenu::enumPreferenceTriggered()
commandline_options_drop(module_->name, prefs_get_name(epa->getPref()));
if (changed_flags & PREF_EFFECT_FIELDS) {
- wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
+ mainApp->emitAppSignal(MainApplication::FieldsChanged);
}
/* Protocol preference changes almost always affect dissection,
so don't bother checking flags */
- wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->emitAppSignal(MainApplication::PacketDissectionChanged);
}
}
diff --git a/ui/qt/resolved_addresses_dialog.cpp b/ui/qt/resolved_addresses_dialog.cpp
index e6d8c20f77..383272251c 100644
--- a/ui/qt/resolved_addresses_dialog.cpp
+++ b/ui/qt/resolved_addresses_dialog.cpp
@@ -25,7 +25,7 @@
#include <QSortFilterProxyModel>
#include "capture_file.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/models/astringlist_list_model.h>
#include <ui/qt/models/resolved_addresses_models.h>
@@ -47,9 +47,9 @@ ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, QString captur
file_name_ = captureFile;
title_parts << file_name_;
}
- setWindowTitle(wsApp->windowTitleString(title_parts));
+ setWindowTitle(mainApp->windowTitleString(title_parts));
- ui->plainTextEdit->setFont(wsApp->monospaceFont());
+ ui->plainTextEdit->setFont(mainApp->monospaceFont());
ui->plainTextEdit->setReadOnly(true);
ui->plainTextEdit->setWordWrapMode(QTextOption::NoWrap);
diff --git a/ui/qt/response_time_delay_dialog.cpp b/ui/qt/response_time_delay_dialog.cpp
index e5e548900a..d7618ba456 100644
--- a/ui/qt/response_time_delay_dialog.cpp
+++ b/ui/qt/response_time_delay_dialog.cpp
@@ -17,7 +17,7 @@
#include <QTreeWidget>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
static QHash<const QString, register_rtd_t *> cfg_str_to_rtd_;
@@ -31,7 +31,7 @@ rtd_init(const char *args, void*) {
if (args_l.length() > 2) {
filter = QStringList(args_l.mid(2)).join(",");
}
- wsApp->emitTapParameterSignal(rtd, filter, NULL);
+ mainApp->emitTapParameterSignal(rtd, filter, NULL);
}
}
}
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index 0e7ef34a40..f66dc33d7e 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -43,7 +43,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include "rtp_player_dialog.h"
#include <ui/qt/utils/stock_icon.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
/*
@@ -616,7 +616,7 @@ void RtpAnalysisDialog::on_actionSaveGraph_triggered()
ui->tabWidget->setCurrentWidget(ui->graphTab);
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString pdf_filter = tr("Portable Document Format (*.pdf)");
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
@@ -632,7 +632,7 @@ void RtpAnalysisDialog::on_actionSaveGraph_triggered()
if (!file_closed_) {
save_file += QString("/%1").arg(cap_file_.fileBaseName());
}
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Graph As…")),
save_file, filter, &extension);
if (!file_name.isEmpty()) {
@@ -651,14 +651,14 @@ void RtpAnalysisDialog::on_actionSaveGraph_triggered()
// ui->streamGraph->legend->setVisible(false);
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
}
void RtpAnalysisDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG);
+ mainApp->helpTopicAction(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG);
}
void RtpAnalysisDialog::tapReset(void *tapinfo_ptr)
@@ -898,7 +898,7 @@ void RtpAnalysisDialog::saveCsv(RtpAnalysisDialog::StreamDirection direction)
}
QString file_path = WiresharkFileDialog::getSaveFileName(
- this, caption, wsApp->lastOpenDir().absoluteFilePath("RTP Packet Data.csv"),
+ this, caption, mainApp->lastOpenDir().absoluteFilePath("RTP Packet Data.csv"),
tr("Comma-separated values (*.csv)"));
if (file_path.isEmpty()) return;
diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp
index c910d04a4f..7aa37c5157 100644
--- a/ui/qt/rtp_player_dialog.cpp
+++ b/ui/qt/rtp_player_dialog.cpp
@@ -35,7 +35,7 @@
#include "rtp_audio_stream.h"
#include <ui/qt/utils/tango_colors.h>
#include <widgets/rtp_audio_graph.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include <QAudio>
@@ -55,7 +55,7 @@
#include <QToolButton>
#include <ui/qt/utils/stock_icon.h>
-#include "wireshark_application.h"
+#include "main_application.h"
// To do:
// - Threaded decoding?
@@ -172,7 +172,7 @@ RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_
{
ui->setupUi(this);
loadGeometry(parent.width(), parent.height());
- setWindowTitle(wsApp->windowTitleString(tr("RTP Player")));
+ setWindowTitle(mainApp->windowTitleString(tr("RTP Player")));
ui->streamTreeWidget->installEventFilter(this);
ui->audioPlot->installEventFilter(this);
installEventFilter(this);
@@ -419,7 +419,7 @@ void RtpPlayerDialog::retapPackets()
}
lockUI();
ui->hintLabel->setText("<i><small>" + tr("Decoding streams...") + "</i></small>");
- wsApp->processEvents();
+ mainApp->processEvents();
// Clear packets from existing streams before retap
for (int row = 0; row < ui->streamTreeWidget->topLevelItemCount(); row++) {
@@ -463,7 +463,7 @@ void RtpPlayerDialog::rescanPackets(bool rescale_axes)
// Show information for a user - it can last long time...
playback_error_.clear();
ui->hintLabel->setText("<i><small>" + tr("Decoding streams...") + "</i></small>");
- wsApp->processEvents();
+ mainApp->processEvents();
QAudioDeviceInfo cur_out_device = getCurrentDeviceInfo();
int row_count = ui->streamTreeWidget->topLevelItemCount();
@@ -580,7 +580,7 @@ void RtpPlayerDialog::createPlot(bool rescale_axes)
// Sequence numbers
QCPGraph *seq_graph = ui->audioPlot->addGraph();
seq_graph->setLineStyle(QCPGraph::lsNone);
- seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssSquare, tango_aluminium_6, Qt::white, wsApp->font().pointSize())); // Arbitrary
+ seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssSquare, tango_aluminium_6, Qt::white, mainApp->font().pointSize())); // Arbitrary
seq_graph->setSelectable(QCP::stNone);
seq_graph->setData(audio_stream->outOfSequenceTimestamps(relative_timestamps), audio_stream->outOfSequenceSamples(y_offset));
ti->setData(graph_sequence_data_col_, Qt::UserRole, QVariant::fromValue<QCPGraph *>(seq_graph));
@@ -596,7 +596,7 @@ void RtpPlayerDialog::createPlot(bool rescale_axes)
// Jitter drops
QCPGraph *seq_graph = ui->audioPlot->addGraph();
seq_graph->setLineStyle(QCPGraph::lsNone);
- seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, tango_scarlet_red_5, Qt::white, wsApp->font().pointSize())); // Arbitrary
+ seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, tango_scarlet_red_5, Qt::white, mainApp->font().pointSize())); // Arbitrary
seq_graph->setSelectable(QCP::stNone);
seq_graph->setData(audio_stream->jitterDroppedTimestamps(relative_timestamps), audio_stream->jitterDroppedSamples(y_offset));
ti->setData(graph_jitter_data_col_, Qt::UserRole, QVariant::fromValue<QCPGraph *>(seq_graph));
@@ -612,7 +612,7 @@ void RtpPlayerDialog::createPlot(bool rescale_axes)
// Wrong timestamps
QCPGraph *seq_graph = ui->audioPlot->addGraph();
seq_graph->setLineStyle(QCPGraph::lsNone);
- seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDiamond, tango_sky_blue_5, Qt::white, wsApp->font().pointSize())); // Arbitrary
+ seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDiamond, tango_sky_blue_5, Qt::white, mainApp->font().pointSize())); // Arbitrary
seq_graph->setSelectable(QCP::stNone);
seq_graph->setData(audio_stream->wrongTimestampTimestamps(relative_timestamps), audio_stream->wrongTimestampSamples(y_offset));
ti->setData(graph_timestamp_data_col_, Qt::UserRole, QVariant::fromValue<QCPGraph *>(seq_graph));
@@ -628,7 +628,7 @@ void RtpPlayerDialog::createPlot(bool rescale_axes)
// Inserted silence
QCPGraph *seq_graph = ui->audioPlot->addGraph();
seq_graph->setLineStyle(QCPGraph::lsNone);
- seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssTriangle, tango_butter_5, Qt::white, wsApp->font().pointSize())); // Arbitrary
+ seq_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssTriangle, tango_butter_5, Qt::white, mainApp->font().pointSize())); // Arbitrary
seq_graph->setSelectable(QCP::stNone);
seq_graph->setData(audio_stream->insertedSilenceTimestamps(relative_timestamps), audio_stream->insertedSilenceSamples(y_offset));
ti->setData(graph_silence_data_col_, Qt::UserRole, QVariant::fromValue<QCPGraph *>(seq_graph));
@@ -1344,7 +1344,7 @@ void RtpPlayerDialog::on_playButton_clicked()
double start_time;
ui->hintLabel->setText("<i><small>" + tr("Preparing to play...") + "</i></small>");
- wsApp->processEvents();
+ mainApp->processEvents();
ui->pauseButton->setChecked(false);
// Protect start time against move of marker during the play
@@ -1944,7 +1944,7 @@ void RtpPlayerDialog::on_todCheckBox_toggled(bool)
void RtpPlayerDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_TELEPHONY_RTP_PLAYER_DIALOG);
+ mainApp->helpTopicAction(HELP_TELEPHONY_RTP_PLAYER_DIALOG);
}
double RtpPlayerDialog::getStartPlayMarker()
@@ -2296,7 +2296,7 @@ save_audio_t RtpPlayerDialog::selectFileAudioFormatAndName(QString *file_path)
QString sel_filter;
*file_path = WiresharkFileDialog::getSaveFileName(
- this, tr("Save audio"), wsApp->lastOpenDir().absoluteFilePath(""),
+ this, tr("Save audio"), mainApp->lastOpenDir().absoluteFilePath(""),
ext_filter, &sel_filter);
if (file_path->isEmpty()) return save_audio_none;
@@ -2319,7 +2319,7 @@ save_payload_t RtpPlayerDialog::selectFilePayloadFormatAndName(QString *file_pat
QString sel_filter;
*file_path = WiresharkFileDialog::getSaveFileName(
- this, tr("Save payload"), wsApp->lastOpenDir().absoluteFilePath(""),
+ this, tr("Save payload"), mainApp->lastOpenDir().absoluteFilePath(""),
ext_filter, &sel_filter);
if (file_path->isEmpty()) return save_payload_none;
diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp
index 3e696e4832..c7ab2229de 100644
--- a/ui/qt/rtp_stream_dialog.cpp
+++ b/ui/qt/rtp_stream_dialog.cpp
@@ -19,7 +19,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include "rtp_analysis_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include <QAction>
@@ -713,7 +713,7 @@ void RtpStreamDialog::on_actionCopyAsCsv_triggered()
}
stream << rdsl.join(",") << '\n';
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
void RtpStreamDialog::on_actionCopyAsYaml_triggered()
@@ -727,7 +727,7 @@ void RtpStreamDialog::on_actionCopyAsYaml_triggered()
stream << " - " << v.toString() << '\n';
}
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
void RtpStreamDialog::on_actionExportAsRtpDump_triggered()
@@ -740,10 +740,10 @@ void RtpStreamDialog::on_actionExportAsRtpDump_triggered()
rtpstream_info_t *stream_info = rsti->streamInfo();
if (stream_info) {
QString file_name;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString save_file = path.canonicalPath() + "/" + cap_file_.fileBaseName();
QString extension;
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save RTPDump As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save RTPDump As…")),
save_file, "RTPDump Format (*.rtpdump)", &extension);
if (file_name.length() > 0) {
@@ -752,7 +752,7 @@ void RtpStreamDialog::on_actionExportAsRtpDump_triggered()
g_free(dest_file);
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
@@ -891,7 +891,7 @@ void RtpStreamDialog::on_streamTreeWidget_itemSelectionChanged()
void RtpStreamDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_TELEPHONY_RTP_STREAMS_DIALOG);
+ mainApp->helpTopicAction(HELP_TELEPHONY_RTP_STREAMS_DIALOG);
}
void RtpStreamDialog::on_displayFilterCheckBox_toggled(bool checked _U_)
diff --git a/ui/qt/sctp_all_assocs_dialog.cpp b/ui/qt/sctp_all_assocs_dialog.cpp
index 8bd39b738e..c5bf9e985d 100644
--- a/ui/qt/sctp_all_assocs_dialog.cpp
+++ b/ui/qt/sctp_all_assocs_dialog.cpp
@@ -12,7 +12,7 @@
#include "sctp_assoc_analyse_dialog.h"
#include <ui/qt/utils/qt_ui_utils.h>
-//#include "wireshark_application.h"
+//#include "main_application.h"
#include "file.h"
#include "ui/qt/main_window.h"
diff --git a/ui/qt/sctp_chunk_statistics_dialog.cpp b/ui/qt/sctp_chunk_statistics_dialog.cpp
index e2e5003e84..959f898e08 100644
--- a/ui/qt/sctp_chunk_statistics_dialog.cpp
+++ b/ui/qt/sctp_chunk_statistics_dialog.cpp
@@ -308,7 +308,7 @@ void SCTPChunkStatisticsDialog::on_actionChunkTypePreferences_triggered()
uatdialog->exec();
// Emitting PacketDissectionChanged directly from a QDialog can cause
// problems on macOS.
- wsApp->flushAppSignals();
+ mainApp->flushAppSignals();
ui->tableWidget->clear();
ui->tableWidget->setRowCount(0);
diff --git a/ui/qt/sctp_graph_dialog.cpp b/ui/qt/sctp_graph_dialog.cpp
index fd609cc5da..8744d1b1c8 100644
--- a/ui/qt/sctp_graph_dialog.cpp
+++ b/ui/qt/sctp_graph_dialog.cpp
@@ -25,7 +25,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/widgets/qcustomplot.h>
#include "ui/qt/widgets/wireshark_file_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
SCTPGraphDialog::SCTPGraphDialog(QWidget *parent, const sctp_assoc_info_t *assoc,
capture_file *cf, int dir) :
@@ -478,7 +478,7 @@ void SCTPGraphDialog::graphClicked(QCPAbstractPlottable* plottable, int, QMouseE
void SCTPGraphDialog::save_graph(QDialog *dlg, QCustomPlot *plot)
{
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString pdf_filter = tr("Portable Document Format (*.pdf)");
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
@@ -490,7 +490,7 @@ void SCTPGraphDialog::save_graph(QDialog *dlg, QCustomPlot *plot)
.arg(bmp_filter)
.arg(jpeg_filter);
- file_name = WiresharkFileDialog::getSaveFileName(dlg, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(dlg, mainApp->windowTitleString(tr("Save Graph As…")),
path.canonicalPath(), filter, &extension);
if (file_name.length() > 0) {
@@ -506,7 +506,7 @@ void SCTPGraphDialog::save_graph(QDialog *dlg, QCustomPlot *plot)
}
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
}
diff --git a/ui/qt/search_frame.cpp b/ui/qt/search_frame.cpp
index db598f93d6..16c349f134 100644
--- a/ui/qt/search_frame.cpp
+++ b/ui/qt/search_frame.cpp
@@ -18,7 +18,7 @@
#include <wsutil/utf8_entities.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QKeyEvent>
#include <QCheckBox>
@@ -347,7 +347,7 @@ void SearchFrame::on_searchTypeComboBox_currentIndexChanged(int idx)
sf_ui_->searchLineEdit->checkFilter();
} else {
sf_ui_->searchLineEdit->setToolTip(QString());
- wsApp->popStatus(WiresharkApplication::FilterSyntax);
+ mainApp->popStatus(MainApplication::FilterSyntax);
}
updateWidgets();
@@ -448,8 +448,8 @@ void SearchFrame::on_findButton_clicked()
g_free(cap_file_->sfilter);
cap_file_->sfilter = g_strdup(sf_ui_->searchLineEdit->text().toUtf8().constData());
- wsApp->popStatus(WiresharkApplication::FileStatus);
- wsApp->pushStatus(WiresharkApplication::FileStatus, tr("Searching for %1…").arg(sf_ui_->searchLineEdit->text()));
+ mainApp->popStatus(MainApplication::FileStatus);
+ mainApp->pushStatus(MainApplication::FileStatus, tr("Searching for %1…").arg(sf_ui_->searchLineEdit->text()));
if (cap_file_->hex) {
/* Hex value in packet data */
@@ -502,15 +502,15 @@ void SearchFrame::on_findButton_clicked()
}
search_done:
- wsApp->popStatus(WiresharkApplication::FileStatus);
+ mainApp->popStatus(MainApplication::FileStatus);
if (!err_string.isEmpty()) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
+ mainApp->pushStatus(MainApplication::FilterSyntax, err_string);
}
}
void SearchFrame::on_cancelButton_clicked()
{
- wsApp->popStatus(WiresharkApplication::FilterSyntax);
+ mainApp->popStatus(MainApplication::FilterSyntax);
animatedHide();
}
diff --git a/ui/qt/sequence_dialog.cpp b/ui/qt/sequence_dialog.cpp
index 5a469b0a5b..073ab98c0a 100644
--- a/ui/qt/sequence_dialog.cpp
+++ b/ui/qt/sequence_dialog.cpp
@@ -23,7 +23,7 @@
#include "progress_frame.h"
#include <ui/qt/utils/qt_ui_utils.h>
#include "sequence_diagram.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/utils/variant_pointer.h>
#include <ui/alert_box.h>
#include "ui/qt/widgets/wireshark_file_dialog.h"
@@ -436,7 +436,7 @@ void SequenceDialog::on_buttonBox_clicked(QAbstractButton *button)
void SequenceDialog::exportDiagram()
{
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString pdf_filter = tr("Portable Document Format (*.pdf)");
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
@@ -453,7 +453,7 @@ void SequenceDialog::exportDiagram()
filter.append(QString(";;%5").arg(ascii_filter));
}
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Graph As…")),
path.canonicalPath(), filter, &extension);
if (file_name.length() > 0) {
@@ -478,7 +478,7 @@ void SequenceDialog::exportDiagram()
}
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
} else {
open_failure_alert_box(file_name.toUtf8().constData(), errno, TRUE);
}
@@ -853,7 +853,7 @@ void SequenceDialog::rtpPlayerRemove()
void SequenceDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_STAT_FLOW_GRAPH);
+ mainApp->helpTopicAction(HELP_STAT_FLOW_GRAPH);
}
SequenceInfo::SequenceInfo(seq_analysis_info_t *sainfo) :
diff --git a/ui/qt/service_response_time_dialog.cpp b/ui/qt/service_response_time_dialog.cpp
index 17435699dd..22c17f5f49 100644
--- a/ui/qt/service_response_time_dialog.cpp
+++ b/ui/qt/service_response_time_dialog.cpp
@@ -17,7 +17,7 @@
#include "rpc_service_response_time_dialog.h"
#include "scsi_service_response_time_dialog.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QTreeWidget>
#include <QTreeWidgetItemIterator>
@@ -34,7 +34,7 @@ srt_init(const char *args, void*) {
if (args_l.length() > 2) {
filter = QStringList(args_l.mid(2)).join(",");
}
- wsApp->emitTapParameterSignal(srt, filter, NULL);
+ mainApp->emitTapParameterSignal(srt, filter, NULL);
}
}
}
diff --git a/ui/qt/show_packet_bytes_dialog.cpp b/ui/qt/show_packet_bytes_dialog.cpp
index d2564f169f..fde88c3287 100644
--- a/ui/qt/show_packet_bytes_dialog.cpp
+++ b/ui/qt/show_packet_bytes_dialog.cpp
@@ -11,7 +11,7 @@
#include <ui_show_packet_bytes_dialog.h>
#include "main_window.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include "epan/charsets.h"
@@ -283,7 +283,7 @@ void ShowPacketBytesDialog::copyBytes()
{
QByteArray ba(field_bytes_);
sanitizeBuffer(ba, true);
- wsApp->clipboard()->setText(ba);
+ mainApp->clipboard()->setText(ba);
break;
}
@@ -295,26 +295,26 @@ void ShowPacketBytesDialog::copyBytes()
case ShowAsJson:
case ShowAsRAW:
case ShowAsYAML:
- wsApp->clipboard()->setText(ui->tePacketBytes->toPlainText());
+ mainApp->clipboard()->setText(ui->tePacketBytes->toPlainText());
break;
case ShowAsHTML:
- wsApp->clipboard()->setText(ui->tePacketBytes->toHtml());
+ mainApp->clipboard()->setText(ui->tePacketBytes->toHtml());
break;
case ShowAsImage:
- wsApp->clipboard()->setImage(image_);
+ mainApp->clipboard()->setImage(image_);
break;
case ShowAsCodec:
- wsApp->clipboard()->setText(ui->tePacketBytes->toPlainText().toUtf8());
+ mainApp->clipboard()->setText(ui->tePacketBytes->toPlainText().toUtf8());
break;
}
}
void ShowPacketBytesDialog::saveAs()
{
- QString file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Selected Packet Bytes As…")));
+ QString file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Selected Packet Bytes As…")));
if (file_name.isEmpty())
return;
@@ -387,7 +387,7 @@ void ShowPacketBytesDialog::saveAs()
void ShowPacketBytesDialog::helpButton()
{
- wsApp->helpTopicAction(HELP_SHOW_PACKET_BYTES_DIALOG);
+ mainApp->helpTopicAction(HELP_SHOW_PACKET_BYTES_DIALOG);
}
void ShowPacketBytesDialog::on_bFind_clicked()
@@ -596,7 +596,7 @@ void ShowPacketBytesDialog::updatePacketBytes(void)
static const gchar hexchars[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
ui->tePacketBytes->clear();
- ui->tePacketBytes->setCurrentFont(wsApp->monospaceFont());
+ ui->tePacketBytes->setCurrentFont(mainApp->monospaceFont());
switch (show_as_) {
diff --git a/ui/qt/simple_dialog.cpp b/ui/qt/simple_dialog.cpp
index 952713deb1..b45c7a195e 100644
--- a/ui/qt/simple_dialog.cpp
+++ b/ui/qt/simple_dialog.cpp
@@ -20,7 +20,7 @@
#include <wsutil/wslog.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <functional>
#include <QCheckBox>
@@ -96,7 +96,7 @@ simple_dialog(ESD_TYPE_E type, gint btn_mask, const gchar *msg_format, ...)
va_list ap;
va_start(ap, msg_format);
- SimpleDialog sd(wsApp->mainWindow(), type, btn_mask, msg_format, ap);
+ SimpleDialog sd(mainApp->mainWindow(), type, btn_mask, msg_format, ap);
va_end(ap);
sd.exec();
@@ -109,7 +109,7 @@ simple_dialog_async(ESD_TYPE_E type, gint btn_mask, const gchar *msg_format, ...
va_list ap;
va_start(ap, msg_format);
- SimpleDialog sd(wsApp->mainWindow(), type, btn_mask, msg_format, ap);
+ SimpleDialog sd(mainApp->mainWindow(), type, btn_mask, msg_format, ap);
va_end(ap);
sd.show();
@@ -131,7 +131,7 @@ simple_message_box(ESD_TYPE_E type, gboolean *notagain,
va_list ap;
va_start(ap, msg_format);
- SimpleDialog sd(wsApp->mainWindow(), type, ESD_BTN_OK, msg_format, ap);
+ SimpleDialog sd(mainApp->mainWindow(), type, ESD_BTN_OK, msg_format, ap);
va_end(ap);
sd.setDetailedText(secondary_msg);
@@ -164,7 +164,7 @@ vsimple_error_message_box(const char *msg_format, va_list ap)
exit(0);
#endif
- SimpleDialog sd(wsApp->mainWindow(), ESD_TYPE_ERROR, ESD_BTN_OK, msg_format, ap);
+ SimpleDialog sd(mainApp->mainWindow(), ESD_TYPE_ERROR, ESD_BTN_OK, msg_format, ap);
sd.show();
}
@@ -181,7 +181,7 @@ vsimple_warning_message_box(const char *msg_format, va_list ap)
exit(0);
#endif
- SimpleDialog sd(wsApp->mainWindow(), ESD_TYPE_WARN, ESD_BTN_OK, msg_format, ap);
+ SimpleDialog sd(mainApp->mainWindow(), ESD_TYPE_WARN, ESD_BTN_OK, msg_format, ap);
sd.show();
}
@@ -231,7 +231,7 @@ SimpleDialog::SimpleDialog(QWidget *parent, ESD_TYPE_E type, int btn_mask, const
return;
}
- if (!parent || !wsApp->isInitialized() || wsApp->isReloadingLua()) {
+ if (!parent || !mainApp->isInitialized() || mainApp->isReloadingLua()) {
message_queue_ << msg_pair;
if (type > max_severity_) {
max_severity_ = type;
@@ -299,7 +299,7 @@ void SimpleDialog::displayQueuedMessages(QWidget *parent)
return;
}
- QMessageBox mb(parent ? parent : wsApp->mainWindow());
+ QMessageBox mb(parent ? parent : mainApp->mainWindow());
switch(max_severity_) {
case ESD_TYPE_ERROR:
diff --git a/ui/qt/simple_statistics_dialog.cpp b/ui/qt/simple_statistics_dialog.cpp
index 9e07827888..a2d7f11c59 100644
--- a/ui/qt/simple_statistics_dialog.cpp
+++ b/ui/qt/simple_statistics_dialog.cpp
@@ -15,7 +15,7 @@
#include <QTreeWidget>
-#include "wireshark_application.h"
+#include "main_application.h"
// To do:
// - Hide rows with zero counts.
@@ -32,7 +32,7 @@ simple_stat_init(const char *args, void*) {
if (args_l.length() > 2) {
filter = QStringList(args_l.mid(2)).join(",");
}
- wsApp->emitTapParameterSignal(simple_stat, filter, NULL);
+ mainApp->emitTapParameterSignal(simple_stat, filter, NULL);
}
}
}
diff --git a/ui/qt/supported_protocols_dialog.cpp b/ui/qt/supported_protocols_dialog.cpp
index 772fce2784..555b35a9cc 100644
--- a/ui/qt/supported_protocols_dialog.cpp
+++ b/ui/qt/supported_protocols_dialog.cpp
@@ -14,7 +14,7 @@
#include <QElapsedTimer>
-#include "wireshark_application.h"
+#include "main_application.h"
SupportedProtocolsDialog::SupportedProtocolsDialog(QWidget *parent) :
GeometryStateDialog(parent),
@@ -34,7 +34,7 @@ SupportedProtocolsDialog::SupportedProtocolsDialog(QWidget *parent) :
loadGeometry(parent->width() * 3 / 4, parent->height());
setAttribute(Qt::WA_DeleteOnClose, true);
- setWindowTitle(wsApp->windowTitleString(tr("Supported Protocols")));
+ setWindowTitle(mainApp->windowTitleString(tr("Supported Protocols")));
// Some of our names are unreasonably long.
int one_em = fontMetrics().height();
diff --git a/ui/qt/tap_parameter_dialog.cpp b/ui/qt/tap_parameter_dialog.cpp
index 0275232fda..6feb12dff5 100644
--- a/ui/qt/tap_parameter_dialog.cpp
+++ b/ui/qt/tap_parameter_dialog.cpp
@@ -41,7 +41,7 @@
#include "progress_frame.h"
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QClipboard>
#include <QContextMenuEvent>
@@ -123,10 +123,10 @@ void TapParameterDialog::registerDialog(const QString title, const char *cfg_abb
QString cfg_str = cfg_abbr;
cfg_str_to_creator_[cfg_str] = creator;
- QAction *tpd_action = new QAction(title, wsApp);
+ QAction *tpd_action = new QAction(title, mainApp);
tpd_action->setObjectName(action_name_);
tpd_action->setData(cfg_str);
- wsApp->addDynamicMenuGroupItem(group, tpd_action);
+ mainApp->addDynamicMenuGroupItem(group, tpd_action);
}
TapParameterDialog *TapParameterDialog::showTapParameterStatistics(QWidget &parent, CaptureFile &cf, const QString cfg_str, const QString arg, void *)
@@ -533,7 +533,7 @@ void TapParameterDialog::on_applyFilterButton_clicked()
void TapParameterDialog::on_actionCopyToClipboard_triggered()
{
- wsApp->clipboard()->setText(getTreeAsString(ST_FORMAT_PLAIN));
+ mainApp->clipboard()->setText(getTreeAsString(ST_FORMAT_PLAIN));
}
void TapParameterDialog::on_actionSaveAs_triggered()
@@ -548,7 +548,7 @@ void TapParameterDialog::on_actionSaveAs_triggered()
#ifdef Q_OS_WIN
HANDLE da_ctx = set_thread_per_monitor_v2_awareness();
#endif
- QFileDialog SaveAsDialog(this, wsApp->windowTitleString(tr("Save Statistics As…")),
+ QFileDialog SaveAsDialog(this, mainApp->windowTitleString(tr("Save Statistics As…")),
get_last_open_dir());
SaveAsDialog.setNameFilter(tr("Plain text file (*.txt);;"
"Comma separated values (*.csv);;"
@@ -608,6 +608,6 @@ void TapParameterDialog::on_actionSaveAs_triggered()
void TapParameterDialog::on_buttonBox_helpRequested()
{
if (help_topic_ > 0) {
- wsApp->helpTopicAction((topic_action_e) help_topic_);
+ mainApp->helpTopicAction((topic_action_e) help_topic_);
}
}
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp
index e0e87fcb80..625426cab6 100644
--- a/ui/qt/tcp_stream_dialog.cpp
+++ b/ui/qt/tcp_stream_dialog.cpp
@@ -23,7 +23,7 @@
#include <ui/qt/utils/tango_colors.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include "progress_frame.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include <QCursor>
@@ -1843,7 +1843,7 @@ void TCPStreamDialog::transformYRange(const QCPRange &y_range1)
void TCPStreamDialog::on_buttonBox_accepted()
{
QString file_name, extension;
- QDir path(wsApp->lastOpenDir());
+ QDir path(mainApp->lastOpenDir());
QString pdf_filter = tr("Portable Document Format (*.pdf)");
QString png_filter = tr("Portable Network Graphics (*.png)");
QString bmp_filter = tr("Windows Bitmap (*.bmp)");
@@ -1855,7 +1855,7 @@ void TCPStreamDialog::on_buttonBox_accepted()
.arg(bmp_filter)
.arg(jpeg_filter);
- file_name = WiresharkFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Graph As…")),
+ file_name = WiresharkFileDialog::getSaveFileName(this, mainApp->windowTitleString(tr("Save Graph As…")),
path.canonicalPath(), filter, &extension);
if (file_name.length() > 0) {
@@ -1871,7 +1871,7 @@ void TCPStreamDialog::on_buttonBox_accepted()
}
// else error dialog?
if (save_ok) {
- wsApp->setLastOpenDirFromFilename(file_name);
+ mainApp->setLastOpenDirFromFilename(file_name);
}
}
}
@@ -2212,5 +2212,5 @@ void TCPStreamDialog::GraphUpdater::doUpdate()
void TCPStreamDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG);
+ mainApp->helpTopicAction(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG);
}
diff --git a/ui/qt/time_shift_dialog.cpp b/ui/qt/time_shift_dialog.cpp
index d7b6ecf4c5..76cb29cc1d 100644
--- a/ui/qt/time_shift_dialog.cpp
+++ b/ui/qt/time_shift_dialog.cpp
@@ -10,7 +10,7 @@
#include "time_shift_dialog.h"
#include <ui_time_shift_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/time_shift.h>
#include <ui/qt/utils/color_utils.h>
@@ -24,7 +24,7 @@ TimeShiftDialog::TimeShiftDialog(QWidget *parent, capture_file *cf) :
apply_button_(NULL)
{
ts_ui_->setupUi(this);
- setWindowTitle(wsApp->windowTitleString(tr("Time Shift")));
+ setWindowTitle(mainApp->windowTitleString(tr("Time Shift")));
apply_button_ = ts_ui_->buttonBox->button(QDialogButtonBox::Apply);
apply_button_->setDefault(true);
connect(apply_button_, &QPushButton::clicked, this, &TimeShiftDialog::applyTimeShift);
@@ -262,5 +262,5 @@ void TimeShiftDialog::applyTimeShift()
void TimeShiftDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_TIME_SHIFT_DIALOG);
+ mainApp->helpTopicAction(HELP_TIME_SHIFT_DIALOG);
}
diff --git a/ui/qt/traffic_table_dialog.cpp b/ui/qt/traffic_table_dialog.cpp
index b41568c9f7..b3987d9546 100644
--- a/ui/qt/traffic_table_dialog.cpp
+++ b/ui/qt/traffic_table_dialog.cpp
@@ -16,7 +16,7 @@
#include "ui/recent.h"
#include "progress_frame.h"
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QCheckBox>
#include <QClipboard>
@@ -70,8 +70,8 @@ TrafficTableDialog::TrafficTableDialog(QWidget &parent, CaptureFile &cf, const c
nanosecond_timestamps_ = true;
}
- connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(currentTabChanged()));
- connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateWidgets()));
+ connect(mainApp, SIGNAL(addressResolutionChanged()), this, SLOT(currentTabChanged()));
+ connect(mainApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateWidgets()));
connect(ui->trafficTableTabWidget, SIGNAL(currentChanged(int)),
this, SLOT(currentTabChanged()));
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent)),
@@ -317,7 +317,7 @@ void TrafficTableDialog::copyAsCsv()
}
stream << rdsl.join(",") << '\n';
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
void TrafficTableDialog::copyAsYaml()
@@ -336,7 +336,7 @@ void TrafficTableDialog::copyAsYaml()
stream << " - " << v.toString() << '\n';
}
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
TrafficTableTreeWidget::TrafficTableTreeWidget(QWidget *parent, register_ct_t *table) :
@@ -348,7 +348,7 @@ TrafficTableTreeWidget::TrafficTableTreeWidget(QWidget *parent, register_ct_t *t
setRootIsDecorated(false);
sortByColumn(0, Qt::AscendingOrder);
- connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateItemsForSettingChange()));
+ connect(mainApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateItemsForSettingChange()));
}
QList<QVariant> TrafficTableTreeWidget::rowData(int row) const
diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp
index 99aa2d568f..a620dcc8ec 100644
--- a/ui/qt/uat_dialog.cpp
+++ b/ui/qt/uat_dialog.cpp
@@ -9,7 +9,7 @@
#include "uat_dialog.h"
#include <ui_uat_dialog.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "epan/strutil.h"
#include "epan/uat-int.h"
@@ -345,11 +345,11 @@ void UatDialog::applyChanges()
if (uat_->flags & UAT_AFFECTS_FIELDS) {
/* Recreate list with new fields and redissect packets */
- wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
+ mainApp->queueAppSignal(MainApplication::FieldsChanged);
}
if (uat_->flags & UAT_AFFECTS_DISSECTION) {
/* Just redissect packets if we have any */
- wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->queueAppSignal(MainApplication::PacketDissectionChanged);
}
}
diff --git a/ui/qt/uat_frame.cpp b/ui/qt/uat_frame.cpp
index efa813e78b..1684a260bd 100644
--- a/ui/qt/uat_frame.cpp
+++ b/ui/qt/uat_frame.cpp
@@ -16,7 +16,7 @@
#include "uat_frame.h"
#include <ui_uat_frame.h>
#include <ui/qt/widgets/display_filter_edit.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/widgets/copy_from_profile_button.h>
#include <ui/qt/utils/qt_ui_utils.h>
@@ -147,11 +147,11 @@ void UatFrame::applyChanges()
if (uat_->flags & UAT_AFFECTS_FIELDS) {
/* Recreate list with new fields and redissect packets */
- wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
+ mainApp->queueAppSignal(MainApplication::FieldsChanged);
}
if (uat_->flags & UAT_AFFECTS_DISSECTION) {
/* Just redissect packets if we have any */
- wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
+ mainApp->queueAppSignal(MainApplication::PacketDissectionChanged);
}
}
diff --git a/ui/qt/utils/color_utils.cpp b/ui/qt/utils/color_utils.cpp
index 77197fefa4..b528ef3a5e 100644
--- a/ui/qt/utils/color_utils.cpp
+++ b/ui/qt/utils/color_utils.cpp
@@ -155,7 +155,7 @@ bool ColorUtils::themeIsDark()
// themeLinkBrush and themeLinkStyle provide convenience routines for
// fetching the link brush and style.
//
-// We could also override WiresharkApplication::palette, but keeping the
+// We could also override MainApplication::palette, but keeping the
// routines together here seemed to make more sense.
QBrush ColorUtils::themeLinkBrush()
{
diff --git a/ui/qt/voip_calls_dialog.cpp b/ui/qt/voip_calls_dialog.cpp
index f0960d9fe2..9d492e6bab 100644
--- a/ui/qt/voip_calls_dialog.cpp
+++ b/ui/qt/voip_calls_dialog.cpp
@@ -22,7 +22,7 @@
#include "rtp_player_dialog.h"
#include "sequence_dialog.h"
#include <ui/qt/utils/stock_icon.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <ui/qt/models/voip_calls_info_model.h>
#include <QClipboard>
@@ -701,7 +701,7 @@ void VoipCallsDialog::copyAsCSV()
}
stream << rdsl.join(",") << '\n';
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
void VoipCallsDialog::copyAsYAML()
@@ -715,7 +715,7 @@ void VoipCallsDialog::copyAsYAML()
stream << " - " << v.toString() << '\n';
}
}
- wsApp->clipboard()->setText(stream.readAll());
+ mainApp->clipboard()->setText(stream.readAll());
}
void VoipCallsDialog::on_buttonBox_clicked(QAbstractButton *button)
@@ -759,7 +759,7 @@ void VoipCallsDialog::on_displayFilterCheckBox_toggled(bool checked)
void VoipCallsDialog::on_buttonBox_helpRequested()
{
- wsApp->helpTopicAction(HELP_TELEPHONY_VOIP_CALLS_DIALOG);
+ mainApp->helpTopicAction(HELP_TELEPHONY_VOIP_CALLS_DIALOG);
}
void VoipCallsDialog::switchTimeOfDay()
diff --git a/ui/qt/welcome_page.cpp b/ui/qt/welcome_page.cpp
index e03c879911..33c987dcb5 100644
--- a/ui/qt/welcome_page.cpp
+++ b/ui/qt/welcome_page.cpp
@@ -23,7 +23,7 @@
#include <ui/qt/utils/tango_colors.h>
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QClipboard>
#include <QDate>
@@ -73,9 +73,9 @@ WelcomePage::WelcomePage(QWidget *parent) :
connect(recent_files_, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(showRecentContextMenu(QPoint)));
- connect(wsApp, SIGNAL(updateRecentCaptureStatus(const QString &, qint64, bool)), this, SLOT(updateRecentCaptures()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(appInitialized()));
- connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
+ connect(mainApp, SIGNAL(updateRecentCaptureStatus(const QString &, qint64, bool)), this, SLOT(updateRecentCaptures()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(appInitialized()));
+ connect(mainApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
connect(welcome_ui_->interfaceFrame, SIGNAL(itemSelectionChanged()),
welcome_ui_->captureFilterComboBox, SIGNAL(interfacesChanged()));
connect(welcome_ui_->interfaceFrame, SIGNAL(typeSelectionChanged()),
@@ -270,7 +270,7 @@ void WelcomePage::updateRecentCaptures() {
selectedFilename = rfItem->data(Qt::UserRole).toString();
}
- if (wsApp->recentItems().count() == 0) {
+ if (mainApp->recentItems().count() == 0) {
// Recent menu has been cleared, remove all recent files.
while (recent_files_->count()) {
delete recent_files_->item(0);
@@ -278,7 +278,7 @@ void WelcomePage::updateRecentCaptures() {
}
int rfRow = 0;
- foreach (recent_item_status *ri, wsApp->recentItems()) {
+ foreach (recent_item_status *ri, mainApp->recentItems()) {
itemLabel = ri->filename;
if (rfRow >= recent_files_->count()) {
@@ -409,7 +409,7 @@ void WelcomePage::copyRecentPath()
QString cf_path = ria->data().toString();
if (cf_path.isEmpty()) return;
- wsApp->clipboard()->setText(cf_path);
+ mainApp->clipboard()->setText(cf_path);
}
void WelcomePage::removeRecentPath()
@@ -420,12 +420,12 @@ void WelcomePage::removeRecentPath()
QString cf_path = ria->data().toString();
if (cf_path.isEmpty()) return;
- wsApp->removeRecentItem(cf_path);
+ mainApp->removeRecentItem(cf_path);
}
void WelcomePage::on_captureLabel_clicked()
{
- wsApp->doTriggerMenuItem(WiresharkApplication::CaptureOptionsDialog);
+ mainApp->doTriggerMenuItem(MainApplication::CaptureOptionsDialog);
}
void WelcomePage::on_helpLabel_clicked()
@@ -534,5 +534,5 @@ void WelcomePage::updateStyleSheets()
void WelcomePage::on_recentLabel_clicked()
{
- wsApp->doTriggerMenuItem(WiresharkApplication::FileOpenDialog);
+ mainApp->doTriggerMenuItem(MainApplication::FileOpenDialog);
}
diff --git a/ui/qt/widgets/additional_toolbar.cpp b/ui/qt/widgets/additional_toolbar.cpp
index 7598037c95..c023d149fe 100644
--- a/ui/qt/widgets/additional_toolbar.cpp
+++ b/ui/qt/widgets/additional_toolbar.cpp
@@ -15,7 +15,7 @@
#include <ui/qt/widgets/apply_line_edit.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include <ui/qt/utils/variant_pointer.h>
-#include <ui/qt/wireshark_application.h>
+#include <ui/qt/main_application.h>
#include <QLabel>
#include <QLineEdit>
@@ -100,14 +100,14 @@ AdditionalToolbarWidgetAction::AdditionalToolbarWidgetAction(ext_toolbar_t * ite
: QWidgetAction(parent),
toolbar_item(item)
{
- connect(wsApp, &WiresharkApplication::captureActive, this, &AdditionalToolbarWidgetAction::captureActive);
+ connect(mainApp, &MainApplication::captureActive, this, &AdditionalToolbarWidgetAction::captureActive);
}
AdditionalToolbarWidgetAction::AdditionalToolbarWidgetAction(const AdditionalToolbarWidgetAction & copy_object)
: QWidgetAction(copy_object.parent()),
toolbar_item(copy_object.toolbar_item)
{
- connect(wsApp, &WiresharkApplication::captureActive, this, &AdditionalToolbarWidgetAction::captureActive);
+ connect(mainApp, &MainApplication::captureActive, this, &AdditionalToolbarWidgetAction::captureActive);
}
diff --git a/ui/qt/widgets/byte_view_text.cpp b/ui/qt/widgets/byte_view_text.cpp
index 583d8cff01..fb85af5229 100644
--- a/ui/qt/widgets/byte_view_text.cpp
+++ b/ui/qt/widgets/byte_view_text.cpp
@@ -17,7 +17,7 @@
#include <wsutil/utf8_entities.h>
#include <ui/qt/utils/color_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "ui/recent.h"
#include <QActionGroup>
diff --git a/ui/qt/widgets/capture_filter_combo.cpp b/ui/qt/widgets/capture_filter_combo.cpp
index c79a3cef60..5d79f27e98 100644
--- a/ui/qt/widgets/capture_filter_combo.cpp
+++ b/ui/qt/widgets/capture_filter_combo.cpp
@@ -17,7 +17,7 @@
#include <ui/qt/widgets/capture_filter_combo.h>
#include <ui/qt/utils/color_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
CaptureFilterCombo::CaptureFilterCombo(QWidget *parent, bool plain) :
QComboBox(parent),
@@ -44,8 +44,8 @@ CaptureFilterCombo::CaptureFilterCombo(QWidget *parent, bool plain) :
this, &CaptureFilterCombo::captureFilterSyntaxChanged);
connect(cf_edit_, &CaptureFilterEdit::startCapture, this, &CaptureFilterCombo::startCapture);
connect(cf_edit_, &CaptureFilterEdit::startCapture, this, &CaptureFilterCombo::saveAndRebuildFilterList);
- connect(wsApp, &WiresharkApplication::appInitialized, this, &CaptureFilterCombo::rebuildFilterList);
- connect(wsApp, &WiresharkApplication::preferencesChanged, this, &CaptureFilterCombo::rebuildFilterList);
+ connect(mainApp, &MainApplication::appInitialized, this, &CaptureFilterCombo::rebuildFilterList);
+ connect(mainApp, &MainApplication::preferencesChanged, this, &CaptureFilterCombo::rebuildFilterList);
rebuildFilterList();
clearEditText();
diff --git a/ui/qt/widgets/capture_filter_edit.cpp b/ui/qt/widgets/capture_filter_edit.cpp
index ed79cce005..af60eb6a9b 100644
--- a/ui/qt/widgets/capture_filter_edit.cpp
+++ b/ui/qt/widgets/capture_filter_edit.cpp
@@ -23,7 +23,7 @@
#include "capture_filter_syntax_worker.h"
#include "filter_dialog.h"
#include <ui/qt/widgets/stock_icon_tool_button.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QComboBox>
#include <QCompleter>
@@ -221,8 +221,8 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
syntax_thread_ = new QThread;
syntax_worker_ = new CaptureFilterSyntaxWorker;
syntax_worker_->moveToThread(syntax_thread_);
- connect(wsApp, &WiresharkApplication::appInitialized, this, &CaptureFilterEdit::updateBookmarkMenu);
- connect(wsApp, &WiresharkApplication::captureFilterListChanged, this, &CaptureFilterEdit::updateBookmarkMenu);
+ connect(mainApp, &MainApplication::appInitialized, this, &CaptureFilterEdit::updateBookmarkMenu);
+ connect(mainApp, &MainApplication::captureFilterListChanged, this, &CaptureFilterEdit::updateBookmarkMenu);
connect(syntax_thread_, &QThread::started, this,
static_cast<void (CaptureFilterEdit::*)()>(&CaptureFilterEdit::checkFilter));
connect(syntax_worker_, &CaptureFilterSyntaxWorker::syntaxResult,
@@ -331,7 +331,7 @@ void CaptureFilterEdit::checkFilter(const QString& filter)
actions_->checkedAction()->setChecked(false);
setSyntaxState(Busy);
- wsApp->popStatus(WiresharkApplication::FilterSyntax);
+ mainApp->popStatus(MainApplication::FilterSyntax);
setToolTip(QString());
bool empty = filter.isEmpty();
@@ -432,7 +432,7 @@ void CaptureFilterEdit::setFilterSyntaxState(QString filter, int state, QString
if (filter.compare(text()) == 0) { // The user hasn't changed the filter
setSyntaxState((SyntaxState)state);
if (!err_msg.isEmpty()) {
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_msg);
+ mainApp->pushStatus(MainApplication::FilterSyntax, err_msg);
setToolTip(err_msg);
}
}
diff --git a/ui/qt/widgets/display_filter_combo.cpp b/ui/qt/widgets/display_filter_combo.cpp
index 32ef36da0c..16e49ca10d 100644
--- a/ui/qt/widgets/display_filter_combo.cpp
+++ b/ui/qt/widgets/display_filter_combo.cpp
@@ -21,7 +21,7 @@
#include <ui/qt/widgets/display_filter_edit.h>
#include <ui/qt/widgets/display_filter_combo.h>
#include <ui/qt/utils/color_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
// If we ever add support for multiple windows this will need to be replaced.
static DisplayFilterCombo *cur_display_filter_combo = NULL;
@@ -48,7 +48,7 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
updateStyleSheet();
setToolTip(tr("Select from previously used filters."));
- connect(wsApp, &WiresharkApplication::preferencesChanged, this, &DisplayFilterCombo::updateMaxCount);
+ connect(mainApp, &MainApplication::preferencesChanged, this, &DisplayFilterCombo::updateMaxCount);
}
extern "C" void dfilter_recent_combo_write_all(FILE *rf) {
diff --git a/ui/qt/widgets/display_filter_edit.cpp b/ui/qt/widgets/display_filter_edit.cpp
index 3ea4795cd7..09165eb582 100644
--- a/ui/qt/widgets/display_filter_edit.cpp
+++ b/ui/qt/widgets/display_filter_edit.cpp
@@ -17,6 +17,8 @@
#include <wsutil/utf8_entities.h>
+#include "main_application.h"
+
#include <ui/qt/widgets/display_filter_edit.h>
#include "filter_dialog.h"
#include <ui/qt/widgets/stock_icon_tool_button.h>
@@ -27,7 +29,6 @@
#include <ui/qt/filter_action.h>
#include <ui/qt/display_filter_expression_dialog.h>
#include <ui/qt/main_window.h>
-#include "wireshark_application.h"
#include <QAction>
#include <QAbstractItemView>
@@ -121,19 +122,19 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, DisplayFilterEditType type
connect(this, &DisplayFilterEdit::textChanged, this,
static_cast<void (DisplayFilterEdit::*)(const QString &)>(&DisplayFilterEdit::checkFilter));
- connect(wsApp, &WiresharkApplication::appInitialized, this, &DisplayFilterEdit::updateBookmarkMenu);
- connect(wsApp, &WiresharkApplication::displayFilterListChanged, this, &DisplayFilterEdit::updateBookmarkMenu);
- connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(checkFilter()));
+ connect(mainApp, &MainApplication::appInitialized, this, &DisplayFilterEdit::updateBookmarkMenu);
+ connect(mainApp, &MainApplication::displayFilterListChanged, this, &DisplayFilterEdit::updateBookmarkMenu);
+ connect(mainApp, SIGNAL(preferencesChanged()), this, SLOT(checkFilter()));
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
}
void DisplayFilterEdit::connectToMainWindow()
{
- connect(this, SIGNAL(filterPackets(QString, bool)), wsApp->mainWindow(), SLOT(filterPackets(QString, bool)));
+ connect(this, SIGNAL(filterPackets(QString, bool)), mainApp->mainWindow(), SLOT(filterPackets(QString, bool)));
connect(this, SIGNAL(showPreferencesDialog(QString)),
- wsApp->mainWindow(), SLOT(showPreferencesDialog(QString)));
- connect(wsApp->mainWindow(), SIGNAL(displayFilterSuccess(bool)),
+ mainApp->mainWindow(), SLOT(showPreferencesDialog(QString)));
+ connect(mainApp->mainWindow(), SIGNAL(displayFilterSuccess(bool)),
this, SLOT(displayFilterSuccess(bool)));
}
@@ -338,7 +339,7 @@ void DisplayFilterEdit::checkFilter(const QString& filter_text)
}
if (filter_text.length() <= 0)
- wsApp->popStatus(WiresharkApplication::FilterSyntax);
+ mainApp->popStatus(MainApplication::FilterSyntax);
emit popFilterSyntaxStatus();
if (!checkDisplayFilter(filter_text))
@@ -347,14 +348,14 @@ void DisplayFilterEdit::checkFilter(const QString& filter_text)
switch (syntaxState()) {
case Deprecated:
{
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, syntaxErrorMessage());
+ mainApp->pushStatus(MainApplication::FilterSyntax, syntaxErrorMessage());
setToolTip(syntaxErrorMessage());
break;
}
case Invalid:
{
QString invalidMsg = tr("Invalid filter: ").append(syntaxErrorMessage());
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, syntaxErrorMessage());
+ mainApp->pushStatus(MainApplication::FilterSyntax, syntaxErrorMessage());
setToolTip(invalidMsg);
break;
}
@@ -470,14 +471,14 @@ void DisplayFilterEdit::buildCompletionList(const QString &field_word)
{
// Push a hint about the current field.
if (syntaxState() == Valid) {
- wsApp->popStatus(WiresharkApplication::FilterSyntax);
+ mainApp->popStatus(MainApplication::FilterSyntax);
header_field_info *hfinfo = proto_registrar_get_byname(field_word.toUtf8().constData());
if (hfinfo) {
QString cursor_field_msg = QString("%1: %2")
.arg(hfinfo->name)
.arg(ftype_pretty_name(hfinfo->type));
- wsApp->pushStatus(WiresharkApplication::FilterSyntax, cursor_field_msg);
+ mainApp->pushStatus(MainApplication::FilterSyntax, cursor_field_msg);
}
}
diff --git a/ui/qt/widgets/filter_expression_toolbar.cpp b/ui/qt/widgets/filter_expression_toolbar.cpp
index f4c3c210b2..e88e78d5d9 100644
--- a/ui/qt/widgets/filter_expression_toolbar.cpp
+++ b/ui/qt/widgets/filter_expression_toolbar.cpp
@@ -13,7 +13,7 @@
#include <ui/qt/utils/wireshark_mime_data.h>
#include <ui/qt/models/uat_model.h>
#include <ui/qt/filter_action.h>
-#include <ui/qt/wireshark_application.h>
+#include <ui/qt/main_application.h>
#include <epan/filter_expressions.h>
#include <ui/preference_utils.h>
@@ -53,9 +53,9 @@ FilterExpressionToolBar::FilterExpressionToolBar(QWidget * parent) :
connect(this, &DragDropToolBar::actionMoved, this, &FilterExpressionToolBar::onActionMoved);
connect(this, &DragDropToolBar::newFilterDropped, this, &FilterExpressionToolBar::onFilterDropped);
- connect(wsApp, &WiresharkApplication::appInitialized,
+ connect(mainApp, &MainApplication::appInitialized,
this, &FilterExpressionToolBar::filterExpressionsChanged);
- connect(wsApp, &WiresharkApplication::filterExpressionsChanged,
+ connect(mainApp, &MainApplication::filterExpressionsChanged,
this, &FilterExpressionToolBar::filterExpressionsChanged);
}
diff --git a/ui/qt/widgets/follow_stream_text.cpp b/ui/qt/widgets/follow_stream_text.cpp
index 31aa31d1fd..26757832b3 100644
--- a/ui/qt/widgets/follow_stream_text.cpp
+++ b/ui/qt/widgets/follow_stream_text.cpp
@@ -9,7 +9,7 @@
#include <ui/qt/widgets/follow_stream_text.h>
-#include <wireshark_application.h>
+#include <main_application.h>
#include <QMouseEvent>
#include <QTextCursor>
@@ -25,7 +25,7 @@ FollowStreamText::FollowStreamText(QWidget *parent) :
setMouseTracking(true);
// setMaximumBlockCount(1);
QTextDocument *text_doc = document();
- text_doc->setDefaultFont(wsApp->monospaceFont());
+ text_doc->setDefaultFont(mainApp->monospaceFont());
}
void FollowStreamText::mouseMoveEvent(QMouseEvent *event)
diff --git a/ui/qt/widgets/packet_list_header.cpp b/ui/qt/widgets/packet_list_header.cpp
index dd637612d6..1dbc6560af 100644
--- a/ui/qt/widgets/packet_list_header.cpp
+++ b/ui/qt/widgets/packet_list_header.cpp
@@ -17,7 +17,7 @@
#include <packet_list.h>
-#include <wireshark_application.h>
+#include <main_application.h>
#include <epan/column.h>
#include <ui/recent.h>
#include <ui/preference_utils.h>
@@ -98,7 +98,7 @@ void PacketListHeader::dropEvent(QDropEvent *event)
event->setDropAction(Qt::CopyAction);
event->accept();
- MainWindow * mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
+ MainWindow * mw = qobject_cast<MainWindow *>(mainApp->mainWindow());
if (mw)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0 ,0)
diff --git a/ui/qt/widgets/splash_overlay.cpp b/ui/qt/widgets/splash_overlay.cpp
index f6b7a0fb29..f2ba02f52a 100644
--- a/ui/qt/widgets/splash_overlay.cpp
+++ b/ui/qt/widgets/splash_overlay.cpp
@@ -9,7 +9,7 @@
#include "splash_overlay.h"
#include <ui_splash_overlay.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QPainter>
@@ -32,7 +32,7 @@
const int info_update_freq_ = 65; // ~15 fps
void splash_update(register_action_e action, const char *message, void *) {
- emit wsApp->registerUpdate(action, message);
+ emit mainApp->registerUpdate(action, message);
}
SplashOverlay::SplashOverlay(QWidget *parent) :
@@ -82,7 +82,7 @@ SplashOverlay::SplashOverlay(QWidget *parent) :
)
.arg(QColor(tango_aluminium_4).name()));
- connect(wsApp, &WiresharkApplication::splashUpdate, this, &SplashOverlay::splashUpdate);
+ connect(mainApp, &MainApplication::splashUpdate, this, &SplashOverlay::splashUpdate);
}
SplashOverlay::~SplashOverlay()
@@ -171,6 +171,6 @@ void SplashOverlay::splashUpdate(register_action_e action, const char *message)
so_ui_->progressBar->setValue(register_cur_);
- wsApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
+ mainApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
elapsed_timer_.restart();
}
diff --git a/ui/qt/widgets/wireless_timeline.cpp b/ui/qt/widgets/wireless_timeline.cpp
index 83f373c65f..50ed031132 100644
--- a/ui/qt/widgets/wireless_timeline.cpp
+++ b/ui/qt/widgets/wireless_timeline.cpp
@@ -30,7 +30,7 @@
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <wsutil/report_message.h>
#include <wsutil/utf8_entities.h>
@@ -270,12 +270,12 @@ void WirelessTimeline::captureFileReadFinished()
struct wlan_radio *w = get_wlan_radio(n);
if (w->start_tsf == 0 || w->end_tsf == 0) {
QString err = tr("Packet number %1 does not include TSF timestamp, not showing timeline.").arg(n);
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
+ mainApp->pushStatus(MainApplication::TemporaryStatus, err);
return;
}
if (w->ifs < -RENDER_EARLY) {
QString err = tr("Packet number %u has large negative jump in TSF, not showing timeline. Perhaps TSF reference point is set wrong?").arg(n);
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
+ mainApp->pushStatus(MainApplication::TemporaryStatus, err);
return;
}
}
@@ -297,7 +297,7 @@ void WirelessTimeline::captureFileReadFinished()
void WirelessTimeline::appInitialized()
{
- connect(wsApp->mainWindow(), SIGNAL(framesSelected(QList<int>)), this, SLOT(selectedFrameChanged(QList<int>)));
+ connect(mainApp->mainWindow(), SIGNAL(framesSelected(QList<int>)), this, SLOT(selectedFrameChanged(QList<int>)));
GString *error_string;
error_string = register_tap_listener("wlan_radio_timeline", this, NULL, TL_REQUIRES_NOTHING, tap_timeline_reset, tap_timeline_packet, NULL/*tap_draw_cb tap_draw*/, NULL);
@@ -342,7 +342,7 @@ WirelessTimeline::WirelessTimeline(QWidget *parent) : QWidget(parent)
capfile = NULL;
radio_packet_list = g_hash_table_new(g_direct_hash, g_direct_equal);
- connect(wsApp, SIGNAL(appInitialized()), this, SLOT(appInitialized()));
+ connect(mainApp, SIGNAL(appInitialized()), this, SLOT(appInitialized()));
}
WirelessTimeline::~WirelessTimeline()
diff --git a/ui/qt/wireless_frame.cpp b/ui/qt/wireless_frame.cpp
index 31cd22aa3f..2247b11380 100644
--- a/ui/qt/wireless_frame.cpp
+++ b/ui/qt/wireless_frame.cpp
@@ -22,7 +22,7 @@
#include "ui/ws_ui_util.h"
#include <wsutil/utf8_entities.h>
#include <wsutil/802_11-utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include <QProcess>
#include <QAbstractItemView>
@@ -71,7 +71,7 @@ WirelessFrame::WirelessFrame(QWidget *parent) :
ui->fcsFilterFrame->setVisible(ws80211_has_fcs_filter());
updateInterfaceList();
- connect(wsApp, &WiresharkApplication::localInterfaceEvent,
+ connect(mainApp, &MainApplication::localInterfaceEvent,
this, &WirelessFrame::handleInterfaceEvent);
}
@@ -346,7 +346,7 @@ void WirelessFrame::setInterfaceInfo()
}
if (!err_str.isEmpty()) {
- wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err_str);
+ mainApp->pushStatus(MainApplication::TemporaryStatus, err_str);
}
getInterfaceInfo();
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 1a1364f693..71da9fb046 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -7,1370 +7,19 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4267)
-#endif
-
#include "wireshark_application.h"
-#include <algorithm>
-#include <errno.h>
-
-#include "wsutil/filesystem.h"
-
-#include "epan/addr_resolv.h"
-#include "epan/column-utils.h"
-#include "epan/disabled_protos.h"
-#include "epan/ftypes/ftypes.h"
-#include "epan/prefs.h"
-#include "epan/proto.h"
-#include "epan/tap.h"
-#include "epan/timestamp.h"
-#include "epan/decode_as.h"
-
-#include "ui/decode_as_utils.h"
-#include "ui/preference_utils.h"
-#include "ui/iface_lists.h"
-#include "ui/language.h"
-#include "ui/recent.h"
-#include "ui/simple_dialog.h"
-#include "ui/util.h"
-
-#include <ui/qt/utils/qt_ui_utils.h>
-#include <ui/qt/utils/color_utils.h>
-#include "coloring_rules_dialog.h"
-
-#include "epan/color_filters.h"
-#include "recent_file_status.h"
-
-#include "extcap.h"
-#ifdef HAVE_LIBPCAP
-#include <capture/iface_monitor.h>
-#endif
-
-#include "ui/filter_files.h"
-#include "ui/capture_globals.h"
-#include "ui/software_update.h"
-#include "ui/last_open_dir.h"
-#include "ui/recent_utils.h"
-
-#ifdef HAVE_LIBPCAP
-#include "ui/capture.h"
-#endif
-
-#include "wsutil/utf8_entities.h"
-
-#ifdef _WIN32
-# include "ui/win32/console_win32.h"
-# include "wsutil/file_util.h"
-# include <QMessageBox>
-# include <QSettings>
-#endif /* _WIN32 */
-
-#include <ui/qt/capture_file.h>
-
-#include <ui/qt/main_window.h>
-#include <ui_main_window.h>
-
-#include <QAction>
-#include <QApplication>
-#include <QColorDialog>
-#include <QDesktopServices>
-#include <QDir>
-#include <QEvent>
-#include <QFileOpenEvent>
-#include <QFontInfo>
-#include <QFontMetrics>
-#include <QLibraryInfo>
-#include <QLocale>
-#include <QMainWindow>
-#include <QMutableListIterator>
-#include <QSocketNotifier>
-#include <QThreadPool>
-#include <QUrl>
-#include <qmath.h>
-
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
-#include <QFontDatabase>
-#endif
-#include <QMimeDatabase>
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
-#include <QStyleHints>
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
WiresharkApplication *wsApp = NULL;
-// XXX - Copied from ui/gtk/file_dlg.c
-
-// MUST be UTF-8
-static char *last_open_dir = NULL;
-static QList<recent_item_status *> recent_captures_;
-static QHash<int, QList<QAction *> > dynamic_menu_groups_;
-static QHash<int, QList<QAction *> > added_menu_groups_;
-static QHash<int, QList<QAction *> > removed_menu_groups_;
-
-QString WiresharkApplication::window_title_separator_ = QString::fromUtf8(" " UTF8_MIDDLE_DOT " ");
-
-// QMimeDatabase parses a large-ish XML file and can be slow to initialize.
-// Do so in a worker thread as early as possible.
-// https://github.com/lxde/pcmanfm-qt/issues/415
-class MimeDatabaseInitThread : public QRunnable
-{
-private:
- void run()
- {
- QMimeDatabase mime_db;
- mime_db.mimeTypeForData(QByteArray());
- }
-};
-
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
-// Populating the font database can be slow as well.
-class FontDatabaseInitThread : public QRunnable
-{
-private:
- void run()
- {
- QFontDatabase font_db;
- }
-};
-#endif
-
-void
-topic_action(topic_action_e action)
-{
- if (wsApp) wsApp->helpTopicAction(action);
-}
-
-extern "C" char *
-get_last_open_dir(void)
-{
- return last_open_dir;
-}
-
-void
-set_last_open_dir(const char *dirname)
-{
- if (wsApp) wsApp->setLastOpenDir(dirname);
-}
-
-/*
- * Add the capture filename to the application-wide "Recent Files" list.
- * Contrary to the name this isn't limited to the "recent" menu.
- */
-/*
- * XXX - We might want to call SHAddToRecentDocs under Windows 7:
- * https://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
- */
-extern "C" void
-add_menu_recent_capture_file(const gchar *cf_name) {
- QString normalized_cf_name = QString::fromUtf8(cf_name);
- QDir cf_path;
-
- cf_path.setPath(normalized_cf_name);
- normalized_cf_name = cf_path.absolutePath();
- normalized_cf_name = QDir::cleanPath(normalized_cf_name);
- normalized_cf_name = QDir::toNativeSeparators(normalized_cf_name);
-
- /* Iterate through the recent items list, removing duplicate entries and every
- * item above count_max
- */
- unsigned int cnt = 1;
- QMutableListIterator<recent_item_status *> rii(recent_captures_);
- while (rii.hasNext()) {
- recent_item_status *ri = rii.next();
- /* if this element string is one of our special items (separator, ...) or
- * already in the list or
- * this element is above maximum count (too old), remove it
- */
- if (ri->filename.length() < 1 ||
-#ifdef _WIN32
- /* do a case insensitive compare on win32 */
- ri->filename.compare(normalized_cf_name, Qt::CaseInsensitive) == 0 ||
-#else /* _WIN32 */
- /*
- * Do a case sensitive compare on UN*Xes.
- *
- * XXX - on UN*Xes such as macOS, where you can use pathconf()
- * to check whether a given file system is case-sensitive or
- * not, we should check whether this particular file system
- * is case-sensitive and do the appropriate comparison.
- */
- ri->filename.compare(normalized_cf_name) == 0 ||
-#endif
- cnt >= prefs.gui_recent_files_count_max) {
- rii.remove();
- delete(ri);
- cnt--;
- }
- cnt++;
- }
- wsApp->addRecentItem(normalized_cf_name, 0, false);
-}
-
-/* write all capture filenames of the menu to the user's recent file */
-extern "C" void menu_recent_file_write_all(FILE *rf) {
-
- /* we have to iterate backwards through the children's list,
- * so we get the latest item last in the file.
- */
- QListIterator<recent_item_status *> rii(recent_captures_);
- rii.toBack();
- while (rii.hasPrevious()) {
- QString cf_name;
- /* get capture filename from the menu item label */
- cf_name = rii.previous()->filename;
- if (!cf_name.isNull()) {
- fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", qUtf8Printable(cf_name));
- }
- }
-}
-
-#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
-/** Check to see if Wireshark can shut down safely (e.g. offer to save the
- * current capture).
- */
-extern "C" int software_update_can_shutdown_callback(void) {
- return wsApp->softwareUpdateCanShutdown();
-}
-
-/** Shut down Wireshark in preparation for an upgrade.
- */
-extern "C" void software_update_shutdown_request_callback(void) {
- wsApp->softwareUpdateShutdownRequest();
-}
-#endif // HAVE_SOFTWARE_UPDATE && Q_OS_WIN
-
-// Check each recent item in a separate thread so that we don't hang while
-// calling stat(). This is called periodically because files and entire
-// volumes can disappear and reappear at any time.
-void WiresharkApplication::refreshRecentCaptures() {
- recent_item_status *ri;
- RecentFileStatus *rf_status;
-
- // We're in the middle of a capture. Don't create traffic.
- if (active_captures_ > 0) return;
-
- foreach (ri, recent_captures_) {
- if (ri->in_thread) {
- continue;
- }
- rf_status = new RecentFileStatus(ri->filename, this);
- QThreadPool::globalInstance()->start(rf_status);
- }
-}
-
-void WiresharkApplication::refreshPacketData()
-{
- if (host_name_lookup_process()) {
- emit addressResolutionChanged();
- } else if (col_data_changed()) {
- emit columnDataChanged();
- }
-}
-
-void WiresharkApplication::updateTaps()
-{
- draw_tap_listeners(FALSE);
-}
-
-QDir WiresharkApplication::lastOpenDir() {
- return QDir(last_open_dir);
-}
-
-void WiresharkApplication::setLastOpenDirFromFilename(const QString file_name)
-{
- QString directory = QFileInfo(file_name).absolutePath();
- setLastOpenDir(qUtf8Printable(directory));
-}
-
-void WiresharkApplication::helpTopicAction(topic_action_e action)
-{
- QString url = gchar_free_to_qstring(topic_action_url(action));
-
- if (!url.isEmpty()) {
- QDesktopServices::openUrl(QUrl(url));
- }
-}
-
-const QFont WiresharkApplication::monospaceFont(bool zoomed) const
-{
- if (zoomed) {
- return zoomed_font_;
- }
- return mono_font_;
-}
-
-void WiresharkApplication::setMonospaceFont(const char *font_string) {
-
- if (font_string && strlen(font_string) > 0) {
- mono_font_.fromString(font_string);
-
- // Only accept the font name if it actually exists.
- if (mono_font_.family() == QFontInfo(mono_font_).family()) {
- return;
- }
- }
-
- // https://en.wikipedia.org/wiki/Category:Monospaced_typefaces
- const char *win_default_font = "Consolas";
- const char *win_alt_font = "Lucida Console";
- // SF Mono might be a system font someday. Right now (Oct 2016) it appears
- // to be limited to Xcode and Terminal.
- // http://www.openradar.me/26790072
- // http://www.openradar.me/26862220
- const char *osx_default_font = "SF Mono";
- const QStringList osx_alt_fonts = QStringList() << "Menlo" << "Monaco";
- // XXX Detect Ubuntu systems (e.g. via /etc/os-release and/or
- // /etc/lsb_release) and add "Ubuntu Mono Regular" there.
- // https://design.ubuntu.com/font/
- const char *x11_default_font = "Liberation Mono";
- const QStringList x11_alt_fonts = QStringList() << "DejaVu Sans Mono" << "Bitstream Vera Sans Mono";
- const QStringList fallback_fonts = QStringList() << "Lucida Sans Typewriter" << "Inconsolata" << "Droid Sans Mono" << "Andale Mono" << "Courier New" << "monospace";
- QStringList substitutes;
- int font_size_adjust = 0;
-
- // Try to pick the latest, shiniest fixed-width font for our OS.
-#if defined(Q_OS_WIN)
- const char *default_font = win_default_font;
- substitutes << win_alt_font << osx_default_font << osx_alt_fonts << x11_default_font << x11_alt_fonts << fallback_fonts;
- font_size_adjust = 2;
-#elif defined(Q_OS_MAC)
- const char *default_font = osx_default_font;
- substitutes << osx_alt_fonts << win_default_font << win_alt_font << x11_default_font << x11_alt_fonts << fallback_fonts;
-#else
- const char *default_font = x11_default_font;
- substitutes << x11_alt_fonts << win_default_font << win_alt_font << osx_default_font << osx_alt_fonts << fallback_fonts;
-#endif
-
- mono_font_.setFamily(default_font);
- mono_font_.insertSubstitutions(default_font, substitutes);
- mono_font_.setPointSize(wsApp->font().pointSize() + font_size_adjust);
- mono_font_.setBold(false);
-
- // Retrieve the effective font and apply it.
- mono_font_.setFamily(QFontInfo(mono_font_).family());
-
- g_free(prefs.gui_qt_font_name);
- prefs.gui_qt_font_name = qstring_strdup(mono_font_.toString());
-}
-
-int WiresharkApplication::monospaceTextSize(const char *str)
-{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
- return QFontMetrics(mono_font_).horizontalAdvance(str);
-#else
- return QFontMetrics(mono_font_).width(str);
-#endif
-}
-
-void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bool write_recent_file)
-{
- char *rf_path;
- int rf_open_errno;
- gchar *err_msg = NULL;
-
- gboolean prev_capture_no_interface_load;
- gboolean prev_capture_no_extcap;
-
- /* First check if profile exists */
- if (!profile_exists(profile_name, FALSE)) {
- if (profile_exists(profile_name, TRUE)) {
- char *pf_dir_path, *pf_dir_path2, *pf_filename;
- /* Copy from global profile */
- if (create_persconffile_profile(profile_name, &pf_dir_path) == -1) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "Can't create directory\n\"%s\":\n%s.",
- pf_dir_path, g_strerror(errno));
-
- g_free(pf_dir_path);
- }
-
- if (copy_persconffile_profile(profile_name, profile_name, TRUE, &pf_filename,
- &pf_dir_path, &pf_dir_path2) == -1) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
- pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
-
- g_free(pf_filename);
- g_free(pf_dir_path);
- g_free(pf_dir_path2);
- }
- } else {
- /* No personal and no global profile exists */
- return;
- }
- }
-
- /* Then check if changing to another profile */
- if (profile_name && strcmp (profile_name, get_profile_name()) == 0) {
- return;
- }
-
- prev_capture_no_interface_load = prefs.capture_no_interface_load;
- prev_capture_no_extcap = prefs.capture_no_extcap;
-
- /* Get the current geometry, before writing it to disk */
- emit profileChanging();
-
- if (write_recent_file && profile_exists(get_profile_name(), FALSE))
- {
- /* Write recent file for profile we are leaving, if it still exists */
- write_profile_recent();
- }
-
- /* Set profile name and update the status bar */
- set_profile_name (profile_name);
- emit profileNameChanged(profile_name);
-
- /* Apply new preferences */
- readConfigurationFiles(true);
-
- if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
- "Could not open common recent file\n\"%s\": %s.",
- rf_path, g_strerror(rf_open_errno));
- g_free(rf_path);
- }
- if (recent.gui_fileopen_remembered_dir &&
- test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
- set_last_open_dir(recent.gui_fileopen_remembered_dir);
- }
- timestamp_set_type(recent.gui_time_format);
- timestamp_set_precision(recent.gui_time_precision);
- timestamp_set_seconds_type (recent.gui_seconds_format);
- tap_update_timer_.setInterval(prefs.tap_update_interval);
-
- prefs_to_capture_opts();
- prefs_apply_all();
-#ifdef HAVE_LIBPCAP
- update_local_interfaces();
-#endif
-
- setMonospaceFont(prefs.gui_qt_font_name);
-
- emit columnsChanged();
- emit preferencesChanged();
- emit recentPreferencesRead();
- emit filterExpressionsChanged();
- emit checkDisplayFilter();
- emit captureFilterListChanged();
- emit displayFilterListChanged();
-
- /* Reload color filters */
- if (!color_filters_reload(&err_msg, color_filter_add_cb)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg);
- g_free(err_msg);
- }
-
- /* Load interfaces if settings have changed */
- if (!prefs.capture_no_interface_load &&
- ((prefs.capture_no_interface_load != prev_capture_no_interface_load) ||
- (prefs.capture_no_extcap != prev_capture_no_extcap))) {
- refreshLocalInterfaces();
- }
-
- emit localInterfaceListChanged();
- emit packetDissectionChanged();
-
- /* Write recent_common file to ensure last used profile setting is stored. */
- write_recent();
-}
-
-void WiresharkApplication::reloadLuaPluginsDelayed()
-{
- QTimer::singleShot(0, this, SIGNAL(reloadLuaPlugins()));
-}
-
-const QIcon &WiresharkApplication::normalIcon()
-{
- if (normal_icon_.isNull()) {
- initializeIcons();
- }
- return normal_icon_;
-}
-
-const QIcon &WiresharkApplication::captureIcon()
-{
- if (capture_icon_.isNull()) {
- initializeIcons();
- }
- return capture_icon_;
-}
-
-const QString WiresharkApplication::windowTitleString(QStringList title_parts)
-{
- QMutableStringListIterator tii(title_parts);
- while (tii.hasNext()) {
- QString ti = tii.next();
- if (ti.isEmpty()) tii.remove();
- }
- title_parts.prepend(applicationName());
- return title_parts.join(window_title_separator_);
-}
-
-void WiresharkApplication::applyCustomColorsFromRecent()
-{
- int i = 0;
- bool ok;
- for (GList *custom_color = recent.custom_colors; custom_color; custom_color = custom_color->next) {
- QRgb rgb = QString((const char *)custom_color->data).toUInt(&ok, 16);
- if (ok) {
- QColorDialog::setCustomColor(i++, QColor(rgb));
- }
- }
-}
-
-// Return the first top-level QMainWindow.
-QWidget *WiresharkApplication::mainWindow()
-{
- foreach (QWidget *tlw, topLevelWidgets()) {
- QMainWindow *tlmw = qobject_cast<QMainWindow *>(tlw);
- if (tlmw && tlmw->isVisible()) {
- return tlmw;
- }
- }
- return 0;
-}
-
-void WiresharkApplication::storeCustomColorsInRecent()
-{
- if (QColorDialog::customCount()) {
- prefs_clear_string_list(recent.custom_colors);
- recent.custom_colors = NULL;
- for (int i = 0; i < QColorDialog::customCount(); i++) {
- QRgb rgb = QColorDialog::customColor(i).rgb();
- recent.custom_colors = g_list_append(recent.custom_colors, ws_strdup_printf("%08x", rgb));
- }
- }
-}
-
-void WiresharkApplication::setLastOpenDir(const char *dir_name)
-{
- qint64 len;
- gchar *new_last_open_dir;
-
- if (dir_name && dir_name[0]) {
- len = strlen(dir_name);
- if (dir_name[len-1] == G_DIR_SEPARATOR) {
- new_last_open_dir = g_strconcat(dir_name, (char *)NULL);
- }
- else {
- new_last_open_dir = g_strconcat(dir_name,
- G_DIR_SEPARATOR_S, (char *)NULL);
- }
- } else {
- new_last_open_dir = NULL;
- }
-
- g_free(last_open_dir);
- last_open_dir = new_last_open_dir;
-}
-
-bool WiresharkApplication::event(QEvent *event)
-{
- QString display_filter = NULL;
- if (event->type() == QEvent::FileOpen) {
- QFileOpenEvent *foe = static_cast<QFileOpenEvent *>(event);
- if (foe && foe->file().length() > 0) {
- QString cf_path(foe->file());
- if (initialized_) {
- emit openCaptureFile(cf_path, display_filter, WTAP_TYPE_AUTO);
- } else {
- pending_open_files_.append(cf_path);
- }
- }
- return true;
- }
- return QApplication::event(event);
-}
-
-void WiresharkApplication::clearRecentCaptures() {
- qDeleteAll(recent_captures_);
- recent_captures_.clear();
- emit updateRecentCaptureStatus(NULL, 0, false);
-}
-
-void WiresharkApplication::cleanup()
-{
- software_update_cleanup();
- storeCustomColorsInRecent();
- // Write the user's recent file(s) to disk.
- write_profile_recent();
- write_recent();
-
- qDeleteAll(recent_captures_);
- recent_captures_.clear();
- // We might end up here via exit_application.
- QThreadPool::globalInstance()->waitForDone();
-}
-
-void WiresharkApplication::itemStatusFinished(const QString filename, qint64 size, bool accessible) {
- recent_item_status *ri;
-
- foreach (ri, recent_captures_) {
- if (filename == ri->filename && (size != ri->size || accessible != ri->accessible)) {
- ri->size = size;
- ri->accessible = accessible;
- ri->in_thread = false;
-
- emit updateRecentCaptureStatus(filename, size, accessible);
- }
- }
-}
-
WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
- QApplication(argc, argv),
- initialized_(false),
- is_reloading_lua_(false),
- if_notifier_(NULL),
- active_captures_(0)
+ MainApplication(argc, argv)
{
wsApp = this;
setApplicationName("Wireshark");
-
- MimeDatabaseInitThread *mime_db_init_thread = new(MimeDatabaseInitThread);
- QThreadPool::globalInstance()->start(mime_db_init_thread);
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- FontDatabaseInitThread *font_db_init_thread = new (FontDatabaseInitThread);
- QThreadPool::globalInstance()->start(font_db_init_thread);
-#endif
-
- Q_INIT_RESOURCE(about);
- Q_INIT_RESOURCE(i18n);
- Q_INIT_RESOURCE(layout);
- Q_INIT_RESOURCE(stock_icons);
- Q_INIT_RESOURCE(wsicon);
- Q_INIT_RESOURCE(languages);
-
-#ifdef Q_OS_WIN
- /* RichEd20.DLL is needed for native file dialog filter entries. */
- ws_load_library("riched20.dll");
-#endif // Q_OS_WIN
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- setAttribute(Qt::AA_UseHighDpiPixmaps);
-#endif
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && defined(Q_OS_WIN)
- setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
-#endif
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- setAttribute(Qt::AA_DisableWindowContextHelpButton);
-#endif
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
- styleHints()->setShowShortcutsInContextMenus(true);
-#endif
-
setDesktopFileName(QStringLiteral("org.wireshark.Wireshark"));
-
- //
- // XXX - this means we try to check for the existence of all files
- // in the recent list every 2 seconds; that causes noticeable network
- // traffic if any of them are stored on file servers.
- //
- // QFileSystemWatcher should allow us to watch for files being
- // removed or renamed. It uses kqueues and EVFILT_VNODE on FreeBSD,
- // NetBSD, FSEvents on macOS, inotify on Linux if available, and
- // FindFirstChagneNotification() on Windows. On all other platforms,
- // it just periodically polls, as we're doing now.
- //
- // For unmounts:
- //
- // macOS and FreeBSD deliver NOTE_REVOKE notes for EVFILT_VNODE, and
- // QFileSystemWatcher delivers signals for them, just as it does for
- // NOTE_DELETE and NOTE_RENAME.
- //
- // On Linux, inotify:
- //
- // http://man7.org/linux/man-pages/man7/inotify.7.html
- //
- // appears to deliver "filesystem containing watched object was
- // unmounted" events. It looks as if Qt turns them into "changed"
- // events.
- //
- // On Windows, it's not clearly documented what happens on a handle
- // opened with FindFirstChangeNotification() if the volume on which
- // the path handed to FindFirstChangeNotification() is removed, or
- // ejected, or whatever the Windowsese is for "unmounted". The
- // handle obviously isn't valid any more, but whether it just hangs
- // around and never delivers any notifications or delivers an
- // event that turns into an error indication doesn't seem to be
- // documented. If it just hangs around, I think our main loop will
- // receive a WM_DEVICECHANGE Windows message with DBT_DEVICEREMOVECOMPLETE
- // if an unmount occurs - even for network devices. If we need to watch
- // for those, we can use the winEvent method of the QWidget for the
- // top-level window to get Windows messages.
- //
- // Note also that remote file systems might not report file
- // removal or renames if they're done on the server or done by
- // another client. At least on macOS, they *will* get reported
- // if they're done on the machine running the program doing the
- // kqueue stuff, and, at least in newer versions, should get
- // reported on SMB-mounted (and AFP-mounted?) file systems
- // even if done on the server or another client.
- //
- // But, when push comes to shove, the file manager(s) on the
- // OSes in question probably use the same mechanisms to
- // monitor folders in folder windows or open/save dialogs or...,
- // so my inclination is just to use QFileSystemWatcher.
- //
- // However, that wouldn't catch files that become *re*-accessible
- // by virtue of a file system being re-mounted. The only way to
- // catch *that* would be to watch for mounts and re-check all
- // marked-as-inaccessible files.
- //
- // macOS and FreeBSD also support EVFILT_FS events, which notify you
- // of file system mounts and unmounts. We'd need to add our own
- // kqueue for that, if we can check those with QSocketNotifier.
- //
- // On Linux, at least as of 2006, you're supposed to poll /proc/mounts:
- //
- // https://lkml.org/lkml/2006/2/22/169
- //
- // to discover mounts.
- //
- // On Windows, you'd probably have to watch for WM_DEVICECHANGE events.
- //
- // Then again, with an automounter, a file system containing a
- // recent capture might get unmounted automatically if you haven't
- // referred to anything on that file system for a while, and get
- // treated as inaccessible. However, if you try to access it,
- // the automounter will attempt to re-mount it, so the access *will*
- // succeed if the automounter can remount the file.
- //
- // (Speaking of automounters, repeatedly polling recent files will
- // keep the file system from being unmounted, for what that's worth.)
- //
- // At least on macOS, you can determine whether a file is on an
- // automounted file system by calling statfs() on its path and
- // checking whether MNT_AUTOMOUNTED is set in f_flags. FreeBSD
- // appears to support that flag as well, but no other *BSD appears
- // to.
- //
- // I'm not sure what can be done on Linux.
- //
- recent_timer_.setParent(this);
- connect(&recent_timer_, SIGNAL(timeout()), this, SLOT(refreshRecentCaptures()));
- recent_timer_.start(2000);
-
- packet_data_timer_.setParent(this);
- connect(&packet_data_timer_, SIGNAL(timeout()), this, SLOT(refreshPacketData()));
- packet_data_timer_.start(1000);
-
- tap_update_timer_.setParent(this);
- tap_update_timer_.setInterval(TAP_UPDATE_DEFAULT_INTERVAL);
- connect(this, SIGNAL(appInitialized()), &tap_update_timer_, SLOT(start()));
- connect(&tap_update_timer_, SIGNAL(timeout()), this, SLOT(updateTaps()));
-
- // Application-wide style sheet
- QString app_style_sheet = qApp->styleSheet();
- qApp->setStyleSheet(app_style_sheet);
-
- // If our window text is lighter than the window background, assume the theme is dark.
- QPalette gui_pal = qApp->palette();
- prefs_set_gui_theme_is_dark(gui_pal.windowText().color().value() > gui_pal.window().color().value());
-
-#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
- connect(this, SIGNAL(softwareUpdateQuit()), this, SLOT(quit()), Qt::QueuedConnection);
-#endif
-
- connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup()));
}
WiresharkApplication::~WiresharkApplication()
{
wsApp = NULL;
- clearDynamicMenuGroupItems();
- free_filter_lists();
-}
-
-void WiresharkApplication::registerUpdate(register_action_e action, const char *message)
-{
- emit splashUpdate(action, message);
-}
-
-void WiresharkApplication::emitAppSignal(AppSignal signal)
-{
- switch (signal) {
- case ColumnsChanged:
- emit columnsChanged();
- break;
- case CaptureFilterListChanged:
- emit captureFilterListChanged();
- break;
- case DisplayFilterListChanged:
- emit displayFilterListChanged();
- break;
- case FilterExpressionsChanged:
- emit filterExpressionsChanged();
- break;
- case LocalInterfacesChanged:
- emit localInterfaceListChanged();
- break;
- case NameResolutionChanged:
- emit addressResolutionChanged();
- break;
- case PreferencesChanged:
- emit preferencesChanged();
- break;
- case PacketDissectionChanged:
- emit packetDissectionChanged();
- break;
- case ProfileChanging:
- emit profileChanging();
- break;
- case RecentCapturesChanged:
- emit updateRecentCaptureStatus(NULL, 0, false);
- break;
- case RecentPreferencesRead:
- emit recentPreferencesRead();
- break;
- case FieldsChanged:
- emit fieldsChanged();
- break;
- default:
- break;
- }
-}
-
-// Flush any collected app signals.
-//
-// On macOS emitting PacketDissectionChanged from a dialog can
-// render the application unusable:
-// https://gitlab.com/wireshark/wireshark/-/issues/11361
-// https://gitlab.com/wireshark/wireshark/-/issues/11448
-// Work around the problem by queueing up app signals and emitting them
-// after the dialog is closed.
-//
-// The following bugs might be related although they don't describe the
-// exact behavior we're working around here:
-// https://bugreports.qt.io/browse/QTBUG-38512
-// https://bugreports.qt.io/browse/QTBUG-38600
-void WiresharkApplication::flushAppSignals()
-{
- while (!app_signals_.isEmpty()) {
- wsApp->emitAppSignal(app_signals_.takeFirst());
- }
-}
-
-void WiresharkApplication::emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata)
-{
- emit openStatCommandDialog(menu_path, arg, userdata);
-}
-
-void WiresharkApplication::emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata)
-{
- emit openTapParameterDialog(cfg_abbr, arg, userdata);
-}
-
-// XXX Combine statistics and funnel routines into addGroupItem + groupItems?
-void WiresharkApplication::addDynamicMenuGroupItem(int group, QAction *sg_action)
-{
- if (!dynamic_menu_groups_.contains(group)) {
- dynamic_menu_groups_[group] = QList<QAction *>();
- }
- dynamic_menu_groups_[group] << sg_action;
-}
-
-void WiresharkApplication::appendDynamicMenuGroupItem(int group, QAction *sg_action)
-{
- if (!added_menu_groups_.contains(group)) {
- added_menu_groups_[group] = QList<QAction *>();
- }
- added_menu_groups_[group] << sg_action;
- addDynamicMenuGroupItem(group, sg_action);
-}
-
-void WiresharkApplication::removeDynamicMenuGroupItem(int group, QAction *sg_action)
-{
- if (!removed_menu_groups_.contains(group)) {
- removed_menu_groups_[group] = QList<QAction *>();
- }
- removed_menu_groups_[group] << sg_action;
- dynamic_menu_groups_[group].removeAll(sg_action);
-}
-
-void WiresharkApplication::clearDynamicMenuGroupItems()
-{
- foreach (int group, dynamic_menu_groups_.keys()) {
- dynamic_menu_groups_[group].clear();
- }
-}
-
-void WiresharkApplication::initializeIcons()
-{
- // Do this as late as possible in order to allow time for
- // MimeDatabaseInitThread to do its work.
- QList<int> icon_sizes = QList<int>() << 16 << 24 << 32 << 48 << 64 << 128 << 256 << 512 << 1024;
- foreach (int icon_size, icon_sizes) {
- QString icon_path = QString(":/wsicon/wsicon%1.png").arg(icon_size);
- normal_icon_.addFile(icon_path);
- icon_path = QString(":/wsicon/wsiconcap%1.png").arg(icon_size);
- capture_icon_.addFile(icon_path);
- }
-}
-
-QList<QAction *> WiresharkApplication::dynamicMenuGroupItems(int group)
-{
- if (!dynamic_menu_groups_.contains(group)) {
- return QList<QAction *>();
- }
-
- QList<QAction *> sgi_list = dynamic_menu_groups_[group];
- std::sort(sgi_list.begin(), sgi_list.end(), qActionLessThan);
- return sgi_list;
-}
-
-QList<QAction *> WiresharkApplication::addedMenuGroupItems(int group)
-{
- if (!added_menu_groups_.contains(group)) {
- return QList<QAction *>();
- }
-
- QList<QAction *> sgi_list = added_menu_groups_[group];
- std::sort(sgi_list.begin(), sgi_list.end(), qActionLessThan);
- return sgi_list;
-}
-
-QList<QAction *> WiresharkApplication::removedMenuGroupItems(int group)
-{
- if (!removed_menu_groups_.contains(group)) {
- return QList<QAction *>();
- }
-
- QList<QAction *> sgi_list = removed_menu_groups_[group];
- std::sort(sgi_list.begin(), sgi_list.end(), qActionLessThan);
- return sgi_list;
-}
-
-void WiresharkApplication::clearAddedMenuGroupItems()
-{
- foreach (int group, added_menu_groups_.keys()) {
- added_menu_groups_[group].clear();
- }
-}
-
-void WiresharkApplication::clearRemovedMenuGroupItems()
-{
- foreach (int group, removed_menu_groups_.keys()) {
- foreach (QAction *action, removed_menu_groups_[group]) {
- delete action;
- }
- removed_menu_groups_[group].clear();
- }
-}
-
-#ifdef HAVE_LIBPCAP
-
-static void
-iface_mon_event_cb(const char *iface, int added, int up)
-{
- int present = 0;
- guint ifs, j;
- interface_t *device;
- interface_options *interface_opts;
-
- for (ifs = 0; ifs < global_capture_opts.all_ifaces->len; ifs++) {
- device = &g_array_index(global_capture_opts.all_ifaces, interface_t, ifs);
- if (strcmp(device->name, iface) == 0) {
- present = 1;
- if (!up) {
- /*
- * Interface went down or disappeared; remove all instances
- * of it from the current list of interfaces selected
- * for capturing.
- */
- for (j = 0; j < global_capture_opts.ifaces->len; j++) {
- interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, j);
- if (strcmp(interface_opts->name, device->name) == 0) {
- capture_opts_del_iface(&global_capture_opts, j);
- }
- }
- }
- }
- }
-
- wsApp->emitLocalInterfaceEvent(iface, added, up);
- if (present != up) {
- /*
- * We've been told that there's a new interface or that an old
- * interface is gone; reload the local interface list.
- */
- wsApp->refreshLocalInterfaces();
- }
-}
-
-#endif
-
-void WiresharkApplication::ifChangeEventsAvailable()
-{
-#ifdef HAVE_LIBPCAP
- /*
- * Something's readable from the descriptor for interface
- * monitoring.
- *
- * Have the interface-monitoring code Read whatever interface-change
- * events are available, and call the callback for them.
- */
- iface_mon_event();
-#endif
-}
-
-void WiresharkApplication::emitLocalInterfaceEvent(const char *ifname, int added, int up)
-{
- emit localInterfaceEvent(ifname, added, up);
-}
-
-void WiresharkApplication::refreshLocalInterfaces()
-{
- extcap_clear_interfaces();
-
-#ifdef HAVE_LIBPCAP
- /*
- * Reload the local interface list.
- */
- scan_local_interfaces(main_window_update);
-
- /*
- * Now emit a signal to indicate that the list changed, so that all
- * places displaying the list will get updated.
- *
- * XXX - only if it *did* change.
- */
- emit localInterfaceListChanged();
-#endif
-}
-
-void WiresharkApplication::allSystemsGo()
-{
- QString display_filter = NULL;
- initialized_ = true;
- emit appInitialized();
- while (pending_open_files_.length() > 0) {
- emit openCaptureFile(pending_open_files_.front(), display_filter, WTAP_TYPE_AUTO);
- pending_open_files_.pop_front();
- }
- software_update_init();
-
-#ifdef HAVE_LIBPCAP
- int err;
- err = iface_mon_start(&iface_mon_event_cb);
- if (err == 0) {
- if_notifier_ = new QSocketNotifier(iface_mon_get_sock(),
- QSocketNotifier::Read, this);
- connect(if_notifier_, SIGNAL(activated(int)), SLOT(ifChangeEventsAvailable()));
- }
-#endif
-}
-
-_e_prefs *WiresharkApplication::readConfigurationFiles(bool reset)
-{
- e_prefs *prefs_p;
-
- if (reset) {
- //
- // Reset current preferences and enabled/disabled protocols and
- // heuristic dissectors before reading.
- // (Needed except when this is called at startup.)
- //
- prefs_reset();
- proto_reenable_all();
- }
-
- /* Load libwireshark settings from the current profile. */
- prefs_p = epan_load_settings();
-
-#ifdef _WIN32
- /* if the user wants a console to be always there, well, we should open one for him */
- if (prefs_p->gui_console_open == console_open_always) {
- create_console();
- }
-#endif
-
- /* Read the capture filter file. */
- read_filter_list(CFILTER_LIST);
-
- return prefs_p;
-}
-
-QList<recent_item_status *> WiresharkApplication::recentItems() const {
- return recent_captures_;
-}
-
-void WiresharkApplication::addRecentItem(const QString filename, qint64 size, bool accessible) {
- recent_item_status *ri = new(recent_item_status);
-
- ri->filename = filename;
- ri->size = size;
- ri->accessible = accessible;
- ri->in_thread = false;
- recent_captures_.prepend(ri);
-
- itemStatusFinished(filename, size, accessible);
-}
-
-void WiresharkApplication::removeRecentItem(const QString &filename)
-{
- QMutableListIterator<recent_item_status *> rii(recent_captures_);
-
- while (rii.hasNext()) {
- recent_item_status *ri = rii.next();
-#ifdef _WIN32
- /* Do a case insensitive compare on win32 */
- if (ri->filename.compare(filename, Qt::CaseInsensitive) == 0) {
-#else
- /* Do a case sensitive compare on UN*Xes.
- *
- * XXX - on UN*Xes such as macOS, where you can use pathconf()
- * to check whether a given file system is case-sensitive or
- * not, we should check whether this particular file system
- * is case-sensitive and do the appropriate comparison.
- */
- if (ri->filename.compare(filename) == 0) {
-#endif
- rii.remove();
- delete(ri);
- }
- }
-
- emit updateRecentCaptureStatus(NULL, 0, false);
-}
-
-static void switchTranslator(QTranslator& myTranslator, const QString& filename,
- const QString& searchPath)
-{
- wsApp->removeTranslator(&myTranslator);
-
- if (myTranslator.load(filename, searchPath))
- wsApp->installTranslator(&myTranslator);
-}
-
-void WiresharkApplication::loadLanguage(const QString newLanguage)
-{
- QLocale locale;
- QString localeLanguage;
-
- if (newLanguage.isEmpty() || newLanguage == USE_SYSTEM_LANGUAGE) {
- localeLanguage = QLocale::system().name();
- } else {
- localeLanguage = newLanguage;
- }
-
- locale = QLocale(localeLanguage);
- QLocale::setDefault(locale);
- switchTranslator(wsApp->translator,
- QString("wireshark_%1.qm").arg(localeLanguage), QString(":/i18n/"));
- if (QFile::exists(QString("%1/%2/wireshark_%3.qm")
- .arg(get_datafile_dir()).arg("languages").arg(localeLanguage)))
- switchTranslator(wsApp->translator,
- QString("wireshark_%1.qm").arg(localeLanguage), QString(get_datafile_dir()) + QString("/languages"));
- if (QFile::exists(QString("%1/wireshark_%3.qm")
- .arg(gchar_free_to_qstring(get_persconffile_path("languages", FALSE))).arg(localeLanguage)))
- switchTranslator(wsApp->translator,
- QString("wireshark_%1.qm").arg(localeLanguage), gchar_free_to_qstring(get_persconffile_path("languages", FALSE)));
- if (QFile::exists(QString("%1/qt_%2.qm")
- .arg(get_datafile_dir()).arg(localeLanguage))) {
- switchTranslator(wsApp->translatorQt,
- QString("qt_%1.qm").arg(localeLanguage), QString(get_datafile_dir()));
- } else if (QFile::exists(QString("%1/qt_%2.qm")
- .arg(get_datafile_dir()).arg(localeLanguage.left(localeLanguage.lastIndexOf('_'))))) {
- switchTranslator(wsApp->translatorQt,
- QString("qt_%1.qm").arg(localeLanguage.left(localeLanguage.lastIndexOf('_'))), QString(get_datafile_dir()));
- } else {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
- QString translationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
-#else
- QString translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
-#endif
- switchTranslator(wsApp->translatorQt, QString("qt_%1.qm").arg(localeLanguage), translationPath);
- }
-}
-
-void WiresharkApplication::doTriggerMenuItem(MainMenuItem menuItem)
-{
- switch (menuItem)
- {
- case FileOpenDialog:
- emit openCaptureFile(QString(), QString(), WTAP_TYPE_AUTO);
- break;
- case CaptureOptionsDialog:
- emit openCaptureOptions();
- break;
- }
-}
-
-void WiresharkApplication::zoomTextFont(int zoomLevel)
-{
- // Scale by 10%, rounding to nearest half point, minimum 1 point.
- // XXX Small sizes repeat. It might just be easier to create a map of multipliers.
- qreal zoom_size = mono_font_.pointSize() * 2 * qPow(qreal(1.1), zoomLevel);
- zoom_size = qRound(zoom_size) / qreal(2.0);
- zoom_size = qMax(zoom_size, qreal(1.0));
-
- zoomed_font_ = mono_font_;
- zoomed_font_.setPointSizeF(zoom_size);
- emit zoomMonospaceFont(zoomed_font_);
-
- QFont zoomed_application_font = font();
- zoomed_application_font.setPointSizeF(zoom_size);
- emit zoomRegularFont(zoomed_application_font);
-}
-
-#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
-bool WiresharkApplication::softwareUpdateCanShutdown() {
- software_update_ok_ = true;
- // At this point the update is ready to install, but WinSparkle has
- // not yet run the installer. We need to close our "Wireshark is
- // running" mutexes along with those of our child processes, e.g.
- // dumpcap.
-
- // Step 1: See if we have any open files.
- emit softwareUpdateRequested();
- if (software_update_ok_ == true) {
-
- // Step 2: Close the "running" mutexes.
- emit softwareUpdateClose();
- close_app_running_mutex();
- }
- return software_update_ok_;
-}
-
-void WiresharkApplication::softwareUpdateShutdownRequest() {
- // At this point the installer has been launched. Neither Wireshark nor
- // its children should have any "Wireshark is running" mutexes open.
- // The main window should be closed.
-
- // Step 3: Quit.
- emit softwareUpdateQuit();
-}
-#endif
-
-void WiresharkApplication::captureEventHandler(CaptureEvent ev)
-{
- switch(ev.captureContext())
- {
-#ifdef HAVE_LIBPCAP
- case CaptureEvent::Update:
- case CaptureEvent::Fixed:
- switch (ev.eventType())
- {
- case CaptureEvent::Started:
- active_captures_++;
- emit captureActive(active_captures_);
- break;
- case CaptureEvent::Finished:
- active_captures_--;
- emit captureActive(active_captures_);
- break;
- default:
- break;
- }
- break;
-#endif
- case CaptureEvent::File:
- case CaptureEvent::Reload:
- case CaptureEvent::Rescan:
- switch (ev.eventType())
- {
- case CaptureEvent::Started:
- QTimer::singleShot(TAP_UPDATE_DEFAULT_INTERVAL / 5, this, SLOT(updateTaps()));
- QTimer::singleShot(TAP_UPDATE_DEFAULT_INTERVAL / 2, this, SLOT(updateTaps()));
- break;
- case CaptureEvent::Finished:
- updateTaps();
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
-}
-
-void WiresharkApplication::pushStatus(StatusInfo status, const QString &message, const QString &messagetip)
-{
- if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
- return;
-
- MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
- if (! mw->main_ui_ || ! mw->main_ui_->statusBar)
- return;
-
- MainStatusBar * bar = mw->main_ui_->statusBar;
-
- switch(status)
- {
- case FilterSyntax:
- bar->pushGenericStatus(MainStatusBar::STATUS_CTX_FILTER, message);
- break;
- case FieldStatus:
- bar->pushGenericStatus(MainStatusBar::STATUS_CTX_FIELD, message);
- break;
- case FileStatus:
- bar->pushGenericStatus(MainStatusBar::STATUS_CTX_FILE, message, messagetip);
- break;
- case ByteStatus:
- bar->pushGenericStatus(MainStatusBar::STATUS_CTX_BYTE, message);
- break;
- case BusyStatus:
- bar->pushGenericStatus(MainStatusBar::STATUS_CTX_PROGRESS, message, messagetip);
- break;
- case TemporaryStatus:
- bar->pushGenericStatus(MainStatusBar::STATUS_CTX_TEMPORARY, message);
- break;
- }
-}
-
-void WiresharkApplication::popStatus(StatusInfo status)
-{
- if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
- return;
-
- MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
- if (! mw->main_ui_ || ! mw->main_ui_->statusBar)
- return;
-
- MainStatusBar * bar = mw->main_ui_->statusBar;
-
- switch(status)
- {
- case FilterSyntax:
- bar->popGenericStatus(MainStatusBar::STATUS_CTX_FILTER);
- break;
- case FieldStatus:
- bar->popGenericStatus(MainStatusBar::STATUS_CTX_FIELD);
- break;
- case FileStatus:
- bar->popGenericStatus(MainStatusBar::STATUS_CTX_FILE);
- break;
- case ByteStatus:
- bar->popGenericStatus(MainStatusBar::STATUS_CTX_BYTE);
- break;
- case BusyStatus:
- bar->popGenericStatus(MainStatusBar::STATUS_CTX_PROGRESS);
- break;
- case TemporaryStatus:
- bar->popGenericStatus(MainStatusBar::STATUS_CTX_TEMPORARY);
- break;
- }
-}
-
-void WiresharkApplication::gotoFrame(int frame)
-{
- if (! mainWindow() || ! qobject_cast<MainWindow *>(mainWindow()))
- return;
-
- MainWindow * mw = qobject_cast<MainWindow *>(mainWindow());
- mw->gotoFrame(frame);
}
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index f13c77d91f..7685d2d22a 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -10,229 +10,15 @@
#ifndef WIRESHARK_APPLICATION_H
#define WIRESHARK_APPLICATION_H
-#include <config.h>
+#include <main_application.h>
-#include <glib.h>
-
-#include "wsutil/feature_list.h"
-
-#include "epan/register.h"
-
-#include "ui/help_url.h"
-
-#include <QApplication>
-#include <QDir>
-#include <QFont>
-#include <QIcon>
-#include <QTimer>
-#include <QTranslator>
-
-#include "capture_event.h"
-
-struct _e_prefs;
-
-class QAction;
-class QSocketNotifier;
-
-// Recent items:
-// - Read from prefs
-// - Add from open file
-// - Check current list
-// - Signal updated item
-// -
-typedef struct _recent_item_status {
- QString filename;
- qint64 size;
- bool accessible;
- bool in_thread;
-} recent_item_status;
-
-class WiresharkApplication : public QApplication
+class WiresharkApplication : public MainApplication
{
- Q_OBJECT
public:
explicit WiresharkApplication(int &argc, char **argv);
~WiresharkApplication();
-
- enum AppSignal {
- CaptureFilterListChanged,
- ColumnsChanged,
- DisplayFilterListChanged,
- FieldsChanged,
- FilterExpressionsChanged,
- LocalInterfacesChanged,
- NameResolutionChanged,
- PacketDissectionChanged,
- PreferencesChanged,
- ProfileChanging,
- RecentCapturesChanged,
- RecentPreferencesRead
- };
-
- enum MainMenuItem {
- FileOpenDialog,
- CaptureOptionsDialog
- };
-
- enum StatusInfo {
- FilterSyntax,
- FieldStatus,
- FileStatus,
- BusyStatus,
- ByteStatus,
- TemporaryStatus
- };
-
- void registerUpdate(register_action_e action, const char *message);
- void emitAppSignal(AppSignal signal);
- // Emitting app signals (PacketDissectionChanged in particular) from
- // dialogs on macOS can be problematic. Dialogs should call queueAppSignal
- // instead.
- void queueAppSignal(AppSignal signal) { app_signals_ << signal; }
- void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata);
- void emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata);
- void addDynamicMenuGroupItem(int group, QAction *sg_action);
- void appendDynamicMenuGroupItem(int group, QAction *sg_action);
- void removeDynamicMenuGroupItem(int group, QAction *sg_action);
- QList<QAction *> dynamicMenuGroupItems(int group);
- QList<QAction *> addedMenuGroupItems(int group);
- QList<QAction *> removedMenuGroupItems(int group);
- void clearAddedMenuGroupItems();
- void clearRemovedMenuGroupItems();
-
- void allSystemsGo();
- void emitLocalInterfaceEvent(const char *ifname, int added, int up);
- void refreshLocalInterfaces();
- struct _e_prefs * readConfigurationFiles(bool reset);
- QList<recent_item_status *> recentItems() const;
- void addRecentItem(const QString filename, qint64 size, bool accessible);
- void removeRecentItem(const QString &filename);
- QDir lastOpenDir();
- void setLastOpenDir(const char *dir_name);
- void setLastOpenDirFromFilename(QString file_name);
- void helpTopicAction(topic_action_e action);
- const QFont monospaceFont(bool zoomed = false) const;
- void setMonospaceFont(const char *font_string);
- int monospaceTextSize(const char *str);
- void setConfigurationProfile(const gchar *profile_name, bool write_recent_file = true);
- void reloadLuaPluginsDelayed();
- bool isInitialized() { return initialized_; }
- void setReloadingLua(bool is_reloading) { is_reloading_lua_ = is_reloading; }
- bool isReloadingLua() { return is_reloading_lua_; }
- const QIcon &normalIcon();
- const QIcon &captureIcon();
- const QString &windowTitleSeparator() const { return window_title_separator_; }
- const QString windowTitleString(QStringList title_parts);
- const QString windowTitleString(QString title_part) { return windowTitleString(QStringList() << title_part); }
- void applyCustomColorsFromRecent();
-#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
- void rejectSoftwareUpdate() { software_update_ok_ = false; }
- bool softwareUpdateCanShutdown();
- void softwareUpdateShutdownRequest();
-#endif
- QWidget *mainWindow();
-
- QTranslator translator;
- QTranslator translatorQt;
- void loadLanguage(const QString language);
-
- void doTriggerMenuItem(MainMenuItem menuItem);
-
- void zoomTextFont(int zoomLevel);
-
- void pushStatus(StatusInfo sinfo, const QString &message, const QString &messagetip = QString());
- void popStatus(StatusInfo sinfo);
-
- void gotoFrame(int frameNum);
-
-private:
- bool initialized_;
- bool is_reloading_lua_;
- QFont mono_font_;
- QFont zoomed_font_;
- QTimer recent_timer_;
- QTimer packet_data_timer_;
- QTimer tap_update_timer_;
- QList<QString> pending_open_files_;
- QSocketNotifier *if_notifier_;
- QIcon normal_icon_;
- QIcon capture_icon_;
- static QString window_title_separator_;
- QList<AppSignal> app_signals_;
- int active_captures_;
-#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
- bool software_update_ok_;
-#endif
-
- void storeCustomColorsInRecent();
- void clearDynamicMenuGroupItems();
- void initializeIcons();
-
-protected:
- bool event(QEvent *event);
-
-signals:
- void appInitialized();
- void localInterfaceEvent(const char *ifname, int added, int up);
- void localInterfaceListChanged();
- void openCaptureFile(QString cf_path, QString display_filter, unsigned int type);
- void openCaptureOptions();
- void recentPreferencesRead();
- void updateRecentCaptureStatus(const QString &filename, qint64 size, bool accessible);
- void splashUpdate(register_action_e action, const char *message);
- void profileChanging();
- void profileNameChanged(const gchar *profile_name);
-
- void columnsChanged(); // XXX This recreates the packet list. We might want to rename it accordingly.
- void captureFilterListChanged();
- void displayFilterListChanged();
- void filterExpressionsChanged();
- void packetDissectionChanged();
- void preferencesChanged();
- void addressResolutionChanged();
- void columnDataChanged();
- void checkDisplayFilter();
- void fieldsChanged();
- void reloadLuaPlugins();
-#if defined(HAVE_SOFTWARE_UPDATE) && defined(Q_OS_WIN)
- // Each of these are called from a separate thread.
- void softwareUpdateRequested();
- void softwareUpdateClose();
- void softwareUpdateQuit();
-#endif
-
- void openStatCommandDialog(const QString &menu_path, const char *arg, void *userdata);
- void openTapParameterDialog(const QString cfg_str, const QString arg, void *userdata);
-
- /* Signals activation and stop of a capture. The value provides the number of active captures */
- void captureActive(int);
-
- void zoomRegularFont(const QFont & font);
- void zoomMonospaceFont(const QFont & font);
-
-public slots:
- void clearRecentCaptures();
- void refreshRecentCaptures();
-
- void captureEventHandler(CaptureEvent);
-
- // Flush queued app signals. Should be called from the main window after
- // each dialog that calls queueAppSignal closes.
- void flushAppSignals();
-
-private slots:
- void updateTaps();
-
- void cleanup();
- void ifChangeEventsAvailable();
- void itemStatusFinished(const QString filename = "", qint64 size = 0, bool accessible = false);
- void refreshPacketData();
};
extern WiresharkApplication *wsApp;
-/** Global compile time version info */
-extern void gather_wireshark_qt_compiled_info(feature_list l);
-/** Global runtime version info */
-extern void gather_wireshark_runtime_info(feature_list l);
#endif // WIRESHARK_APPLICATION_H
diff --git a/ui/qt/wireshark_dialog.cpp b/ui/qt/wireshark_dialog.cpp
index 7d72c2ae64..cbdc5fde63 100644
--- a/ui/qt/wireshark_dialog.cpp
+++ b/ui/qt/wireshark_dialog.cpp
@@ -16,7 +16,7 @@
#include <epan/packet.h>
#include <epan/tap.h>
-#include "wireshark_application.h"
+#include "main_application.h"
#include "wireshark_dialog.h"
#include <ui/qt/utils/qt_ui_utils.h>
#include "ui/recent.h"
@@ -36,7 +36,7 @@ WiresharkDialog::WiresharkDialog(QWidget &parent, CaptureFile &capture_file) :
retap_depth_(0),
dialog_closed_(false)
{
- setWindowIcon(wsApp->normalIcon());
+ setWindowIcon(mainApp->normalIcon());
setWindowSubtitle(QString());
connect(&cap_file_, &CaptureFile::captureEvent, this, &WiresharkDialog::captureEvent);
@@ -59,7 +59,7 @@ void WiresharkDialog::setWindowSubtitle(const QString &subtitle)
{
subtitle_ = subtitle;
- QString title = wsApp->windowTitleString(QStringList() << subtitle_ << cap_file_.fileTitle());
+ QString title = mainApp->windowTitleString(QStringList() << subtitle_ << cap_file_.fileTitle());
QDialog::setWindowTitle(title);
}
diff --git a/ui/qt/wlan_statistics_dialog.cpp b/ui/qt/wlan_statistics_dialog.cpp
index 8cbe129659..36f0f375c7 100644
--- a/ui/qt/wlan_statistics_dialog.cpp
+++ b/ui/qt/wlan_statistics_dialog.cpp
@@ -21,7 +21,7 @@
#include <ui/qt/models/percent_bar_delegate.h>
#include <ui/qt/utils/qt_ui_utils.h>
-#include "wireshark_application.h"
+#include "main_application.h"
// To do:
// - Add the name resolution checkbox
@@ -726,7 +726,7 @@ wlan_statistics_init(const char *args, void*) {
if (args_l.length() > 2) {
filter = QStringList(args_l.mid(2)).join(",").toUtf8();
}
- wsApp->emitStatCommandSignal("WlanStatistics", filter.constData(), NULL);
+ mainApp->emitStatCommandSignal("WlanStatistics", filter.constData(), NULL);
}
static stat_tap_ui wlan_statistics_ui = {