Wireshark 4.5.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
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
29class 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
49class TrafficTreeHeaderView : public QHeaderView
50{
51 Q_OBJECT
52public:
53 TrafficTreeHeaderView(GList ** recentColumnList, QWidget * parent = nullptr);
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
75class 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
111class 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 */
125
126 TrafficTree(QString baseName, GList ** recentColumnList, QWidget *parent = nullptr);
127
137 QMenu * createCopyMenu(QWidget * parent = nullptr);
138
139 void applyRecentColumns();
140
141 virtual void setModel(QAbstractItemModel *model) override;
142
143signals:
144 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
145 void columnsHaveChanged(QList<int> columns);
146
147public slots:
148 void tapListenerEnabled(bool enable);
149 void disableTap();
150 void columnsChanged(QList<int> columns);
151
152private:
153 bool _tapEnabled;
154 int _exportRole;
155 bool _saveRaw;
156 QString _baseName;
157
158 TrafficTreeHeaderView * _header;
159
160 ATapDataModel * dataModel();
161
162 QMenu * createActionSubMenu(FilterAction::Action cur_action, QModelIndex idx, bool isConversation);
163 void copyToClipboard(eTrafficTreeClipboard type);
164
165 friend class TrafficTreeHeaderView;
166
167private slots:
168 void customContextMenu(const QPoint &pos);
169 void useFilterAction();
170 void clipboardAction();
171 void resizeAction();
172 void toggleSaveRawAction();
173};
174
175#endif // TRAFFIC_TREE_H
DataModel for tap user data.
Definition atap_data_model.h:33
Definition traffic_tree.h:30
Definition traffic_tree.h:76
Definition traffic_tree.h:50
Definition traffic_tree.h:112
QMenu * createCopyMenu(QWidget *parent=nullptr)
Create a menu containing clipboard copy entries for this tab.
Definition traffic_tree.cpp:768
eTrafficTreeClipboard
Type for the selection of export.
Definition traffic_tree.h:120