aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-12-29 13:53:11 -0800
committerAnders Broman <a.broman58@gmail.com>2015-12-30 05:34:39 +0000
commitb152ca3c20e20da901e0678ea9d98fd9af090033 (patch)
tree518180f254e3608166a7ee0130a3293967ce4fe5 /ui/qt
parent8c2aa715c8b4f7dc9853f4361560d7a277fdccb2 (diff)
Qt: Show physical interfaces first.
List physical interfaces before virtual (extcap) interfaces in the main window. As cool and interesting as the randpkt interface is, I'm not sure it should come before interfaces with live traffic. Resize our columns once instead of each time we add an interface. Change-Id: I917532ab1d76b48c3e307d1f5a1c6c02def4e8aa Reviewed-on: https://code.wireshark.org/review/12933 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/interface_tree.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp
index 797f4da477..a506e13376 100644
--- a/ui/qt/interface_tree.cpp
+++ b/ui/qt/interface_tree.cpp
@@ -169,6 +169,11 @@ void InterfaceTree::display()
reset it to ensure that the interface list is properly displayed */
resetColumnCount();
+ // List physical interfaces first. Alternatively we could sort them by
+ // traffic, interface name, or most recently used.
+ QList<QTreeWidgetItem *> phys_ifaces;
+ QList<QTreeWidgetItem *> virt_ifaces;
+
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
@@ -197,16 +202,12 @@ void InterfaceTree::display()
ti->setFont(IFTREE_COL_NAME, ti_font );
}
}
- }
-#endif
- addTopLevelItem(ti);
- // XXX Add other device information
- resizeColumnToContents(IFTREE_COL_NAME);
- resizeColumnToContents(IFTREE_COL_STATS);
-
-#if HAVE_EXTCAP
- resizeColumnToContents(IFTREE_COL_EXTCAP);
+ virt_ifaces << ti;
+ } else
#endif
+ {
+ phys_ifaces << ti;
+ }
if (strstr(prefs.capture_device, device.name) != NULL) {
device.selected = TRUE;
@@ -218,6 +219,18 @@ void InterfaceTree::display()
ti->setSelected(true);
}
}
+
+ if (!phys_ifaces.isEmpty()) addTopLevelItems(phys_ifaces);
+ if (!virt_ifaces.isEmpty()) addTopLevelItems(virt_ifaces);
+
+ // XXX Add other device information
+ resizeColumnToContents(IFTREE_COL_NAME);
+ resizeColumnToContents(IFTREE_COL_STATS);
+
+#if HAVE_EXTCAP
+ resizeColumnToContents(IFTREE_COL_EXTCAP);
+#endif
+
#else
QTreeWidgetItem *ti = new QTreeWidgetItem();