From 9ccf2e04c84776c8f23420ce9fdbfabb3735e75f Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 25 Jul 2014 00:44:50 -0700 Subject: [PATCH] Make Capture -> Refresh Interfaces work. Add a "refresh the local interfaces" method to WiresharkApplication, which reloads the interface list and emits the "interface list changed" signal, and invoke it from the Capture -> Refresh Interfaces menu item. Change-Id: I9641e4b341eb44d773c556691d8bb9dac776ea9d Reviewed-on: https://code.wireshark.org/review/3195 Reviewed-by: Guy Harris --- ui/qt/main_window.h | 1 + ui/qt/main_window_slots.cpp | 5 +++++ ui/qt/wireshark_application.cpp | 18 ++++++++++++++++++ ui/qt/wireshark_application.h | 1 + 4 files changed, 25 insertions(+) diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 98c205d2df..f7122d1ad7 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -286,6 +286,7 @@ private slots: #ifdef HAVE_LIBPCAP void on_actionCaptureOptions_triggered(); + void on_actionCaptureRefreshInterfaces_triggered(); #endif void matchFieldFilter(FilterAction::Action action, FilterAction::ActionType filter_type); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index b8cc881c2b..d9c441a2aa 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -2390,6 +2390,11 @@ void MainWindow::on_actionCaptureOptions_triggered() capture_interfaces_dialog_.raise(); capture_interfaces_dialog_.activateWindow(); } + +void MainWindow::on_actionCaptureRefreshInterfaces_triggered() +{ + wsApp->refreshLocalInterfaces(); +} #endif diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index 7630530c23..4e524f1ac3 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -706,6 +706,24 @@ void WiresharkApplication::ifChangeEventsAvailable() #endif } +void WiresharkApplication::refreshLocalInterfaces() +{ +#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; diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h index b3ad1dcb24..6b758d2c8a 100644 --- a/ui/qt/wireshark_application.h +++ b/ui/qt/wireshark_application.h @@ -74,6 +74,7 @@ public: void emitAppSignal(AppSignal signal); void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata); void allSystemsGo(); + void refreshLocalInterfaces(); e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path); QList recentItems() const; void addRecentItem(const QString &filename, qint64 size, bool accessible);