diff options
author | Gerald Combs <gerald@wireshark.org> | 2020-02-03 09:18:29 -0800 |
---|---|---|
committer | Tomasz Moń <desowin@gmail.com> | 2020-02-07 07:36:03 +0000 |
commit | 1e4c4f2209f64228bdf54011656bdbbfbcba7e63 (patch) | |
tree | dedf11146204a2c7f087983d6c4581382fe4839d /ui/qt/interface_frame.cpp | |
parent | 19b3376a24192319a008399e8c44f1655f6dcebd (diff) |
Qt: Make it possible to hide welcome screen warnings.
The "The NPF driver isn't running. You may have trouble" warning dialog
is now redundant, so remove it along with the "privs.warn_if_no_npf"
recent setting.
Add a more general "sys.warn_if_no_capture" recent setting along with a
getter for SimpleDialog's "Don't show this message again." string. Use
them to add a "Don't show this..." link to the main welcome warning
label.
Change-Id: Idffb800761eebf04b75e4be3f6bf7727dd468949
Reviewed-on: https://code.wireshark.org/review/36042
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Tomasz Moń <desowin@gmail.com>
Diffstat (limited to 'ui/qt/interface_frame.cpp')
-rw-r--r-- | ui/qt/interface_frame.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp index a4e3455d9a..9adfd22a57 100644 --- a/ui/qt/interface_frame.cpp +++ b/ui/qt/interface_frame.cpp @@ -18,6 +18,7 @@ #endif #include "ui/qt/interface_frame.h" +#include <ui/qt/simple_dialog.h> #include <ui/qt/wireshark_application.h> #include <ui/qt/models/interface_tree_model.h> @@ -28,13 +29,16 @@ #include "extcap.h" +#include <ui/recent.h> #include <wsutil/utf8_entities.h> +#include <QDesktopServices> #include <QFrame> -#include <QPushButton> #include <QHBoxLayout> -#include <QLabel> #include <QItemSelection> +#include <QLabel> +#include <QPushButton> +#include <QUrl> #include <epan/prefs.h> @@ -42,6 +46,7 @@ #ifdef HAVE_LIBPCAP const int stat_update_interval_ = 1000; // ms +const char *no_capture_link = "#no_capture"; #endif InterfaceFrame::InterfaceFrame(QWidget * parent) @@ -320,8 +325,15 @@ void InterfaceFrame::resetInterfaceTreeDisplay() } } - if (!ui->warningLabel->text().isEmpty()) + // XXX Should we have a separate recent pref for each message? + if (!ui->warningLabel->text().isEmpty() && recent.sys_warn_if_no_capture) { + QString warning_text = ui->warningLabel->text(); + warning_text.append(QString("<p><a href=\"%1\">%2</a></p>") + .arg(no_capture_link) + .arg(SimpleDialog::dontShowThisAgain())); + ui->warningLabel->setText(warning_text); + ui->warningLabel->show(); } #endif // HAVE_LIBPCAP @@ -474,6 +486,16 @@ void InterfaceFrame::showContextMenu(QPoint pos) ctx_menu.exec(ui->interfaceTree->mapToGlobal(pos)); } +void InterfaceFrame::on_warningLabel_linkActivated(const QString &link) +{ + if (link.compare(no_capture_link) == 0) { + recent.sys_warn_if_no_capture = FALSE; + resetInterfaceTreeDisplay(); + } else { + QDesktopServices::openUrl(QUrl(link)); + } +} + /* * Editor modelines * |