Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
interface_sort_filter_model.h
1 /* interface_sort_filter_model.h
2  * Proxy model for the display of interface data for the interface tree
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef INTERFACE_SORT_FILTER_MODEL_H
12 #define INTERFACE_SORT_FILTER_MODEL_H
13 
14 #include <config.h>
15 
16 #include <ui/qt/models/interface_tree_model.h>
17 
18 #include <glib.h>
19 
20 #include <QSortFilterProxyModel>
21 
22 class InterfaceSortFilterModel : public QSortFilterProxyModel
23 {
24  Q_OBJECT
25 public:
26  InterfaceSortFilterModel(QObject *parent);
27 
28  void setStoreOnChange(bool storeOnChange);
29  void resetAllFilter();
30 
31  void setFilterHidden(bool filter);
32  bool filterHidden() const;
33  int interfacesHidden();
34  void toggleFilterHidden();
35 
36 #ifdef HAVE_PCAP_REMOTE
37  void setRemoteDisplay(bool remoteDisplay);
38  bool remoteDisplay();
39  void toggleRemoteDisplay();
40  bool remoteInterfacesExist();
41 #endif
42 
43  void setInterfaceTypeVisible(int ifType, bool visible);
44  bool isInterfaceTypeShown(int ifType) const;
45  void setFilterByType(bool filter, bool invert = false);
46  bool filterByType() const;
47  void toggleTypeVisibility(int ifType);
48 
49  QList<int> typesDisplayed();
50 
51  void setColumns(QList<InterfaceTreeColumns> columns);
52  int mapSourceToColumn(InterfaceTreeColumns mdlIndex);
53 
54  QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
55  QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
56 
57  QString interfaceError();
58 
59 protected:
60  bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
61  bool filterAcceptsColumn(int source_column, const QModelIndex & source_parent) const;
62 
63 private:
64  bool _filterHidden;
65  bool _filterTypes;
66  bool _invertTypeFilter;
67  bool _storeOnChange;
68 
69 #ifdef HAVE_PCAP_REMOTE
70  bool _remoteDisplay;
71 #endif
72 
73  QList<int> displayHiddenTypes;
74 
75  QList<InterfaceTreeColumns> _columns;
76 
77 private slots:
78  void resetPreferenceData();
79 };
80 
81 #endif // INTERFACE_SORT_FILTER_MODEL_H
82 
83 /*
84  * Editor modelines
85  *
86  * Local Variables:
87  * c-basic-offset: 4
88  * tab-width: 8
89  * indent-tabs-mode: nil
90  * End:
91  *
92  * ex: set shiftwidth=4 tabstop=8 expandtab:
93  * :indentSize=4:tabSize=8:noTabs=true:
94  */
Definition: interface_sort_filter_model.h:22