summaryrefslogtreecommitdiff
path: root/ui/qt/interface_frame.h
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2016-10-01 08:54:57 +0200
committerRoland Knall <rknall@gmail.com>2016-10-01 13:18:51 +0000
commit99097dd3c65358a525e40767cc1501c4116c3a4d (patch)
tree1ad9637554aebded5ff4bf8a400a6c3fc2ed4b4e /ui/qt/interface_frame.h
parentb6ad91520fd602710f5afe4a4eb8787a6bca22d4 (diff)
downloadwireshark-99097dd3c65358a525e40767cc1501c4116c3a4d.tar.gz
Interface List: Change display to view/model
This changes the underlying model of the main interface tree. Because of that, we can resort to a view/model approach, enlisting the global interfaces list as only data source. The interface list works identical to the old list, but allows for filtering of the displayed interfaces by type. Only types, which are present and whose interfaces are not hidden, are being displayed for selection. Change-Id: If8475b227daa026dc0ad3d25bc7fe050d5bf2ac3 Reviewed-on: https://code.wireshark.org/review/17940 Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/interface_frame.h')
-rw-r--r--ui/qt/interface_frame.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/ui/qt/interface_frame.h b/ui/qt/interface_frame.h
new file mode 100644
index 0000000000..7d54493d27
--- /dev/null
+++ b/ui/qt/interface_frame.h
@@ -0,0 +1,112 @@
+/* interface_frame.h
+ * Display of interfaces, including their respective data, and the
+ * capability to filter interfaces by type
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INTERFACE_FRAME_H
+#define INTERFACE_FRAME_H
+
+#include <config.h>
+
+#include <glib.h>
+
+#include "ui/qt/accordion_frame.h"
+
+#include "ui/qt/interface_tree_model.h"
+#include "ui/qt/interface_sort_filter_model.h"
+
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QAbstractButton>
+#include <QTimer>
+
+namespace Ui {
+class InterfaceFrame;
+}
+
+class InterfaceFrame : public AccordionFrame
+{
+ Q_OBJECT
+public:
+ explicit InterfaceFrame(QWidget *parent = 0);
+ ~InterfaceFrame();
+
+ int interfacesHidden();
+
+Q_SIGNALS:
+ void showExtcapOptions(QString device_name);
+ void startCapture();
+ void itemSelectionChanged();
+
+public slots:
+ void updateSelectedInterfaces();
+ void interfaceListChanged();
+
+ void getPoints(int idx, PointList *pts);
+
+protected:
+ void hideEvent(QHideEvent *evt);
+ void showEvent(QShowEvent *evt);
+
+private:
+
+ QAbstractButton * createButton(QString text, QString property = QString(), QVariant content = QVariant());
+ void resetInterfaceButtons();
+
+ Ui::InterfaceFrame *ui;
+
+ InterfaceSortFilterModel * proxyModel;
+ InterfaceTreeModel * sourceModel;
+
+ QHBoxLayout * buttonLayout;
+
+ QMap<int, QString> ifTypeDescription;
+
+#ifdef HAVE_LIBPCAP
+ QTimer *stat_timer_;
+#endif // HAVE_LIBPCAP
+
+private slots:
+ void interfaceTreeSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
+
+ void on_interfaceTree_doubleClicked(const QModelIndex &index);
+#ifdef HAVE_EXTCAP
+ void on_interfaceTree_clicked(const QModelIndex &index);
+#endif
+
+ void updateStatistics(void);
+ void actionButton_toggled(bool checked);
+};
+
+#endif // INTERFACE_FRAME_H
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */