Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
interface_sort_filter_model.h
Go to the documentation of this file.
1
12#ifndef INTERFACE_SORT_FILTER_MODEL_H
13#define INTERFACE_SORT_FILTER_MODEL_H
14
15#include <config.h>
16
18
19#include <QSortFilterProxyModel>
20
24class InterfaceSortFilterModel : public QSortFilterProxyModel
25{
26 Q_OBJECT
27public:
32 InterfaceSortFilterModel(QObject *parent);
33
38 void setStoreOnChange(bool storeOnChange);
39
43 void resetAllFilter();
44
49 void setFilterHidden(bool filter);
50
55 bool filterHidden() const;
56
61 int interfacesHidden();
62
66 void toggleFilterHidden();
67
72 void setSortByActivity(bool sort);
73
78 bool sortByActivity() const;
79
80#ifdef HAVE_PCAP_REMOTE
85 void setRemoteDisplay(bool remoteDisplay);
86
91 bool remoteDisplay();
92
96 void toggleRemoteDisplay();
97
102 bool remoteInterfacesExist();
103#endif
104
110 void setInterfaceTypeVisible(int ifType, bool visible);
111
117 bool isInterfaceTypeShown(int ifType) const;
118
124 void setFilterByType(bool filter, bool invert = false);
125
130 bool filterByType() const;
131
136 void toggleTypeVisibility(int ifType);
137
142 QList<int> typesDisplayed();
143
148 void setColumns(QList<InterfaceTreeColumns> columns);
149
156
162 QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
163
169 QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
170
175 QString interfaceError();
176
177protected:
184 bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
185
192 bool filterAcceptsColumn(int source_column, const QModelIndex & source_parent) const;
193
200 bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
201
202private:
204 bool _filterHidden;
205
207 bool _filterTypes;
208
210 bool _invertTypeFilter;
211
213 bool _storeOnChange;
214
216 bool _sortByActivity;
217
218#ifdef HAVE_PCAP_REMOTE
220 bool _remoteDisplay;
221#endif
222
224 QList<int> displayHiddenTypes;
225
227 QList<InterfaceTreeColumns> _columns;
228
229private slots:
233 void resetPreferenceData();
234};
235
236#endif // INTERFACE_SORT_FILTER_MODEL_H
A proxy model that provides custom sorting and filtering for the list of interfaces.
Definition interface_sort_filter_model.h:25
bool filterHidden() const
Checks if hidden interfaces are currently being filtered out.
Definition interface_sort_filter_model.cpp:166
bool sortByActivity() const
Checks if the interfaces are currently being sorted by activity.
Definition interface_sort_filter_model.cpp:79
void setStoreOnChange(bool storeOnChange)
Configures whether changes to interface visibility state should be stored persistently.
Definition interface_sort_filter_model.cpp:55
void setFilterByType(bool filter, bool invert=false)
Enables or disables filtering by interface type.
Definition interface_sort_filter_model.cpp:133
bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const
Determines whether a column from the source model matches active column filters.
Definition interface_sort_filter_model.cpp:360
bool filterByType() const
Checks if filtering by interface type is currently active.
Definition interface_sort_filter_model.cpp:193
void setInterfaceTypeVisible(int ifType, bool visible)
Sets the visibility for a specific interface type.
Definition interface_sort_filter_model.cpp:230
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
Maps a source model index to its corresponding proxy model index.
Definition interface_sort_filter_model.cpp:401
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
Compares two source indices to determine their sort order.
Definition interface_sort_filter_model.cpp:427
int interfacesHidden()
Gets the count of interfaces that are currently hidden by the filter.
Definition interface_sort_filter_model.cpp:198
QModelIndex mapToSource(const QModelIndex &proxyIndex) const
Maps a proxy model index to its corresponding source model index.
Definition interface_sort_filter_model.cpp:387
QList< int > typesDisplayed()
Retrieves a list of interface types that are currently set to be displayed.
Definition interface_sort_filter_model.cpp:208
void resetAllFilter()
Resets all current filters to their default states.
Definition interface_sort_filter_model.cpp:29
void setSortByActivity(bool sort)
Sets whether the interfaces should be dynamically sorted based on network activity.
Definition interface_sort_filter_model.cpp:73
QString interfaceError()
Retrieves any current interface-related error messages.
Definition interface_sort_filter_model.cpp:413
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
Determines whether a row from the source model matches all active filters.
Definition interface_sort_filter_model.cpp:295
void setColumns(QList< InterfaceTreeColumns > columns)
Configures which specific columns from the source model should be displayed.
Definition interface_sort_filter_model.cpp:373
void setFilterHidden(bool filter)
Sets whether hidden interfaces should be filtered out (not displayed).
Definition interface_sort_filter_model.cpp:65
void toggleTypeVisibility(int ifType)
Toggles the visibility state for a specific interface type.
Definition interface_sort_filter_model.cpp:276
int mapSourceToColumn(InterfaceTreeColumns mdlIndex)
Maps a logical column identifier to its actual display column index.
Definition interface_sort_filter_model.cpp:379
void toggleFilterHidden()
Toggles the filter state for hidden interfaces.
Definition interface_sort_filter_model.cpp:171
bool isInterfaceTypeShown(int ifType) const
Checks if a specific interface type is currently set to be visible.
Definition interface_sort_filter_model.cpp:283
InterfaceTreeColumns
Column indices for the interface tree model shared across interface-related views.
Definition interface_tree_model.h:42