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
|
|
|
|
*
|
2017-12-07 16:15:30 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
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;
|
|
|
|
|
|
|
|
class ProtoTree : public QTreeView
|
2012-01-04 22:13:01 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit ProtoTree(QWidget *parent = 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);
|
2017-12-07 16:15:30 +00:00
|
|
|
void goToHfid(int hfid);
|
2012-01-14 00:16:16 +00:00
|
|
|
void clear();
|
2017-12-07 16:15:30 +00:00
|
|
|
void closeContextMenu();
|
2016-03-29 22:47:12 +00:00
|
|
|
void restoreSelectedField();
|
2017-12-07 16:15:30 +00:00
|
|
|
const QString toString(const QModelIndex &index = QModelIndex()) const;
|
2012-01-14 00:16:16 +00:00
|
|
|
|
2012-12-07 01:46:20 +00:00
|
|
|
protected:
|
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);
|
2017-12-07 16:15:30 +00:00
|
|
|
virtual void rowsInserted(const QModelIndex & parent, int start, int end);
|
2017-11-07 15:51:43 +00:00
|
|
|
|
2012-01-14 00:16:16 +00:00
|
|
|
private:
|
2017-12-07 16:15:30 +00:00
|
|
|
ProtoTreeModel *proto_tree_model_;
|
2013-12-21 16:55:43 +00:00
|
|
|
QMenu ctx_menu_;
|
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_;
|
2013-12-21 16:55:43 +00:00
|
|
|
QAction *decode_as_;
|
2015-07-29 23:24:39 +00:00
|
|
|
QList<QAction *> copy_actions_;
|
2013-12-21 16:55:43 +00:00
|
|
|
QFont mono_font_;
|
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_;
|
|
|
|
|
2017-12-07 16:15:30 +00:00
|
|
|
void saveSelectedField(QModelIndex &index);
|
|
|
|
|
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);
|
2012-08-19 20:47:11 +00:00
|
|
|
void expand(const QModelIndex & index);
|
|
|
|
void collapse(const QModelIndex & index);
|
2012-08-14 04:12:56 +00:00
|
|
|
void expandSubtrees();
|
2012-08-19 20:47:11 +00:00
|
|
|
void expandAll();
|
|
|
|
void collapseAll();
|
2017-12-07 16:15:30 +00:00
|
|
|
void itemDoubleClicked(const QModelIndex & index);
|
2017-10-30 12:58:28 +00:00
|
|
|
void selectedFieldChanged(FieldInformation *);
|
|
|
|
|
2017-12-07 16:15:30 +00:00
|
|
|
protected slots:
|
|
|
|
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
|
|
|
|
2016-03-10 20:43:59 +00:00
|
|
|
private slots:
|
|
|
|
void updateContentWidth();
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROTO_TREE_H
|
2012-09-04 08:18:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|