Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
interface_tree_cache_model.h
Go to the documentation of this file.
1
12#ifndef INTERFACE_TREE_CACHE_MODEL_H_
13#define INTERFACE_TREE_CACHE_MODEL_H_
14
16
17#include <QMap>
18#include <QAbstractItemModel>
19#include <QIdentityProxyModel>
20
24class InterfaceTreeCacheModel : public QIdentityProxyModel
25{
26 Q_OBJECT
27
28public:
33 explicit InterfaceTreeCacheModel(QObject *parent);
34
39
45 int rowCount(const QModelIndex &parent = QModelIndex()) const;
46
53 QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
54
62 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
63
69 Qt::ItemFlags flags(const QModelIndex &index) const;
70
78 QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
79
80#ifdef HAVE_LIBPCAP
88 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
89
94 void reset(int row);
95
99 void save();
100
105 void addDevice(const interface_t * newDevice);
106
111 void deleteDevice(const QModelIndex &index);
112#endif
113
114#ifdef HAVE_PCAP_REMOTE
120 bool isRemote(const QModelIndex &index) const;
121#endif
122
123private:
125 InterfaceTreeModel * sourceModel;
126
127#ifdef HAVE_LIBPCAP
129 QList<interface_t> newDevices;
130
134 void saveNewDevices();
135#endif
136
138 QMap<int, QSharedPointer<QMap<InterfaceTreeColumns, QVariant> > > * storage;
139
141 QList<InterfaceTreeColumns> editableColumns;
142
144 QList<InterfaceTreeColumns> checkableColumns;
145
146#ifdef HAVE_LIBPCAP
152 const interface_t * lookup(const QModelIndex &index) const;
153#endif
154
160 bool changeIsAllowed(InterfaceTreeColumns col) const;
161
167 bool isAvailableField(const QModelIndex &index) const;
168
174 bool isAllowedToBeEdited(const QModelIndex &index) const;
175
176};
177#endif /* INTERFACE_TREE_CACHE_MODEL_H_ */
A proxy model that caches edits and additions to the interface tree before applying them to the sourc...
Definition interface_tree_cache_model.h:25
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets data in the cache for a given index and role.
Definition interface_tree_cache_model.cpp:390
Qt::ItemFlags flags(const QModelIndex &index) const
Retrieves the item flags for a given index, taking cache rules into account.
Definition interface_tree_cache_model.cpp:366
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:55
~InterfaceTreeCacheModel()
Destroys the InterfaceTreeCacheModel.
Definition interface_tree_cache_model.cpp:44
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Retrieves data from the cache or source model for a given index and role.
Definition interface_tree_cache_model.cpp:425
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of rows under a given parent.
Definition interface_tree_cache_model.cpp:277
A table model representing the system's available capture interfaces.
Definition interface_tree_model.h:67
InterfaceTreeColumns
Column indices for the interface tree model shared across interface-related views.
Definition interface_tree_model.h:42
Definition androiddump.c:219