summaryrefslogtreecommitdiffstats
path: root/ui/qt/interface_frame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui/qt/interface_frame.cpp')
-rw-r--r--ui/qt/interface_frame.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index b1f34b22..ba2d42e0 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -32,6 +32,7 @@
#include <ui/recent.h>
#include "capture_opts.h"
#include "ui/capture_globals.h"
+#include <ui/iface_lists.h>
#include <wsutil/utf8_entities.h>
#include <QDesktopServices>
@@ -41,6 +42,8 @@
#include <QLabel>
#include <QPushButton>
#include <QUrl>
+#include <QMutex>
+#include <QDebug>
#include <epan/prefs.h>
@@ -51,6 +54,8 @@ const int stat_update_interval_ = 1000; // ms
#endif
const char *no_capture_link = "#no_capture";
+static QMutex scan_mutex;
+
InterfaceFrame::InterfaceFrame(QWidget * parent)
: QFrame(parent),
ui(new Ui::InterfaceFrame)
@@ -205,6 +210,27 @@ void InterfaceFrame::showEvent(QShowEvent *) {
#endif // HAVE_LIBPCAP
}
+#ifdef HAVE_LIBPCAP
+void InterfaceFrame::scanLocalInterfaces(GList *filter_list)
+{
+ GList *if_list = NULL;
+ if (scan_mutex.tryLock()) {
+ if (isVisible()) {
+ source_model_.stopStatistic();
+ if_stat_cache_t * stat_cache = capture_interface_stat_start(&global_capture_opts, &if_list);
+ source_model_.setCache(stat_cache);
+ }
+ mainApp->setInterfaceList(if_list);
+ free_interface_list(if_list);
+ scan_local_interfaces_filtered(filter_list, main_window_update);
+ mainApp->emitAppSignal(MainApplication::LocalInterfacesChanged);
+ scan_mutex.unlock();
+ } else {
+ qDebug() << "scan mutex locked, can't scan interfaces";
+ }
+}
+#endif // HAVE_LIBPCAP
+
void InterfaceFrame::actionButton_toggled(bool checked)
{
QVariant ifType = sender()->property(BTN_IFTYPE_PROPERTY);
@@ -422,7 +448,7 @@ void InterfaceFrame::on_interfaceTree_doubleClicked(const QModelIndex &index)
interfaces << device_name;
/* We trust the string here. If this interface is really extcap, the string is
- * being checked immediatly before the dialog is being generated */
+ * being checked immediately before the dialog is being generated */
if (extcap_string.length() > 0)
{
/* this checks if configuration is required and not yet provided or saved via prefs */
@@ -454,7 +480,7 @@ void InterfaceFrame::on_interfaceTree_clicked(const QModelIndex &index)
QString extcap_string = source_model_.getColumnContent(realIndex.row(), IFTREE_COL_EXTCAP_PATH).toString();
/* We trust the string here. If this interface is really extcap, the string is
- * being checked immediatly before the dialog is being generated */
+ * being checked immediately before the dialog is being generated */
if (extcap_string.length() > 0)
{
/* this checks if configuration is required and not yet provided or saved via prefs */
@@ -534,7 +560,7 @@ void InterfaceFrame::showContextMenu(QPoint pos)
void InterfaceFrame::on_warningLabel_linkActivated(const QString &link)
{
if (link.compare(no_capture_link) == 0) {
- recent.sys_warn_if_no_capture = FALSE;
+ recent.sys_warn_if_no_capture = false;
resetInterfaceTreeDisplay();
} else {
QDesktopServices::openUrl(QUrl(link));