2012-01-04 22:13:01 +00:00
|
|
|
/* packet_list.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-01-04 22:13:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PACKET_LIST_H
|
|
|
|
#define PACKET_LIST_H
|
|
|
|
|
2013-07-08 16:54:18 +00:00
|
|
|
#include "byte_view_tab.h"
|
2012-01-04 22:13:01 +00:00
|
|
|
#include "packet_list_model.h"
|
2015-01-01 19:41:03 +00:00
|
|
|
#include "preferences_dialog.h"
|
2012-01-14 00:16:16 +00:00
|
|
|
#include "proto_tree.h"
|
2015-06-17 00:24:19 +00:00
|
|
|
#include "protocol_preferences_menu.h"
|
2013-07-08 16:54:18 +00:00
|
|
|
#include "related_packet_delegate.h"
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2012-12-07 01:46:20 +00:00
|
|
|
#include <QMenu>
|
2015-02-20 14:30:23 +00:00
|
|
|
#include <QTime>
|
|
|
|
#include <QTreeView>
|
2015-02-18 12:30:06 +00:00
|
|
|
#include <QPainter>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2015-06-11 22:53:51 +00:00
|
|
|
class OverlayScrollBar;
|
|
|
|
|
2015-01-01 19:41:03 +00:00
|
|
|
class QAction;
|
2015-02-20 14:30:23 +00:00
|
|
|
class QTimerEvent;
|
2015-01-01 19:41:03 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
class PacketList : public QTreeView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-01-01 19:41:03 +00:00
|
|
|
enum ColumnActions {
|
|
|
|
caAlignLeft,
|
|
|
|
caAlignCenter,
|
|
|
|
caAlignRight,
|
|
|
|
caColumnPreferences,
|
|
|
|
caEditColumn,
|
|
|
|
caResolveNames,
|
|
|
|
caResizeToContents,
|
|
|
|
caDisplayedColumns,
|
|
|
|
caHideColumn,
|
|
|
|
caRemoveColumn
|
|
|
|
};
|
2012-01-04 22:13:01 +00:00
|
|
|
explicit PacketList(QWidget *parent = 0);
|
|
|
|
PacketListModel *packetListModel() const;
|
2012-08-23 02:59:31 +00:00
|
|
|
void setProtoTree(ProtoTree *proto_tree);
|
2012-01-04 22:13:01 +00:00
|
|
|
void setByteViewTab(ByteViewTab *byteViewTab);
|
2013-11-15 20:24:56 +00:00
|
|
|
void freeze();
|
|
|
|
void thaw();
|
2012-01-04 22:13:01 +00:00
|
|
|
void clear();
|
|
|
|
void writeRecent(FILE *rf);
|
2012-12-07 01:46:20 +00:00
|
|
|
bool contextMenuActive();
|
2012-12-07 20:08:00 +00:00
|
|
|
QString &getFilterFromRowAndColumn();
|
2015-06-11 22:53:51 +00:00
|
|
|
void resetColorized();
|
2012-12-23 04:37:58 +00:00
|
|
|
QString packetComment();
|
|
|
|
void setPacketComment(QString new_comment);
|
|
|
|
QString allPacketComments();
|
2015-02-05 00:36:19 +00:00
|
|
|
void recolorPackets();
|
2015-02-20 14:30:23 +00:00
|
|
|
void setAutoScroll(bool enabled = true);
|
|
|
|
void setCaptureInProgress(bool in_progress = false) { capture_in_progress_ = in_progress; tail_at_end_ = in_progress; }
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
protected:
|
2015-06-11 22:53:51 +00:00
|
|
|
void showEvent(QShowEvent *);
|
|
|
|
void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
|
2012-12-07 01:46:20 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
2015-02-20 14:30:23 +00:00
|
|
|
void timerEvent(QTimerEvent *event);
|
2015-06-11 22:53:51 +00:00
|
|
|
void paintEvent(QPaintEvent *event);
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2015-02-20 14:30:23 +00:00
|
|
|
protected slots:
|
|
|
|
void rowsInserted(const QModelIndex &parent, int start, int end);
|
2015-02-18 12:30:06 +00:00
|
|
|
void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
|
2013-09-09 19:30:30 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
private:
|
2012-08-19 23:52:08 +00:00
|
|
|
PacketListModel *packet_list_model_;
|
|
|
|
ProtoTree *proto_tree_;
|
|
|
|
ByteViewTab *byte_view_tab_;
|
2012-10-30 19:21:24 +00:00
|
|
|
capture_file *cap_file_;
|
2012-12-07 01:46:20 +00:00
|
|
|
QMenu ctx_menu_;
|
2014-08-08 10:59:42 +00:00
|
|
|
QMenu conv_menu_;
|
2015-06-17 00:24:19 +00:00
|
|
|
ProtocolPreferencesMenu proto_prefs_menu_;
|
2013-12-10 21:07:26 +00:00
|
|
|
QAction *decode_as_;
|
2012-12-07 20:08:00 +00:00
|
|
|
int ctx_column_;
|
2015-02-19 01:18:27 +00:00
|
|
|
QByteArray column_state_;
|
2015-06-11 22:53:51 +00:00
|
|
|
OverlayScrollBar *overlay_sb_;
|
|
|
|
int overlay_timer_id_;
|
|
|
|
bool create_near_overlay_;
|
|
|
|
bool create_far_overlay_;
|
|
|
|
QVector<QRgb> overlay_colors_;
|
2015-01-01 19:41:03 +00:00
|
|
|
|
2013-07-08 16:54:18 +00:00
|
|
|
RelatedPacketDelegate related_packet_delegate_;
|
2015-01-01 19:41:03 +00:00
|
|
|
QMenu header_ctx_menu_;
|
|
|
|
QMap<ColumnActions, QAction*> header_actions_;
|
|
|
|
QList<ColumnActions> checkable_actions_;
|
|
|
|
int header_ctx_column_;
|
|
|
|
QAction *show_hide_separator_;
|
|
|
|
QList<QAction *>show_hide_actions_;
|
2015-02-20 14:30:23 +00:00
|
|
|
bool capture_in_progress_;
|
|
|
|
int tail_timer_id_;
|
|
|
|
bool tail_at_end_;
|
|
|
|
bool rows_inserted_;
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2012-12-17 23:03:21 +00:00
|
|
|
void setFrameReftime(gboolean set, frame_data *fdata);
|
2014-06-16 23:54:57 +00:00
|
|
|
void setColumnVisibility();
|
2015-03-27 23:49:39 +00:00
|
|
|
int sizeHintForColumn(int column) const;
|
2015-01-01 19:41:03 +00:00
|
|
|
void initHeaderContextMenu();
|
2015-05-13 22:46:51 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
signals:
|
2013-01-18 00:50:14 +00:00
|
|
|
void packetDissectionChanged();
|
2013-11-22 17:59:15 +00:00
|
|
|
void packetSelectionChanged();
|
2015-06-17 00:24:19 +00:00
|
|
|
void showColumnPreferences(PreferencesDialog::PreferencesPane start_pane);
|
2015-01-01 19:41:03 +00:00
|
|
|
void editColumn(int column);
|
2015-02-20 14:30:23 +00:00
|
|
|
void packetListScrolled(bool at_end);
|
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:
|
2012-10-30 19:21:24 +00:00
|
|
|
void setCaptureFile(capture_file *cf);
|
2014-09-23 20:35:10 +00:00
|
|
|
void setMonospaceFont(const QFont &mono_font);
|
2012-08-14 04:12:56 +00:00
|
|
|
void goNextPacket();
|
|
|
|
void goPreviousPacket();
|
|
|
|
void goFirstPacket();
|
|
|
|
void goLastPacket();
|
2012-08-19 23:52:08 +00:00
|
|
|
void goToPacket(int packet);
|
2015-03-11 22:22:20 +00:00
|
|
|
void goToPacket(int packet, int hf_id);
|
2012-12-17 23:03:21 +00:00
|
|
|
void markFrame();
|
|
|
|
void markAllDisplayedFrames(bool set);
|
|
|
|
void ignoreFrame();
|
|
|
|
void ignoreAllDisplayedFrames(bool set);
|
|
|
|
void setTimeReference();
|
|
|
|
void unsetAllTimeReferences();
|
2014-10-21 20:36:10 +00:00
|
|
|
void redrawVisiblePackets();
|
2015-07-09 23:47:11 +00:00
|
|
|
void columnsChanged();
|
2015-02-19 01:18:27 +00:00
|
|
|
void applyRecentColumnWidths();
|
2013-07-08 16:54:18 +00:00
|
|
|
|
|
|
|
private slots:
|
2015-01-01 19:41:03 +00:00
|
|
|
void showHeaderMenu(QPoint pos);
|
|
|
|
void headerMenuTriggered();
|
|
|
|
void columnVisibilityTriggered();
|
2015-05-13 22:46:51 +00:00
|
|
|
void sectionResized(int col, int, int new_width);
|
2015-07-09 23:47:11 +00:00
|
|
|
void sectionMoved(int, int, int);
|
2015-02-20 14:30:23 +00:00
|
|
|
void vScrollBarActionTriggered(int);
|
2015-06-11 22:53:51 +00:00
|
|
|
void drawFarOverlay();
|
|
|
|
void drawNearOverlay();
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PACKET_LIST_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:
|
|
|
|
*/
|