Wireshark  4.3.0
The Wireshark network protocol analyzer
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 
22 #include <QTreeView>
23 #include <QMenu>
24 
25 class ProtoTreeModel;
26 class ProtoNode;
27 
28 class ProtoTree : public QTreeView
29 {
30  Q_OBJECT
31 public:
32  explicit ProtoTree(QWidget *parent = 0, epan_dissect_t *edt_fixed = 0);
33  QMenu *colorizeMenu() { return &colorize_menu_; }
34  void setRootNode(proto_node *root_node);
35  void emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_type = FT_FRAMENUM_NONE);
36  void autoScrollTo(const QModelIndex &index);
37  void goToHfid(int hfid);
38  void clear();
39  void restoreSelectedField();
40  QString toString(const QModelIndex &start_idx = QModelIndex()) const;
41 
42 protected:
43 
44  enum {
45  Name = 0,
46  Description,
47  Value
48  };
49 
50  virtual void contextMenuEvent(QContextMenuEvent *event);
51  virtual void timerEvent(QTimerEvent *event);
52  virtual void keyReleaseEvent(QKeyEvent *event);
53  virtual bool eventFilter(QObject * obj, QEvent * ev);
54  virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
55 
56  QString traverseTree(const QModelIndex & rootNode, int identLevel = 0) const;
57 
58 private:
59  ProtoTreeModel *proto_tree_model_;
60  QMenu conv_menu_;
61  QMenu colorize_menu_;
62  ProtocolPreferencesMenu proto_prefs_menu_;
63  QList<QAction *> copy_actions_;
64  int column_resize_timer_;
65  QList<QPair<int,int> > selected_hfid_path_; // row, hfinfo
66 
67  QPoint drag_start_position_;
68 
69  capture_file *cap_file_;
70  epan_dissect_t *edt_;
71 
72  void saveSelectedField(QModelIndex &index);
73  static void foreachTreeNode(proto_node *node, void *proto_tree_ptr);
74  void foreachExpand(const QModelIndex &index);
75 
76 signals:
77  void fieldSelected(FieldInformation *);
78  void openPacketInNewWindow(bool);
79  void goToPacket(int);
80  void relatedFrame(int, ft_framenum_type_t);
81  void showProtocolPreferences(const QString module_name);
82  void editProtocolPreference(struct preference *pref, struct pref_module *module);
83 
84 public 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 
100 protected slots:
101  void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
102 #if 0
103  void ctxShowPacketBytes();
104  void ctxExportPacketBytes();
105 #endif
106  void ctxCopyVisibleItems();
107  void ctxCopyAsFilter();
108  void ctxCopySelectedInfo();
109  void ctxOpenUrlWiki();
110 
111 private 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:29
Definition: proto_tree_model.h:20
Definition: protocol_preferences_menu.h:20
Definition: cfile.h:67
Definition: proto.h:904
Definition: epan_dissect.h:28
Definition: prefs-int.h:27
Definition: prefs.c:225