1 /* packet_diagram.h 2 * 3 * Wireshark - Network traffic analyzer 4 * By Gerald Combs <gerald@wireshark.org> 5 * Copyright 1998 Gerald Combs 6 * 7 * SPDX-License-Identifier: GPL-2.0-or-later 8 */ 9 10 #ifndef PACKET_DIAGRAM_H 11 #define PACKET_DIAGRAM_H 12 13 #include <config.h> 14 15 #include <epan/proto.h> 16 17 #include "cfile.h" 18 19 #include <ui/qt/utils/field_information.h> 20 21 #include <QGraphicsView> 22 23 class DiagramLayout; 24 25 class PacketDiagram : public QGraphicsView 26 { 27 Q_OBJECT 28 public: 29 PacketDiagram(QWidget *parent = nullptr); 30 ~PacketDiagram(); 31 void setRootNode(proto_node *root_node); 32 void clear(); 33 34 signals: 35 void fieldSelected(FieldInformation *); 36 37 public slots: 38 void setCaptureFile(capture_file *cf); 39 void setFont(const QFont &font); 40 void selectedFieldChanged(FieldInformation *finfo); 41 void selectedFrameChanged(QList<int> frames); 42 43 protected: 44 virtual bool event(QEvent *event) override; 45 virtual void contextMenuEvent(QContextMenuEvent *event) override; 46 47 private slots: 48 void connectToMainWindow(); 49 void sceneSelectionChanged(); 50 51 private: 52 void resetScene(bool reset_root = true); 53 void addDiagram(proto_node *tl_node); 54 void setSelectedField(field_info *fi); 55 QImage exportToImage(); 56 #if defined(QT_SVG_LIB) && 0 57 QByteArray exportToSvg(); 58 #endif 59 60 void showFieldsToggled(bool checked); 61 void saveAsTriggered(); 62 void copyAsRasterTriggered(); 63 #if defined(QT_SVG_LIB) && !defined(Q_OS_MAC) && 0 64 void copyAsSvgTriggered(); 65 #endif 66 67 DiagramLayout *layout_; 68 capture_file *cap_file_; 69 proto_node *root_node_; 70 field_info *selected_field_; 71 int y_pos_; 72 }; 73 74 #endif // PACKET_DIAGRAM_H 75