Wireshark 4.5.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 "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);
49 virtual void timerEvent(QTimerEvent *event);
50 virtual void keyReleaseEvent(QKeyEvent *event);
51 virtual bool eventFilter(QObject * obj, QEvent * ev);
52 virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
53
54 QString traverseTree(const QModelIndex & rootNode, int identLevel = 0) const;
55
56private:
57 ProtoTreeModel *proto_tree_model_;
58 QMenu conv_menu_;
59 QMenu colorize_menu_;
60 QList<QAction *> copy_actions_;
61 int column_resize_timer_;
62 QList<QPair<int,int> > selected_hfid_path_; // row, hfinfo
63
64 QPoint drag_start_position_;
65
66 capture_file *cap_file_;
67 epan_dissect_t *edt_;
68
69 void saveSelectedField(QModelIndex &index);
70 static void foreachTreeNode(proto_node *node, void *proto_tree_ptr);
71 void foreachExpand(const QModelIndex &index);
72
73signals:
74 void fieldSelected(FieldInformation *);
75 void openPacketInNewWindow(bool);
76 void goToPacket(int);
77 void relatedFrame(int, ft_framenum_type_t);
78 void showProtocolPreferences(const QString module_name);
79 void editProtocolPreference(struct preference *pref, struct pref_module *module);
80
81public slots:
82
83 /* Set the capture file */
84 void setCaptureFile(capture_file *cf);
85 void setMonospaceFont(const QFont &mono_font);
86 void syncExpanded(const QModelIndex & index);
87 void syncCollapsed(const QModelIndex & index);
88 void expandSubtrees();
89 void collapseSubtrees();
90 void expandAll();
91 void collapseAll();
92 void itemClicked(const QModelIndex & index);
93 void itemDoubleClicked(const QModelIndex & index);
94 void selectedFieldChanged(FieldInformation *);
95 void selectedFrameChanged(QList<int>);
96
97protected slots:
98 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
99#if 0
100 void ctxShowPacketBytes();
101 void ctxExportPacketBytes();
102#endif
103 void ctxCopyVisibleItems();
104 void ctxCopyAsFilter();
105 void ctxCopySelectedInfo();
106 void ctxOpenUrlWiki();
107
108private slots:
109 void updateContentWidth();
110 void connectToMainWindow();
111};
112
113#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:67
Definition proto.h:899
Definition epan_dissect.h:28
Definition prefs-int.h:27
Definition prefs.c:241