3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/proto.h>
19 #include <ui/qt/utils/field_information.h>
26 class ProtoTree
: public QTreeView
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
);
37 void restoreSelectedField();
38 QString
toString(const QModelIndex
&start_idx
= QModelIndex()) const;
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
);
54 QString
traverseTree(const QModelIndex
& rootNode
, int identLevel
= 0) const;
57 ProtoTreeModel
*proto_tree_model_
;
60 QList
<QAction
*> copy_actions_
;
61 int column_resize_timer_
;
62 QList
<QPair
<int,int> > selected_hfid_path_
; // row, hfinfo
64 QPoint drag_start_position_
;
66 capture_file
*cap_file_
;
69 void saveSelectedField(QModelIndex
&index
);
70 static void foreachTreeNode(proto_node
*node
, void *proto_tree_ptr
);
71 void foreachExpand(const QModelIndex
&index
);
74 void fieldSelected(FieldInformation
*);
75 void openPacketInNewWindow(bool);
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
);
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();
92 void itemClicked(const QModelIndex
& index
);
93 void itemDoubleClicked(const QModelIndex
& index
);
94 void selectedFieldChanged(FieldInformation
*);
95 void selectedFrameChanged(QList
<int>);
98 void selectionChanged(const QItemSelection
&selected
, const QItemSelection
&deselected
);
100 void ctxShowPacketBytes();
101 void ctxExportPacketBytes();
103 void ctxCopyVisibleItems();
104 void ctxCopyAsFilter();
105 void ctxCopySelectedInfo();
106 void ctxOpenUrlWiki();
109 void updateContentWidth();
110 void connectToMainWindow();
113 #endif // PROTO_TREE_H