| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
traffic_tree.h
Go to the documentation of this file.
1
9
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#include <ui/qt/widgets/adaptive_header_view.h>
20
21#include <QTreeView>
22#include <QMenu>
23#include <QHeaderView>
24#include <QSortFilterProxyModel>
25
26#include <QWidgetAction>
27#include <QLineEdit>
28#include <QActionGroup>
29
33 class MenuEditAction : public QWidgetAction
34{
35 Q_OBJECT
36 public:
43 MenuEditAction(QString text, QString hintText, QObject * parent = nullptr);
44
49 QString text() const;
50
51 protected:
57 virtual QWidget * createWidget(QWidget *parent) override;
58
59 private:
61 QString _hintText;
62
64 QString _text;
65
67 QLineEdit * _lineEdit;
68
69 private slots:
73 void triggerEntry();
74};
75
76
80 class TrafficTreeHeaderView : public AdaptiveHeaderView
81{
82 Q_OBJECT
83 public:
89 TrafficTreeHeaderView(GList ** recentColumnList, QWidget * parent = nullptr);
90
94 ~TrafficTreeHeaderView();
95
99 void applyRecent();
100
101signals:
106 void columnsHaveChanged(QList<int> visible);
107
114 void filterOnColumn(int column, int filterOn, QString filterText);
115
116 private:
118 GList ** _recentColumnList;
119
121 QActionGroup * _actions;
122
124 QString _filterText;
125
126 private slots:
131 void headerContextMenu(const QPoint &pos);
132
137 void columnTriggered(bool checked = false);
138
143 void menuActionTriggered(QAction * act);
144
149 void filterColumn(bool checked = false);
150};
151
152
156 class TrafficDataFilterProxy : public QSortFilterProxyModel
157{
158 Q_OBJECT
159 public:
160
162 enum {
164 TRAFFIC_DATA_LESS,
166 TRAFFIC_DATA_GREATER,
168 TRAFFIC_DATA_EQUAL,
169 };
170
175 TrafficDataFilterProxy(QObject *parent = nullptr);
176
182 void setColumnVisibility(int column, bool visible);
183
189 bool columnVisible(int column) const;
190
191 public slots:
198 void filterForColumn(int column, int filterOn, QString filterText);
199
200 protected:
207 virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
208
215 virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const override;
216
223 virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
224
225 private:
227 QList<int> hideColumns_;
228
230 int _filterColumn;
231
233 int _filterOn;
234
236 QString _filterText;
237
243 int mapToSourceColumn(int proxyColumn) const;
244};
245
246
250 class TrafficTree : public QTreeView
251{
252 Q_OBJECT
253
254 public:
259 typedef enum {
261 CLIPBOARD_CSV,
263 CLIPBOARD_YAML,
265 CLIPBOARD_JSON
266 } eTrafficTreeClipboard;
267
274 TrafficTree(QString baseName, GList ** recentColumnList, QWidget *parent = nullptr);
275
285 QMenu * createCopyMenu(QWidget * parent = nullptr);
286
290 void applyRecentColumns();
291
302 void widenColumnToContents(int column);
303
308 virtual void setModel(QAbstractItemModel *model) override;
309
310signals:
317 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
318
323 void columnsHaveChanged(QList<int> columns);
324
325 public slots:
330 void tapListenerEnabled(bool enable);
331
335 void disableTap();
336
341 void columnsChanged(QList<int> columns);
342
343 private:
345 bool _tapEnabled;
346
348 int _exportRole;
349
351 bool _saveRaw;
352
354 QString _baseName;
355
357 TrafficTreeHeaderView * _header;
358
363 ATapDataModel * dataModel();
364
372 QMenu * createActionSubMenu(FilterAction::Action cur_action, QModelIndex idx, bool isConversation);
373
378 void copyToClipboard(eTrafficTreeClipboard type);
379
381 friend class TrafficTreeHeaderView;
382
383 private slots:
388 void customContextMenu(const QPoint &pos);
389
393 void useFilterAction();
394
398 void clipboardAction();
399
403 void resizeAction();
404
408 void toggleSaveRawAction();
409
415 void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList<int>);
416
420 void handleLayoutChanged(const QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint);
421};
422
423#endif // TRAFFIC_TREE_H
adaptive_header_view.h
atap_data_model.h
ATapDataModel
DataModel for tap user data.
Definition atap_data_model.h:33
AdaptiveHeaderView::AdaptiveHeaderView
AdaptiveHeaderView(Qt::Orientation orientation, QWidget *parent=nullptr)
Constructs an AdaptiveHeaderView.
Definition adaptive_header_view.cpp:19
FilterAction::Action
Action
Defines an action to be taken with a filter.
Definition filter_action.h:30
FilterAction::ActionType
ActionType
Defines how the new filter should be combined with the existing one.
Definition filter_action.h:43
TrafficDataFilterProxy::filterAcceptsRow
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
Determines if a row from the source model should be included.
Definition traffic_tree.cpp:323
TrafficDataFilterProxy::filterForColumn
void filterForColumn(int column, int filterOn, QString filterText)
Applies filtering criteria for a specific column.
Definition traffic_tree.cpp:274
TrafficDataFilterProxy::TRAFFIC_DATA_GREATER
@ TRAFFIC_DATA_GREATER
Filter for values strictly greater than the target.
Definition traffic_tree.h:166
TrafficDataFilterProxy::TRAFFIC_DATA_EQUAL
@ TRAFFIC_DATA_EQUAL
Filter for values equal to the target.
Definition traffic_tree.h:168
TrafficDataFilterProxy::TRAFFIC_DATA_LESS
@ TRAFFIC_DATA_LESS
Filter for values strictly less than the target.
Definition traffic_tree.h:164
TrafficDataFilterProxy::TrafficDataFilterProxy
TrafficDataFilterProxy(QObject *parent=nullptr)
Constructs a new TrafficDataFilterProxy.
Definition traffic_tree.cpp:264
TrafficDataFilterProxy::lessThan
virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override
Compares two items for sorting.
Definition traffic_tree.cpp:379
TrafficDataFilterProxy::columnVisible
bool columnVisible(int column) const
Checks if a column is currently visible.
Definition traffic_tree.cpp:541
TrafficDataFilterProxy::filterAcceptsColumn
virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const override
Determines if a column from the source model should be included.
Definition traffic_tree.cpp:494
TrafficDataFilterProxy::setColumnVisibility
void setColumnVisibility(int column, bool visible)
Sets the visibility for a specific column.
Definition traffic_tree.cpp:526
TrafficTreeHeaderView::columnsHaveChanged
void columnsHaveChanged(QList< int > visible)
Signal emitted when the visible columns have changed.
TrafficTreeHeaderView::TrafficTreeHeaderView
TrafficTreeHeaderView(GList **recentColumnList, QWidget *parent=nullptr)
Constructs a new TrafficTreeHeaderView.
Definition traffic_tree.cpp:78
TrafficTreeHeaderView::~TrafficTreeHeaderView
~TrafficTreeHeaderView()
Destroys the TrafficTreeHeaderView.
Definition traffic_tree.cpp:101
TrafficTreeHeaderView::filterOnColumn
void filterOnColumn(int column, int filterOn, QString filterText)
Signal emitted to filter data based on a column's criteria.
TrafficTreeHeaderView::applyRecent
void applyRecent()
Applies the recently used column settings.
Definition traffic_tree.cpp:162
TrafficTree::setModel
virtual void setModel(QAbstractItemModel *model) override
Sets the data model for the tree view.
Definition traffic_tree.cpp:568
TrafficTree::applyRecentColumns
void applyRecentColumns()
Applies the recently visible columns configuration.
Definition traffic_tree.cpp:893
TrafficTree::columnsChanged
void columnsChanged(QList< int > columns)
Slot triggered when columns are changed.
Definition traffic_tree.cpp:899
TrafficTree::widenColumnToContents
void widenColumnToContents(int column)
Increase column width if necessary to fit contents, but don't narrow it.
Definition traffic_tree.cpp:774
TrafficTree::createCopyMenu
QMenu * createCopyMenu(QWidget *parent=nullptr)
Create a menu containing clipboard copy entries for this tab.
Definition traffic_tree.cpp:718
TrafficTree::tapListenerEnabled
void tapListenerEnabled(bool enable)
Enables or disables the tap listener.
Definition traffic_tree.cpp:590
TrafficTree::filterAction
void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type)
Signal emitted to perform a display filter action.
TrafficTree::eTrafficTreeClipboard
eTrafficTreeClipboard
Type for the selection of export.
Definition traffic_tree.h:259
TrafficTree::CLIPBOARD_CSV
@ CLIPBOARD_CSV
export as CSV
Definition traffic_tree.h:261
TrafficTree::CLIPBOARD_YAML
@ CLIPBOARD_YAML
export as YAML
Definition traffic_tree.h:263
TrafficTree::CLIPBOARD_JSON
@ CLIPBOARD_JSON
export as JSON
Definition traffic_tree.h:265
TrafficTree::TrafficTree
TrafficTree(QString baseName, GList **recentColumnList, QWidget *parent=nullptr)
Constructs a new TrafficTree.
Definition traffic_tree.cpp:547
TrafficTree::TrafficTreeHeaderView
friend class TrafficTreeHeaderView
Definition traffic_tree.h:381
TrafficTree::columnsHaveChanged
void columnsHaveChanged(QList< int > columns)
Signal emitted when the visible columns have changed.
TrafficTree::disableTap
void disableTap()
Disables the tap completely.
Definition traffic_tree.cpp:885
filter_action.h
recent.h