diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2015-11-28 23:54:52 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2015-11-29 19:00:49 +0000 |
commit | bb206e8c6cc5a6d82e033d3e01e4e2202f5246bf (patch) | |
tree | 0c9708b97cb7f1d884a2d2eba60dca7dba3890bf | |
parent | af152e48dd2ba3ffa68276e9e8beb3e88b1d2131 (diff) | |
download | wireshark-bb206e8c6cc5a6d82e033d3e01e4e2202f5246bf.tar.gz |
Qt: Check capture filter only once when selecting interface(s)
Changed to only check capture filter once (for each active DLT) when
changing selected interface(s). This optimizes filter checking and
avoids a "No interfaces selected" error when processing unselected
interfaces before selected.
Added a small optimization fetching device_name outside loop.
Bug: 11671
Change-Id: I01ed7a99a2a9ced9a86774a78bec2ba27b4bb97c
Reviewed-on: https://code.wireshark.org/review/12268
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
(cherry picked from commit e75f74add63243fcaf620e47ae232f26a5b6dd67)
Reviewed-on: https://code.wireshark.org/review/12292
-rw-r--r-- | ui/qt/interface_tree.cpp | 6 | ||||
-rw-r--r-- | ui/qt/interface_tree.h | 2 | ||||
-rw-r--r-- | ui/qt/main_welcome.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp index 661304c511..feff96e284 100644 --- a/ui/qt/interface_tree.cpp +++ b/ui/qt/interface_tree.cpp @@ -329,8 +329,8 @@ void InterfaceTree::updateSelectedInterfaces() global_capture_opts.num_selected = 0; while (*iter) { + QString device_name = (*iter)->data(IFTREE_COL_NAME, Qt::UserRole).value<QString>(); for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { - QString device_name = (*iter)->data(IFTREE_COL_NAME, Qt::UserRole).value<QString>(); interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); if (device_name.compare(QString().fromUtf8(device.name)) == 0) { if (!device.locked) { @@ -344,8 +344,6 @@ void InterfaceTree::updateSelectedInterfaces() global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i); g_array_insert_val(global_capture_opts.all_ifaces, i, device); - emit interfaceUpdated(device.name, device.selected); - device.locked = FALSE; global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i); g_array_insert_val(global_capture_opts.all_ifaces, i, device); @@ -355,6 +353,8 @@ void InterfaceTree::updateSelectedInterfaces() } iter++; } + + emit interfacesUpdated(); #endif // HAVE_LIBPCAP } diff --git a/ui/qt/interface_tree.h b/ui/qt/interface_tree.h index 7b08172094..f4371605ef 100644 --- a/ui/qt/interface_tree.h +++ b/ui/qt/interface_tree.h @@ -69,7 +69,7 @@ private: #endif // HAVE_LIBPCAP signals: - void interfaceUpdated(const char *device_name, bool selected); + void interfacesUpdated(); public slots: // add_interface_to_list diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp index 609b459f14..4eb08a17ee 100644 --- a/ui/qt/main_welcome.cpp +++ b/ui/qt/main_welcome.cpp @@ -165,7 +165,7 @@ MainWelcome::MainWelcome(QWidget *parent) : connect(welcome_ui_->interfaceTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(interfaceClicked(QTreeWidgetItem*,int))); #endif - connect(welcome_ui_->interfaceTree, SIGNAL(interfaceUpdated(const char*,bool)), + connect(welcome_ui_->interfaceTree, SIGNAL(interfacesUpdated()), welcome_ui_->captureFilterComboBox, SIGNAL(interfacesChanged())); connect(welcome_ui_->captureFilterComboBox, SIGNAL(pushFilterSyntaxStatus(const QString&)), this, SIGNAL(pushFilterSyntaxStatus(const QString&))); |