diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-02-12 17:13:40 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-02-23 19:38:19 +0000 |
commit | fa809400bbe8e8129f21bc72d7d4600b997195c5 (patch) | |
tree | d4689f27b0f7ca380f8a001eb803cbc328481a51 /ui/qt | |
parent | b5ac91399cccdf065d065497c83ca8e8ac864fe7 (diff) | |
download | wireshark-fa809400bbe8e8129f21bc72d7d4600b997195c5.tar.gz |
Qt: Add tooltips to the welcome screen interfaces.
Show the interface address and saved capture filter.
Change-Id: I8403f97ea584783abdbe2d89b8c9061a00ececdf
Reviewed-on: https://code.wireshark.org/review/14100
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/interface_tree.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp index 30f0fd5e9f..3f7fa7d849 100644 --- a/ui/qt/interface_tree.cpp +++ b/ui/qt/interface_tree.cpp @@ -46,7 +46,6 @@ #include <QTimer> // To do: -// - Add tooltips to each tree item to show addresses, filters, and other info. #ifdef HAVE_LIBPCAP const int stat_update_interval_ = 1000; // ms @@ -192,6 +191,32 @@ void InterfaceTree::display() InterfaceTreeWidgetItem *ti = new InterfaceTreeWidgetItem(); ti->setText(IFTREE_COL_NAME, QString().fromUtf8(device.display_name)); + + // To do: + // - Sync with code in CaptureInterfacesDialog. + // - Add more information to the tooltip. + QString tt_str = "<p>"; + if (device.no_addresses > 0) { + tt_str += QString("%1: %2").arg(device.no_addresses > 1 ? tr("Addresses") : tr("Address")).arg(device.addresses); + tt_str.replace('\n', ", "); + } else { + tt_str = tr("No addresses"); + } + tt_str += "<br/>"; + QString cfilter = gchar_free_to_qstring(capture_dev_user_cfilter_find(device.name)); + if (cfilter.isEmpty()) { + tt_str += tr("No capture filter"); + } else { + tt_str += QString("%1: %2") + .arg(tr("Capture filter")) + .arg(cfilter); + } + tt_str += "</p>"; + + for (int col = 0; col < columnCount(); col++) { + ti->setToolTip(col, tt_str); + } + ti->setData(IFTREE_COL_NAME, Qt::UserRole, QString(device.name)); ti->setData(IFTREE_COL_STATS, Qt::UserRole, qVariantFromValue(&ti->points)); #if HAVE_EXTCAP |