| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
traffic_tree.h
Go to the documentation of this file.
1
10#ifndef TRAFFIC_TREE_H
11#define TRAFFIC_TREE_H
12
13#include "config.h"
14
15#include <ui/recent.h>
16
17#include <ui/qt/models/atap_data_model.h>
18#include <ui/qt/filter_action.h>
19
20#include <QTreeView>
21#include <QMenu>
22#include <QHeaderView>
23#include <QSortFilterProxyModel>
24
25#include <QWidgetAction>
26#include <QLineEdit>
27#include <QActionGroup>
28
29 class MenuEditAction : public QWidgetAction
30{
31 Q_OBJECT
32public:
33 MenuEditAction(QString text, QString hintText, QObject * parent = nullptr);
34
35 QString text() const;
36
37protected:
38 virtual QWidget * createWidget(QWidget *parent);
39private:
40 QString _hintText;
41 QString _text;
42 QLineEdit * _lineEdit;
43
44private slots:
45 void triggerEntry();
46};
47
48
49 class TrafficTreeHeaderView : public QHeaderView
50{
51 Q_OBJECT
52public:
53 TrafficTreeHeaderView(GList ** recentColumnList, QWidget * parent = nullptr);
54 ~TrafficTreeHeaderView();
55
56 void applyRecent();
57
58signals:
59 void columnsHaveChanged(QList<int> visible);
60 void filterOnColumn(int column, int filterOn, QString filterText);
61private:
62 GList ** _recentColumnList;
63 QActionGroup * _actions;
64 QString _filterText;
65
66private slots:
67 void headerContextMenu(const QPoint &pos);
68 void columnTriggered(bool checked = false);
69 void menuActionTriggered(QAction *);
70 void filterColumn(bool checked = false);
71
72};
73
74
75 class TrafficDataFilterProxy : public QSortFilterProxyModel
76{
77 Q_OBJECT
78public:
79
80 enum {
81 TRAFFIC_DATA_LESS,
82 TRAFFIC_DATA_GREATER,
83 TRAFFIC_DATA_EQUAL,
84 };
85
86 TrafficDataFilterProxy(QObject *parent = nullptr);
87
88 void setColumnVisibility(int column, bool visible);
89 bool columnVisible(int column) const;
90
91public slots:
92 void filterForColumn(int column, int filterOn, QString filterText);
93
94protected:
95 virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
96 virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const;
97 virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
98
99private:
100 QList<int> hideColumns_;
101
102 int _filterColumn;
103 int _filterOn;
104 QString _filterText;
105
106 int mapToSourceColumn(int proxyColumn) const;
107
108};
109
110
111 class TrafficTree : public QTreeView
112{
113 Q_OBJECT
114
115public:
120 typedef enum {
121 CLIPBOARD_CSV, /* export as CSV */
122 CLIPBOARD_YAML, /* export as YAML */
123 CLIPBOARD_JSON /* export as JSON */
124 } eTrafficTreeClipboard;
125
126 TrafficTree(QString baseName, GList ** recentColumnList, QWidget *parent = nullptr);
127
137 QMenu * createCopyMenu(QWidget * parent = nullptr);
138
139 void applyRecentColumns();
149 void widenColumnToContents(int column);
150
151 virtual void setModel(QAbstractItemModel *model) override;
152
153signals:
154 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
155 void columnsHaveChanged(QList<int> columns);
156
157public slots:
158 void tapListenerEnabled(bool enable);
159 void disableTap();
160 void columnsChanged(QList<int> columns);
161
162private:
163 bool _tapEnabled;
164 int _exportRole;
165 bool _saveRaw;
166 QString _baseName;
167
168 TrafficTreeHeaderView * _header;
169
170 ATapDataModel * dataModel();
171
172 QMenu * createActionSubMenu(FilterAction::Action cur_action, QModelIndex idx, bool isConversation);
173 void copyToClipboard(eTrafficTreeClipboard type);
174
175 friend class TrafficTreeHeaderView;
176
177private slots:
178 void customContextMenu(const QPoint &pos);
179 void useFilterAction();
180 void clipboardAction();
181 void resizeAction();
182 void toggleSaveRawAction();
183 void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
184#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
185 const QVector<int>
186#else
187 const QList<int>
188#endif
189 );
190 void handleLayoutChanged(const QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint);
191};
192
193#endif // TRAFFIC_TREE_H
atap_data_model.h
ATapDataModel
DataModel for tap user data.
Definition atap_data_model.h:33
TrafficDataFilterProxy
Definition traffic_tree.h:76
TrafficTreeHeaderView
Definition traffic_tree.h:50
TrafficTree
Definition traffic_tree.h:112
TrafficTree::widenColumnToContents
void widenColumnToContents(int column)
Increase column width if necessary to fit contents, but don't narrow it.
Definition traffic_tree.cpp:848
TrafficTree::createCopyMenu
QMenu * createCopyMenu(QWidget *parent=nullptr)
Create a menu containing clipboard copy entries for this tab.
Definition traffic_tree.cpp:792
TrafficTree::eTrafficTreeClipboard
eTrafficTreeClipboard
Type for the selection of export.
Definition traffic_tree.h:120
filter_action.h
recent.h