diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2015-08-22 22:59:42 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2015-08-24 07:43:22 +0000 |
commit | 7176958357cc1e993931463e40814d37083de260 (patch) | |
tree | eff3e71a6125476134bcf4434fc5540247a74d64 /ui | |
parent | 25ec198dd4dd9f8cfcef56548501391d49b9fa40 (diff) |
Close packet dialogs when reload Lua plugins.
We could keep the dialogs with the current content if postponing
proto_free_deregistered_fields() until all dialogs are closed.
This would give a feature where the user is able to compare packets
before and after a reload.
Or we could add functions in PacketDialog to reload the packet details
in all open dialogs. This would give a feature to always have a
updated dialog for all interesting packets.
Change-Id: I805352b65844eafafafc54cd61f08b4605416e64
Reviewed-on: https://code.wireshark.org/review/10201
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/main_window.h | 3 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 17 | ||||
-rw-r--r-- | ui/qt/packet_dialog.cpp | 12 | ||||
-rw-r--r-- | ui/qt/packet_dialog.h | 4 |
4 files changed, 36 insertions, 0 deletions
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index ea33df7550..b4206b6a52 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -138,6 +138,7 @@ private: QActionGroup *time_display_actions_; QActionGroup *time_precision_actions_; FunnelStatistics *funnel_statistics_; + QList<QDialog *> packet_dialogs_; bool capture_stopping_; bool capture_filter_valid_; @@ -239,6 +240,7 @@ public slots: void captureFileSaveStarted(const QString &file_path); void filterExpressionsChanged(); + void packetDialogClosed(QDialog *); private slots: // Manually connected slots (no "on_<object>_<signal>"). @@ -387,6 +389,7 @@ private slots: void on_actionViewResizeColumns_triggered(); void openPacketDialog(bool from_reference = false); + void closePacketDialogs(); void on_actionViewShowPacketInNewWindow_triggered(); void on_actionContextShowLinkedPacketInNewWindow_triggered(); void on_actionViewReload_triggered(); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 2749859c83..34ba3cefdc 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -2294,12 +2294,28 @@ void MainWindow::openPacketDialog(bool from_reference) connect(this, SIGNAL(monospaceFontChanged(QFont)), packet_dialog, SIGNAL(monospaceFontChanged(QFont))); + connect(packet_dialog, SIGNAL(packetDialogClosed(QDialog *)), + this, SLOT(packetDialogClosed(QDialog *))); zoomText(); // Emits monospaceFontChanged + packet_dialogs_.append(packet_dialog); packet_dialog->show(); } } +void MainWindow::closePacketDialogs() +{ + QList<QDialog *> packet_dialogs_copy(packet_dialogs_); + foreach(QDialog *packet_dialog, packet_dialogs_copy) { + packet_dialog->close(); + } +} + +void MainWindow::packetDialogClosed(QDialog *packet_dialog) +{ + packet_dialogs_.removeOne(packet_dialog); +} + void MainWindow::on_actionViewShowPacketInNewWindow_triggered() { openPacketDialog(); @@ -2489,6 +2505,7 @@ void MainWindow::on_actionAnalyzeReloadLuaPlugins_triggered() wslua_reload_plugins(NULL, NULL); funnel_statistics_reload_menus(); reloadDynamicMenus(); + closePacketDialogs(); // Preferences may have been deleted so close all widgets using prefs proto_tree_->closeContextMenu(); diff --git a/ui/qt/packet_dialog.cpp b/ui/qt/packet_dialog.cpp index 05f8878903..8387fdc089 100644 --- a/ui/qt/packet_dialog.cpp +++ b/ui/qt/packet_dialog.cpp @@ -120,6 +120,18 @@ PacketDialog::~PacketDialog() g_free(packet_data_); } +void PacketDialog::accept() +{ + emit packetDialogClosed(this); + WiresharkDialog::accept(); +} + +void PacketDialog::reject() +{ + emit packetDialogClosed(this); + WiresharkDialog::reject(); +} + void PacketDialog::captureFileClosing() { delete byte_view_tab_; diff --git a/ui/qt/packet_dialog.h b/ui/qt/packet_dialog.h index 4f4cde7885..8b35bc8c95 100644 --- a/ui/qt/packet_dialog.h +++ b/ui/qt/packet_dialog.h @@ -44,6 +44,7 @@ public: signals: void monospaceFontChanged(QFont); + void packetDialogClosed(QDialog *); private slots: void captureFileClosing(); @@ -52,6 +53,9 @@ private slots: void on_buttonBox_helpRequested(); private: + void accept(); + void reject(); + Ui::PacketDialog *ui; QString col_info_; |