LATER... ei_kerberos_kdc_session_key ...
[wireshark-sm.git] / ui / qt / proto_tree.h
blobbd27e84cbf3e5e0522ee42bcbc4c55fd562d862b
1 /** @file
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
8 */
10 #ifndef PROTO_TREE_H
11 #define PROTO_TREE_H
13 #include <config.h>
15 #include <epan/proto.h>
17 #include "cfile.h"
19 #include <ui/qt/utils/field_information.h>
20 #include <QTreeView>
21 #include <QMenu>
23 class ProtoTreeModel;
24 class ProtoNode;
26 class ProtoTree : public QTreeView
28 Q_OBJECT
29 public:
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;
40 protected:
42 enum {
43 Name = 0,
44 Description,
45 Value
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;
56 private:
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
64 QPoint drag_start_position_;
66 capture_file *cap_file_;
67 epan_dissect_t *edt_;
69 void saveSelectedField(QModelIndex &index);
70 static void foreachTreeNode(proto_node *node, void *proto_tree_ptr);
71 void foreachExpand(const QModelIndex &index);
73 signals:
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);
81 public slots:
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>);
97 protected 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();
108 private slots:
109 void updateContentWidth();
110 void connectToMainWindow();
113 #endif // PROTO_TREE_H