Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
interface_tree_cache_model.h
Go to the documentation of this file.
1
11
12#pragma once
13
15
16#include <QMap>
17#include <QAbstractItemModel>
18#include <QIdentityProxyModel>
19
23class InterfaceTreeCacheModel : public QIdentityProxyModel
24{
25 Q_OBJECT
26
27public:
32 explicit InterfaceTreeCacheModel(QObject *parent);
33
38
47 InterfaceTreeModel * interfaceModel() const { return sourceModel; }
48
54 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
55
62 QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
63
71 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
72
78 Qt::ItemFlags flags(const QModelIndex &index) const override;
79
87 QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
88
89#ifdef HAVE_LIBPCAP
97 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
98
103 void reset(int row);
104
108 void save();
109
116 void setBookmarkRenameEnabled(bool enabled) { bookmarkRenameEnabled = enabled; }
117
136 QModelIndex addBookmark(const QModelIndex &index);
137
149 bool deleteBookmarks(const QModelIndexList &indexes);
150
155 void addDevice(const interface_t * newDevice);
156
161 void deleteDevice(const QModelIndex &index);
162#endif
163
164#ifdef HAVE_PCAP_REMOTE
170 bool isRemote(const QModelIndex &index) const;
171#endif
172
173private:
175 InterfaceTreeModel * sourceModel;
176
177#ifdef HAVE_LIBPCAP
179 QList<interface_t> newDevices;
180
184 void saveNewDevices();
185
197 void refreshCapabilities(const QModelIndex &index, bool monitor_mode);
198
211 bool renameBookmark(const QModelIndex &index, const QString &newName);
212
221 bool bookmarkNameInUse(const QModelIndex &excludeIndex, const QString &bookmarkName) const;
222
235 QString nextBookmarkName(const QString &parentIfname) const;
236
238 bool bookmarkRenameEnabled = false;
239#endif
240
242 QMap<int, QSharedPointer<QMap<InterfaceTreeColumns, QVariant> > > * storage;
243
245 QList<InterfaceTreeColumns> editableColumns;
246
248 QList<InterfaceTreeColumns> checkableColumns;
249
250#ifdef HAVE_LIBPCAP
256 const interface_t * lookup(const QModelIndex &index) const;
257#endif
258
264 bool changeIsAllowed(InterfaceTreeColumns col) const;
265
271 bool isAvailableField(const QModelIndex &index) const;
272
278 bool isAllowedToBeEdited(const QModelIndex &index) const;
279
280};
struct interface_tag interface_t
Represents a network interface and its full capture configuration as shown in the UI.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Retrieves data from the cache or source model for a given index and role.
Definition interface_tree_cache_model.cpp:751
InterfaceTreeCacheModel(QObject *parent)
Constructs a new InterfaceTreeCacheModel.
Definition interface_tree_cache_model.cpp:36
QVariant getColumnContent(int idx, int col, int role=Qt::DisplayRole)
Gets the cached content for a specific column and row.
Definition interface_tree_cache_model.cpp:65
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Sets data in the cache for a given index and role.
Definition interface_tree_cache_model.cpp:702
~InterfaceTreeCacheModel()
Destroys the InterfaceTreeCacheModel.
Definition interface_tree_cache_model.cpp:54
Qt::ItemFlags flags(const QModelIndex &index) const override
Retrieves the item flags for a given index, taking cache rules into account.
Definition interface_tree_cache_model.cpp:661
InterfaceTreeModel * interfaceModel() const
Returns the underlying InterfaceTreeModel this cache wraps.
Definition interface_tree_cache_model.h:47
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under a given parent.
Definition interface_tree_cache_model.cpp:567
A table model representing the system's available capture interfaces.
Definition interface_tree_model.h:69
InterfaceTreeColumns
Column indices for the interface tree model shared across interface-related views.
Definition interface_tree_model.h:43