aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-01-09 12:47:45 -0800
committerAnders Broman <a.broman58@gmail.com>2020-01-10 04:58:45 +0000
commite3a92cf8f63270dc4eea565f050cfd98c121bfa2 (patch)
treec841f59623e097e5bc74df8cdb81e7cf012f31c1 /ui/qt
parent999e63543fccc327f929329b7ae96164df492e92 (diff)
Qt+Win32: Tell the user to install Npcap/WinPcap if needed.
If we don't have local interfaces on Windows, show a message in the main welcome screen and link to Npcap and WinPcap. Use consistent wording and layout in the macOS equivalent. Change-Id: Ifc9ee2e29ba197667bd95f39390be5684bb334ae Reviewed-on: https://code.wireshark.org/review/35724 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/interface_frame.cpp34
-rw-r--r--ui/qt/interface_frame.ui3
2 files changed, 27 insertions, 10 deletions
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index 1cee3a3ce6..05e54a046c 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -13,6 +13,10 @@
#include "caputils/capture_ifinfo.h"
+#ifdef Q_OS_WIN
+#include "caputils/capture-wpcap.h"
+#endif
+
#include "ui/qt/interface_frame.h"
#include <ui/qt/wireshark_application.h>
@@ -264,28 +268,36 @@ void InterfaceFrame::toggleRemoteInterfaces()
}
#endif
-#include <QDebug>
void InterfaceFrame::resetInterfaceTreeDisplay()
{
ui->warningLabel->setText(tr("No interfaces found"));
ui->warningLabel->hide();
+ if (!haveCapturePermissions())
+ {
+#if defined(Q_OS_WIN)
+ ui->warningLabel->setText(tr("<p>Local interfaces are unavailable because no capture driver is installed.</p>"
+ "<p>You can fix this by installing <a href=\"https://nmap.org/npcap/\">Npcap</a> or <a href=\"https://www.winpcap.org/install/default.htm\">WinPcap</a>.</p>"));
+ ui->warningLabel->show();
+ return;
+#elif defined(Q_OS_MAC)
+ QString install_chmodbpf_path = wsApp->applicationDirPath() + "/../Resources/Extras/Install ChmodBPF.pkg";
+ ui->warningLabel->setText(tr("<p>Local interfaces are unavailable due to insufficient permissions.</p>"
+ "<p>You can fix this by <a href=\"file://%1\">installing ChmodBPF</a>.</p>")
+ .arg(install_chmodbpf_path));
+ ui->warningLabel->show();
+ return;
+#endif
+ }
+
if (proxy_model_.rowCount() == 0)
{
ui->interfaceTree->hide();
- ui->warningLabel->show();
ui->warningLabel->setText(proxy_model_.interfaceError());
if (prefs.capture_no_interface_load) {
ui->warningLabel->setText(tr("Interfaces not loaded (due to preference). Go to Capture " UTF8_RIGHTWARDS_ARROW " Refresh Interfaces to load."));
}
- }
- else if (!haveCapturePermissions())
- {
-#ifdef Q_OS_MAC
- QString install_chmodbpf_path = wsApp->applicationDirPath() + "/../Resources/Extras/Install ChmodBPF.pkg";
- ui->warningLabel->setText(tr("You don't have permission to capture. You can <a href=\"file://%1\">install ChmodBPF to fix this</a>.").arg(install_chmodbpf_path));
ui->warningLabel->show();
-#endif
}
else
{
@@ -299,7 +311,9 @@ void InterfaceFrame::resetInterfaceTreeDisplay()
bool InterfaceFrame::haveCapturePermissions() const
{
-#ifdef Q_OS_MAC
+#if defined(Q_OS_WIN)
+ return has_wpcap;
+#elif defined(Q_OS_MAC)
QFileInfo bpf0_fi = QFileInfo("/dev/bpf0");
return bpf0_fi.isReadable() && bpf0_fi.isWritable();
#else
diff --git a/ui/qt/interface_frame.ui b/ui/qt/interface_frame.ui
index 568e787701..8e8e4decf4 100644
--- a/ui/qt/interface_frame.ui
+++ b/ui/qt/interface_frame.ui
@@ -55,6 +55,9 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>