| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
interface_tree_model.h
Go to the documentation of this file.
1
12#ifndef INTERFACE_TREE_MODEL_H
13#define INTERFACE_TREE_MODEL_H
14
15#include <config.h>
16#include <wireshark.h>
17
18#ifdef HAVE_LIBPCAP
19#include "ui/capture.h"
20#include "ui/capture_globals.h"
21#endif
22
23#include <QAbstractTableModel>
24#include <QList>
25#include <QMap>
26#include <QItemSelection>
27
28typedef QList<int> PointList;
29
30/*
31 * When sorting, QSortFilterProxyModel creates its own mapping instead
32 * of using the QModelIndex mapping with mapToSource to determine which
33 * column in the proxy model maps to which column in the source. Its own
34 * mapping is always done in order; this means that it's easier if all
35 * the Views of this model keep the columns in the same relative order,
36 * but can omit columns. (If you really need to change the order,
37 * QHeaderView::swapSections() can be used.)
38 */
39enum InterfaceTreeColumns
40{
41 IFTREE_COL_EXTCAP, // InterfaceFrame interfaceTree
42 IFTREE_COL_EXTCAP_PATH,
43 IFTREE_COL_HIDDEN, // ManageInterfaceDialog localView
44 IFTREE_COL_DISPLAY_NAME, // InterfaceFrame interfaceTree
45 IFTREE_COL_DESCRIPTION, // ManageInterfaceDialog localView
46 IFTREE_COL_NAME, // ManageInterfaceDialog localView
47 IFTREE_COL_COMMENT, // ManageInterfaceDialog localView
48 IFTREE_COL_STATS, // InterfaceFrame interfaceTree
49 IFTREE_COL_DLT,
50 IFTREE_COL_PROMISCUOUSMODE,
51 IFTREE_COL_TYPE,
52 IFTREE_COL_ACTIVE,
53 IFTREE_COL_SNAPLEN,
54 IFTREE_COL_BUFFERLEN,
55 IFTREE_COL_MONITOR_MODE,
56 IFTREE_COL_CAPTURE_FILTER,
57 IFTREE_COL_PIPE_PATH, // ManageInterfaceDialog pipeView
58 IFTREE_COL_MAX /* is not being displayed, it is the definition for the maximum numbers of columns */
59};
60
61 class InterfaceTreeModel : public QAbstractTableModel
62{
63 Q_OBJECT
64
65public:
66 InterfaceTreeModel(QObject *parent);
67 ~InterfaceTreeModel();
68
69 int rowCount(const QModelIndex &parent = QModelIndex()) const;
70 int columnCount(const QModelIndex &parent = QModelIndex()) const;
71 QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
72 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
73
74 void updateStatistic(unsigned int row);
75#ifdef HAVE_LIBPCAP
76 void setCache(if_stat_cache_t *stat_cache);
77 void stopStatistic();
78#endif
79
80 QString interfaceError();
81 QItemSelection selectedDevices();
82 bool updateSelectedDevices(QItemSelection sourceSelection);
83
84 QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
85
86#ifdef HAVE_PCAP_REMOTE
87 bool isRemote(int idx);
88#endif
89
90 static const QString DefaultNumericValue;
91
92public slots:
93 void interfaceListChanged();
94
95private:
96 QVariant toolTipForInterface(int idx) const;
97 QMap<QString, PointList> points;
98 QMap<QString, bool> active;
99
100#ifdef HAVE_LIBPCAP
101 if_stat_cache_t *stat_cache_;
102#endif // HAVE_LIBPCAP
103};
104
105#endif // INTERFACE_TREE_MODEL_H
capture.h
capture_globals.h
InterfaceTreeModel
Definition interface_tree_model.h:62
InterfaceTreeModel::interfaceListChanged
void interfaceListChanged()
Definition interface_tree_model.cpp:349