Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
proto_tree.h
Go to the documentation of this file.
1
10#ifndef PROTO_TREE_H
11#define PROTO_TREE_H
12
13#include <config.h>
14
15#include <epan/proto.h>
16
17#include <epan/cfile.h>
18
20#include <QTreeView>
21#include <QMenu>
22
23class ProtoTreeModel;
24class ProtoNode;
25
26class ProtoTree : public QTreeView
27{
28 Q_OBJECT
29public:
30 explicit ProtoTree(QWidget *parent = 0, epan_dissect_t *edt_fixed = 0);
31 QMenu *colorizeMenu() { return &colorize_menu_; }
32 void setRootNode(proto_node *root_node);
33 void emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_type = FT_FRAMENUM_NONE);
34 void autoScrollTo(const QModelIndex &index);
35 void goToHfid(int hfid);
36 void clear();
37 void restoreSelectedField();
38 QString toString(const QModelIndex &start_idx = QModelIndex()) const;
39
40protected:
41
42 enum {
43 Name = 0,
44 Description,
45 Value
46 };
47
48 virtual void contextMenuEvent(QContextMenuEvent *event) override;
49 virtual void timerEvent(QTimerEvent *event) override;
50 virtual void keyReleaseEvent(QKeyEvent *event) override;
51 virtual void focusInEvent(QFocusEvent *event) override;
52 virtual bool eventFilter(QObject * obj, QEvent * ev) override;
53 virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
54
55 QString traverseTree(const QModelIndex & rootNode, int identLevel = 0) const;
56
57private:
58 ProtoTreeModel *proto_tree_model_;
59 QMenu conv_menu_;
60 QMenu colorize_menu_;
61 QList<QAction *> copy_actions_;
62 int column_resize_timer_;
63 QList<QPair<int,int> > selected_hfid_path_; // row, hfinfo
64
65 QPoint drag_start_position_;
66
67 capture_file *cap_file_;
68 epan_dissect_t *edt_;
69
70 void saveSelectedField(QModelIndex &index);
71 static void foreachTreeNode(proto_node *node, void *proto_tree_ptr);
72 void foreachExpand(const QModelIndex &index);
73
74signals:
75 void fieldSelected(FieldInformation *);
76 void openPacketInNewWindow(bool);
77 void goToPacket(int);
78 void relatedFrame(int, ft_framenum_type_t);
79 void showProtocolPreferences(const QString module_name);
80 void editProtocolPreference(pref_t *pref, module_t *module);
81 void recolorPacketsRequested();
82 void redissectPacketsRequested();
83
84public slots:
85
86 /* Set the capture file */
87 void setCaptureFile(capture_file *cf);
88 void setMonospaceFont(const QFont &mono_font);
89 void syncExpanded(const QModelIndex & index);
90 void syncCollapsed(const QModelIndex & index);
91 void expandSubtrees();
92 void collapseSubtrees();
93 void expandAll();
94 void collapseAll();
95 void itemClicked(const QModelIndex & index);
96 void itemDoubleClicked(const QModelIndex & index);
97 void selectedFieldChanged(FieldInformation *);
98 void selectedFrameChanged(QList<int>);
99
100protected slots:
101 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
102#if 0
103 void ctxShowPacketBytes();
104 void ctxExportPacketBytes();
105#endif
106 void ctxCopyVisibleItems();
107 void ctxCopyAsFilter();
108 void ctxCopySelectedInfo();
109 void ctxOpenUrlWiki();
110
111private slots:
112 void updateContentWidth();
113 void connectToMainWindow();
114};
115
116#endif // PROTO_TREE_H
Definition field_information.h:23
Definition proto_node.h:21
Definition proto_tree.h:27
Definition proto_tree_model.h:20
Definition cfile.h:68
Definition proto.h:902
Definition epan_dissect.h:25
Definition prefs-int.h:24
Definition prefs.c:215