2012-01-04 22:13:01 +00:00
|
|
|
/* proto_tree.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2012-01-04 22:13:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PROTO_TREE_H
|
|
|
|
#define PROTO_TREE_H
|
|
|
|
|
2015-01-03 20:52:54 +00:00
|
|
|
#include <config.h>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
#include <epan/proto.h>
|
|
|
|
|
2017-11-07 15:51:43 +00:00
|
|
|
#include "cfile.h"
|
|
|
|
|
2015-06-17 00:24:19 +00:00
|
|
|
#include "protocol_preferences_menu.h"
|
|
|
|
|
2017-10-30 12:58:28 +00:00
|
|
|
#include <ui/qt/utils/field_information.h>
|
2017-12-07 16:15:30 +00:00
|
|
|
#include <QTreeView>
|
2012-12-07 01:46:20 +00:00
|
|
|
#include <QMenu>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2017-12-07 16:15:30 +00:00
|
|
|
class ProtoTreeModel;
|
2018-01-14 20:23:07 +00:00
|
|
|
class ProtoNode;
|
2017-12-07 16:15:30 +00:00
|
|
|
|
|
|
|
class ProtoTree : public QTreeView
|
2012-01-04 22:13:01 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-04-26 11:13:54 +00:00
|
|
|
explicit ProtoTree(QWidget *parent = 0, epan_dissect_t *edt_fixed = 0);
|
2015-07-30 23:15:40 +00:00
|
|
|
QMenu *colorizeMenu() { return &colorize_menu_; }
|
2017-12-07 16:15:30 +00:00
|
|
|
void setRootNode(proto_node *root_node);
|
2015-02-24 01:56:14 +00:00
|
|
|
void emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_type = FT_FRAMENUM_NONE);
|
2018-01-15 18:18:48 +00:00
|
|
|
void autoScrollTo(const QModelIndex &index);
|
2017-12-07 16:15:30 +00:00
|
|
|
void goToHfid(int hfid);
|
2012-01-14 00:16:16 +00:00
|
|
|
void clear();
|
2016-03-29 22:47:12 +00:00
|
|
|
void restoreSelectedField();
|
2018-05-25 13:19:46 +00:00
|
|
|
QString toString(const QModelIndex &start_idx = QModelIndex()) const;
|
2012-01-14 00:16:16 +00:00
|
|
|
|
2012-12-07 01:46:20 +00:00
|
|
|
protected:
|
2019-07-28 19:24:24 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
Name = 0,
|
|
|
|
Description,
|
|
|
|
Value
|
2019-10-20 20:00:05 +00:00
|
|
|
};
|
2019-07-28 19:24:24 +00:00
|
|
|
|
2016-03-10 20:43:59 +00:00
|
|
|
virtual void contextMenuEvent(QContextMenuEvent *event);
|
|
|
|
virtual void timerEvent(QTimerEvent *event);
|
|
|
|
virtual void keyReleaseEvent(QKeyEvent *event);
|
2017-11-07 15:51:43 +00:00
|
|
|
virtual bool eventFilter(QObject * obj, QEvent * ev);
|
2018-02-06 00:48:13 +00:00
|
|
|
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
|
2017-11-07 15:51:43 +00:00
|
|
|
|
2018-05-25 13:19:46 +00:00
|
|
|
QString traverseTree(const QModelIndex & rootNode, int identLevel = 0) const;
|
|
|
|
|
2012-01-14 00:16:16 +00:00
|
|
|
private:
|
2017-12-07 16:15:30 +00:00
|
|
|
ProtoTreeModel *proto_tree_model_;
|
2014-08-08 10:59:42 +00:00
|
|
|
QMenu conv_menu_;
|
2015-07-30 23:15:40 +00:00
|
|
|
QMenu colorize_menu_;
|
2015-06-17 00:24:19 +00:00
|
|
|
ProtocolPreferencesMenu proto_prefs_menu_;
|
2015-07-29 23:24:39 +00:00
|
|
|
QList<QAction *> copy_actions_;
|
2016-03-10 20:43:59 +00:00
|
|
|
int column_resize_timer_;
|
2017-12-07 16:15:30 +00:00
|
|
|
QList<QPair<int,int> > selected_hfid_path_; // row, hfinfo
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2017-12-07 16:15:30 +00:00
|
|
|
QPoint drag_start_position_;
|
2017-11-07 15:51:43 +00:00
|
|
|
|
|
|
|
capture_file *cap_file_;
|
2018-04-26 11:13:54 +00:00
|
|
|
epan_dissect_t *edt_;
|
2017-11-07 15:51:43 +00:00
|
|
|
|
2017-12-07 16:15:30 +00:00
|
|
|
void saveSelectedField(QModelIndex &index);
|
2018-01-16 01:13:45 +00:00
|
|
|
static void foreachTreeNode(proto_node *node, gpointer proto_tree_ptr);
|
2017-12-07 16:15:30 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
signals:
|
2017-10-30 12:58:28 +00:00
|
|
|
void fieldSelected(FieldInformation *);
|
2015-02-13 16:36:53 +00:00
|
|
|
void openPacketInNewWindow(bool);
|
|
|
|
void goToPacket(int);
|
2015-02-24 01:56:14 +00:00
|
|
|
void relatedFrame(int, ft_framenum_type_t);
|
2015-06-17 00:24:19 +00:00
|
|
|
void showProtocolPreferences(const QString module_name);
|
2015-06-17 15:41:41 +00:00
|
|
|
void editProtocolPreference(struct preference *pref, struct pref_module *module);
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
public slots:
|
2017-11-07 15:51:43 +00:00
|
|
|
|
|
|
|
/* Set the capture file */
|
|
|
|
void setCaptureFile(capture_file *cf);
|
2014-09-23 20:35:10 +00:00
|
|
|
void setMonospaceFont(const QFont &mono_font);
|
2018-01-15 18:18:48 +00:00
|
|
|
void syncExpanded(const QModelIndex & index);
|
|
|
|
void syncCollapsed(const QModelIndex & index);
|
2012-08-14 04:12:56 +00:00
|
|
|
void expandSubtrees();
|
2017-12-18 09:25:03 +00:00
|
|
|
void collapseSubtrees();
|
2012-08-19 20:47:11 +00:00
|
|
|
void expandAll();
|
|
|
|
void collapseAll();
|
2020-03-05 21:56:57 +00:00
|
|
|
void itemClicked(const QModelIndex & index);
|
2017-12-07 16:15:30 +00:00
|
|
|
void itemDoubleClicked(const QModelIndex & index);
|
2017-10-30 12:58:28 +00:00
|
|
|
void selectedFieldChanged(FieldInformation *);
|
2019-11-21 09:50:41 +00:00
|
|
|
void selectedFrameChanged(QList<int>);
|
2017-10-30 12:58:28 +00:00
|
|
|
|
2017-12-07 16:15:30 +00:00
|
|
|
protected slots:
|
|
|
|
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
2019-07-28 19:24:24 +00:00
|
|
|
#if 0
|
|
|
|
void ctxShowPacketBytes();
|
|
|
|
void ctxExportPacketBytes();
|
|
|
|
#endif
|
|
|
|
void ctxCopyVisibleItems();
|
|
|
|
void ctxCopyAsFilter();
|
|
|
|
void ctxCopySelectedInfo();
|
|
|
|
void ctxOpenUrlWiki();
|
2017-12-07 16:15:30 +00:00
|
|
|
|
2016-03-10 20:43:59 +00:00
|
|
|
private slots:
|
|
|
|
void updateContentWidth();
|
2019-11-12 15:39:19 +00:00
|
|
|
void connectToMainWindow();
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROTO_TREE_H
|