20#include <ui/qt/models/tag_column_delegate.h>
26#include <QElapsedTimer>
85 virtual void scrollTo(
const QModelIndex &index, QAbstractItemView::ScrollHint hint = EnsureVisible)
override;
113 bool freeze(
bool keep_current_frame =
false);
124 bool thaw(
bool restore_selection =
false);
130 bool isFrozen()
const {
return model() ==
nullptr; }
214 void setCaptureInProgress(
bool in_progress =
false,
bool auto_scroll =
true) { capture_in_progress_ = in_progress; tail_at_end_ = in_progress && auto_scroll; }
299 QList<frame_data *>
selectedFrames(
bool fall_back_to_current =
true)
const;
491 static bool isColumnFrozen(
int column,
int boundary) {
return column < boundary; }
525 Qt::KeyboardModifiers modifiers = Qt::NoModifier);
571 bool from_pinned_row_strip =
false);
599 void forwardHeaderMouseMove(QMouseEvent *event,
const QPoint &header_pos);
602 void forwardHeaderMouseRelease(QMouseEvent *event,
const QPoint &header_pos);
663 const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
682 void selectionChanged(
const QItemSelection & selected,
const QItemSelection & deselected)
override;
724 virtual void leaveEvent(QEvent *event)
override;
730 virtual void resizeEvent(QResizeEvent *event)
override;
764 void rowsInserted(
const QModelIndex &parent,
int start,
int end)
override;
772 virtual void drawRow(QPainter *painter,
const QStyleOptionViewItem &option,
773 const QModelIndex &index)
const override;
780 QModelIndexList selectedSourceIndexes()
const;
787 void installSelectionModel();
795 void reconcilePinnedSelection();
803 void syncPinnedSelection(
bool to_pinned);
824 QMenu colorize_menu_;
831 void startCellDrag(
frame_data *fdata,
int column,
const QString &cell_text);
837 QByteArray column_state_;
843 int overlay_timer_id_;
855 QElapsedTimer key_hold_elapsed_;
858 bool create_near_overlay_;
861 bool create_far_overlay_;
864 QVector<QRgb> overlay_colors_;
867 bool changing_profile_;
870 QModelIndex mouse_pressed_at_;
880 QAction *show_hide_separator_;
883 QList<QAction *>show_hide_actions_;
886 bool capture_in_progress_;
892 bool columns_changed_;
895 bool set_column_visibility_;
898 bool set_style_sheet_;
901 QModelIndex frozen_current_row_;
904 QModelIndexList frozen_selected_rows_;
918 QItemSelectionModel *pinned_selection_model_;
925 bool syncing_selection_;
928 int pinned_column_boundary_;
931 int saved_pinned_column_boundary_;
941 QSize pinned_column_view_size_;
942 bool header_drag_active_ =
false;
943 void updateFrozenOverlayMask();
952 QString overlay_active_flat_style_;
955 QString overlay_inactive_flat_style_;
963 int hovered_frame_num_;
966 QVector<int> selection_history_;
975 GPtrArray *finfo_array;
988 void updateHistory(
int frame_num);
995 void setFrameReftime(
bool set,
frame_data *fdata);
1001 void setRecentColumnWidth(
int column);
1007 void drawCurrentPacket(
bool scroll =
true);
1012 void applyRecentColumnWidths();
1021 QList<QTreeView *> pinnedOverlayViews()
const;
1031 void repaintPinnedOverlays();
1039 void mirrorSectionWidthToOverlays(
int column,
int width);
1045 void applyOverlayActiveState();
1052 bool selectionIsActive()
const {
return hasFocus() && isActiveWindow(); }
1059 void applicationFocusChanged(QWidget *old, QWidget *now);
1065 void scrollViewChanged(
bool at_end);
1074 QString joinSummaryRow(QStringList col_parts,
int row,
SummaryCopyType type);
1310 void columnVisibilityTriggered();
1317 void sectionResized(
int col,
int,
int new_width);
1325 void sectionMoved(
int logicalIndex,
int oldVisualIndex,
int newVisualIndex);
1335 void vScrollBarActionTriggered(
int);
1340 void drawFarOverlay();
1345 void drawNearOverlay();
1351 void updatePackets(
bool redraw);
1356 void ctxDecodeAsDialog();
1363 void updatePinnedRowVisibility();
1369 void pinnedSelectionChanged(
const QItemSelection &selected,
const QItemSelection &deselected);
1375 void pinnedCurrentChanged(
const QModelIndex ¤t);
1388 void layoutPinnedOverlays();
struct _capture_file capture_file
Represents a capture file and its associated metadata.
A delegate for rendering multi-colored packet items in a view.
Definition multi_color_packet_delegate.h:40
void setRegularFont(const QFont ®ular_font)
Sets the regular font used in the list.
Definition packet_list.cpp:2756
void forwardHeaderMousePress(QMouseEvent *event, const QPoint &header_pos)
Forwards a header mouse press (used for resize dragging) from the pinned column view's own header to ...
Definition packet_list.cpp:1486
void showContextMenuForRow(int row, const QPoint &global_pos)
Shows this view's context menu for a row already resolved by an overlay view's own indexAt(),...
Definition packet_list.cpp:1439
bool uniqueSelectActive()
Checks if a single unique selection is currently active.
Definition packet_list.cpp:729
QList< int > createSizePartsForAligned(bool useHeader, QStringList hdr_parts, QList< int > frame_nums)
Creates size parts for aligned formatting.
Definition packet_list.cpp:3363
void forwardWheelEvent(QWheelEvent *event)
Forwards a wheel scroll event from a pinned overlay view so scrolling stays perfectly in sync with th...
Definition packet_list.cpp:1516
QString allPacketComments()
Retrieves all packet comments in the capture.
Definition packet_list.cpp:2676
PinAction
What pinning or unpinning the selected packets would do.
Definition packet_list.h:423
@ UnpinRows
Definition packet_list.h:427
@ PinRows
Definition packet_list.h:425
@ PinRowsOverLimit
Definition packet_list.h:426
@ NoPinAction
Definition packet_list.h:424
void applyTimeShift()
Applies a time shift to the capture packets.
Definition packet_list.cpp:2924
void timerEvent(QTimerEvent *event) override
Handles timer events.
Definition packet_list.cpp:1313
void columnHiddenChanged(int column, bool hidden)
Emitted from setColumnVisibility() for every column whenever any column's visibility changes,...
virtual void focusOutEvent(QFocusEvent *event) override
Handles focus out events. Needed to stops turbo mode navigation if we lose focus.
Definition packet_list.cpp:1812
QPoint frozenHeaderPosToReal(const QPoint &frozen_pos) const
Translates a position local to the pinned column view's own header (PinnedColumnHeader,...
Definition packet_list.cpp:1461
QString createSummaryText(int frame_num, SummaryCopyType type)
Creates a summary text for a specific packet.
Definition packet_list.cpp:3314
void setHoveredFrameNum(int frame_num)
Same as setHoveredRowFromOverlay(), but given the frame number directly rather than a row to resolve ...
Definition packet_list.cpp:1657
void resizeAllColumns(bool onlyTimeFormatted=false)
Resizes all columns to fit their content.
Definition packet_list.cpp:3799
QString createHeaderSummaryForAligned(QStringList hdr_parts, QList< int > align_parts, QList< int > size_parts)
Creates an aligned header summary.
Definition packet_list.cpp:3400
void setTimeReference()
Toggles the time reference status on the currently selected frame.
Definition packet_list.cpp:2909
virtual void mouseMoveEvent(QMouseEvent *event) override
Handles mouse move events.
Definition packet_list.cpp:1541
PacketList(QWidget *parent=0)
Constructs a new PacketList object.
Definition packet_list.cpp:266
virtual void keyPressEvent(QKeyEvent *event) override
Handles key press events.
Definition packet_list.cpp:1668
void markAllDisplayedFrames(bool set)
Marks or unmarks all displayed frames.
Definition packet_list.cpp:2874
QList< int > createAlignmentPartsForAligned()
Creates alignment parts for formatting.
Definition packet_list.cpp:3352
void setPacketComment(unsigned c_number, QString new_comment)
Sets the comment for a specific packet.
Definition packet_list.cpp:2650
void addPacketComment(QString new_comment)
Adds a new comment to the currently selected packet.
Definition packet_list.cpp:2623
void resetColumns()
Resets the columns to their default state.
Definition packet_list.cpp:2113
void goPreviousPacket()
Navigates to the previous packet.
Definition packet_list.cpp:2790
void setHoveredRowFromOverlay(int row)
Updates which row is considered "hovered" from a pinned overlay view's own mouse-move event,...
Definition packet_list.cpp:1651
void setProfileSwitcher(ProfileSwitcher *profile_switcher)
Sets the profile switcher for the packet list.
Definition packet_list.cpp:2178
void redrawVisiblePackets()
Fully redraws all visible packets.
Definition packet_list.cpp:2101
bool freeze(bool keep_current_frame=false)
Disable and clear the packet list.
Definition packet_list.cpp:2358
void setCaptureInProgress(bool in_progress=false, bool auto_scroll=true)
Sets the capture in progress state.
Definition packet_list.h:214
QMenu * colorizeMenu()
Retrieves the colorize menu.
Definition packet_list.h:97
void captureFileReadFinished()
Handles the event when the capture file has finished reading.
Definition packet_list.cpp:2332
virtual void mousePressEvent(QMouseEvent *event) override
Handles mouse press events.
Definition packet_list.cpp:1337
QString getFilterFromFdataAndColumn(frame_data *fdata, int column)
Same as getFilterFromRowAndColumn(), but for a frame that may not have a row in this (filtered) view,...
Definition packet_list.cpp:2535
void writeRecent(FILE *rf)
Writes recent configuration to a file.
Definition packet_list.cpp:2497
void pinSelectedRows()
Pins every currently selected row (or, if nothing is selected, the current row) so each stays visible...
Definition packet_list.cpp:3130
void deleteCommentsFromPackets()
Deletes comments from the selected packets.
Definition packet_list.cpp:2707
void colorsChanged()
Slot triggered when global color configurations change.
Definition packet_list.cpp:513
bool havePreviousHistory(bool update_cur=false)
Checks if there is a previous packet in the selection history.
Definition packet_list.cpp:2137
void setColumnVisibility()
Updates the visibility of columns, including propagating global column-hidden state to the pinned-col...
Definition packet_list.cpp:1832
int selectedFrameCount(int limit=0) const
Counts the selected packets, as selectedFrames(false) would return, stopping early once the count rea...
Definition packet_list.cpp:739
virtual void focusInEvent(QFocusEvent *event) override
Handles focus in events.
Definition packet_list.cpp:1790
QList< frame_data * > selectedFrames(bool fall_back_to_current=true) const
The selected packets: the union of the rows selected in this view and the pinned rows selected in the...
Definition packet_list.cpp:839
void startCellDragFromOverlay(int row, int column)
Starts a cell drag (filter, or selected-rows text) for the given row/column, exactly as dragging that...
Definition packet_list.cpp:1559
virtual void contextMenuEvent(QContextMenuEvent *event) override
Handles context menu events.
Definition packet_list.cpp:1059
void toggleFrameMarkFromClick(const QModelIndex &source_index)
Toggles the mark on a packet in response to a middle click, in this view or one of the pinned overlay...
Definition packet_list.cpp:1351
virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint=EnsureVisible) override
Scrolls the view to the given index.
Definition packet_list.cpp:490
void editColumn(int column)
Signal emitted to trigger editing for a specific column.
void paintHoveredRow(QPainter *painter, const QTreeView *view, const QStyleOptionViewItem &option, const QModelIndex &index) const
Paints the hover highlight over one row of view.
Definition packet_list.cpp:679
void selectRowFromOverlay(int row, int column, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
Selects/marks a row as if the user had clicked it directly in this view, given a row already resolved...
Definition packet_list.cpp:1381
void showContextMenuForSourceIndex(const QModelIndex &source_index, const QPoint &global_pos, bool from_pinned_row_strip=false)
Shows this view's context menu for a packet given by its index in the source PacketListModel....
Definition packet_list.cpp:1068
QString createOpeningTagForHtml()
Creates the opening tag block for HTML summaries.
Definition packet_list.cpp:3453
QMenu * conversationMenu()
Retrieves the conversation menu.
Definition packet_list.h:91
void setColumnDelegate()
Sets the column delegate for the view.
Definition packet_list.cpp:1854
bool haveNextHistory(bool update_cur=false)
Checks if there is a next packet in the selection history.
Definition packet_list.cpp:2119
void pinnedRowsCornerWidthChanged(int corner_width, bool have_pinned_rows)
Emitted whenever the width needed for the pinned-row strip's "corner" (the frozen-column portion,...
bool thaw(bool restore_selection=false)
Enable and restore the packet list.
Definition packet_list.cpp:2399
void goNextPacket()
Navigates to the next packet.
Definition packet_list.cpp:2772
virtual void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Custom drawing logic for a row.
Definition packet_list.cpp:655
void setProtoTree(ProtoTree *proto_tree)
Sets the protocol tree.
Definition packet_list.cpp:721
void togglePinSelectedRows()
Pins the selected packets, or unpins them if they're all pinned already (see selectedRowsPinAction())...
Definition packet_list.cpp:3111
void goToPacket(int packet, int hf_id=-1)
Jumps directly to a specific packet number.
Definition packet_list.cpp:2829
int hoveredFrameNum() const
The frame number of the row currently tracked as hovered across all panes, or -1 if none....
Definition packet_list.h:646
int pinnedColumnBoundary() const
The current frozen-column boundary (see setPinnedColumnBoundary()), for callers that need the current...
Definition packet_list.h:482
bool isFrozen() const
Whether the packet list is frozen (see freeze()).
Definition packet_list.h:130
void showProtocolPreferences(const QString module_name)
Signal emitted to show protocol specific preferences.
void clear()
Clears the packet list.
Definition packet_list.cpp:2467
void goNextHistoryPacket()
Navigates to the next packet in the selection history.
Definition packet_list.cpp:2843
bool multiSelectActive()
Checks if multiple selections are currently active.
Definition packet_list.cpp:734
PinAction selectedRowsPinAction() const
What toggling the pinning of the selected packets (see selectedFrames()) would do.
Definition packet_list.cpp:3054
QString getFilterFromRowAndColumn(QModelIndex idx)
Retrieves the filter string based on a given row and column.
Definition packet_list.cpp:2527
~PacketList()
Destroys the PacketList object.
Definition packet_list.cpp:482
void packetListScrolled(bool at_end)
Signal emitted when the packet list has been scrolled.
void deleteAllPacketComments()
Deletes all packet comments in the capture.
Definition packet_list.cpp:2718
QString createSummaryForAligned(int frame_num, QList< int > align_parts, QList< int > size_parts)
Creates an aligned summary for a specific packet.
Definition packet_list.cpp:3414
QString createSummaryForHtml(int frame_num)
Creates an HTML summary for a specific packet.
Definition packet_list.cpp:3473
void setMonospaceFont(const QFont &mono_font)
Sets the monospace font used in the list.
Definition packet_list.cpp:2744
virtual void mouseReleaseEvent(QMouseEvent *event) override
Handles mouse release events.
Definition packet_list.cpp:1365
void goPreviousHistoryPacket()
Navigates to the previous packet in the selection history.
Definition packet_list.cpp:2852
void packetDissectionChanged()
Signal emitted when packet dissection data changes.
QList< int > selectedRows(bool useFrameNum=false)
Retrieves a list of selected row numbers.
Definition packet_list.cpp:809
virtual void keyReleaseEvent(QKeyEvent *event) override
Handles key release events.
Definition packet_list.cpp:1776
void columnsChanged()
Slot triggered when the column configuration changes.
Definition packet_list.cpp:2192
void goFirstPacket()
Navigates to the very first packet.
Definition packet_list.cpp:2813
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
Handles selection change events.
Definition packet_list.cpp:1024
void freezePacketList(bool changing_profile)
Slot to trigger freezing the packet list state.
Definition packet_list.cpp:2309
void redrawVisiblePacketsDontSelectCurrent()
Redraws all visible packets without modifying the current selection.
Definition packet_list.cpp:2108
void goLastPacket()
Navigates to the very last packet.
Definition packet_list.cpp:2821
void resetColorized()
Resets the colorized state of the packets.
Definition packet_list.cpp:2594
QString createDefaultStyleForHtml()
Retrieves the default CSS style for HTML summaries.
Definition packet_list.cpp:3441
void forwardHeaderContextMenu(QContextMenuEvent *event, const QPoint &header_pos)
Forwards a header context menu request from the pinned column view's own header.
Definition packet_list.cpp:1472
void setPinnedColumnBoundary(int column_count)
Freezes the leftmost columns so they stay visible while the view is scrolled horizontally.
Definition packet_list.cpp:3183
QString createHeaderSummaryText(SummaryCopyType type)
Creates the header summary text.
Definition packet_list.cpp:3330
void editProtocolPreference(pref_t *pref, module_t *module)
Signal emitted to edit a specific protocol preference.
void rowsInserted(const QModelIndex &parent, int start, int end) override
Slot triggered when rows are inserted into the model.
Definition packet_list.cpp:3784
QString createClosingTagForHtml()
Creates the closing tag block for HTML summaries.
Definition packet_list.cpp:3500
int pinnedRowHeight() const
The height of a single row in this view, for sizing the pinned-row strip to exactly N rows (see Pinne...
Definition packet_list.cpp:3172
void recolorPackets()
Recolors the displayed packets based on rules.
Definition packet_list.cpp:2315
void unsetAllTimeReferences()
Unsets all time reference flags on all frames.
Definition packet_list.cpp:2917
QString createHeaderSummaryForHtml()
Creates the HTML header summary.
Definition packet_list.cpp:3458
QStringList createHeaderPartsForAligned()
Creates string parts for aligned headers.
Definition packet_list.cpp:3341
void setVerticalAutoScroll(bool enabled=true)
Enables or disables vertical auto-scrolling.
Definition packet_list.cpp:2322
void startCellDragForSourceIndex(const QModelIndex &source_index)
As startCellDragFromOverlay(), for a cell given by its index in the source PacketListModel....
Definition packet_list.cpp:1568
void sortByColumnFromOverlay(int column)
Sorts by the given column as if its header section had been clicked directly, toggling order if it's ...
Definition packet_list.cpp:1521
void fieldsChanged(capture_file *cf)
Slot triggered when global fields configuration changes.
Definition packet_list.cpp:2227
void fieldSelected(FieldInformation *finfo)
Signal emitted when a specific field is selected.
void paintEvent(QPaintEvent *event) override
Handles paint events.
Definition packet_list.cpp:1328
static bool isColumnFrozen(int column, int boundary)
The single shared definition of "column i is frozen" given a frozen-column boundary,...
Definition packet_list.h:491
void setCaptureFile(capture_file *cf)
Sets the active capture file.
Definition packet_list.cpp:2729
QString getPacketComment(unsigned c_number)
Retrieves the comment for a specific packet.
Definition packet_list.cpp:2600
virtual void changeEvent(QEvent *event) override
Handles window-activation changes.
Definition packet_list.cpp:617
bool contextMenuActive()
Checks if the context menu is currently active.
Definition packet_list.cpp:2522
void setPinnedRowViews(PinnedRowView *row_view, PinnedRowView *corner_view)
Supplies the pinned-row-strip overlay views for this view to manage the content/properties of (model,...
Definition packet_list.cpp:424
void unpinSelectedRows()
Unpins every currently selected row (or, if nothing is selected, the current row) that is currently p...
Definition packet_list.cpp:3143
SummaryCopyType
Types of formats available for copying packet summaries.
Definition packet_list.h:68
@ CopyAsYAML
Copy summary as YAML format.
Definition packet_list.h:74
@ CopyAsHTML
Copy summary as HTML format.
Definition packet_list.h:76
@ CopyAsCSV
Copy summary as Comma-Separated Values (CSV).
Definition packet_list.h:72
@ CopyAsText
Copy summary as plain text.
Definition packet_list.h:70
void pinnedRowsChanged()
Emitted when packets are pinned or unpinned.
virtual void resizeEvent(QResizeEvent *event) override
Handles resize events.
Definition packet_list.cpp:1824
virtual void leaveEvent(QEvent *event) override
Clears the tracked hover row when the mouse leaves this view (and, by extension, all pinned overlay v...
Definition packet_list.cpp:1640
void framesSelected(QList< int > frames)
Signal emitted when multiple frames are selected.
void updatePinActions(QAction *pin_selected, QAction *unpin_all) const
Sets the text and enabled state of the main window's pin actions to match the selection and the pinne...
Definition packet_list.cpp:3083
void pinnedColumnBoundaryChanged(int column_count)
Emitted from setPinnedColumnBoundary() whenever the frozen- column boundary changes,...
void ignoreAllDisplayedFrames(bool set)
Ignores or un-ignores all displayed frames.
Definition packet_list.cpp:2900
void ignoreFrame()
Toggles the ignore status of the currently selected frame.
Definition packet_list.cpp:2887
void preferencesChanged()
Slot triggered when global preferences have changed.
Definition packet_list.cpp:2267
void markFrame()
Toggles the mark on the currently selected frame.
Definition packet_list.cpp:2861
void showColumnPreferences(QString pane_name)
Signal emitted to show preferences for a specific pane.
frame_data * getFDataForRow(int row) const
Retrieves the frame data for a specific row.
Definition packet_list.cpp:2186
A Qt item model representing the list of packets in a capture file.
Definition packet_list_model.h:36
A proxy model exposing the packets of a PacketListModel that pass the display filter,...
Definition packet_list_proxy_model.h:42
A QTreeView clone showing only a leftmost run of columns from a shared model, used to keep "frozen" c...
Definition pinned_column_view.h:34
A QTreeView clone that shows every row of a PinnedRowsModel (i.e. every currently pinned packet,...
Definition pinned_row_view.h:32
A proxy model exposing only a chosen set of "pinned" packets from a PacketListModel,...
Definition pinned_rows_model.h:39
Monitors incoming packets and automatically switches the active configuration profile when a packet m...
Definition profile_switcher.h:38
A tree view for displaying protocol dissection details.
Definition proto_tree.h:30
Definition tag_column_delegate.h:24
DIAG_OFF_PEDANTIC struct _frame_data frame_data
Frame data structure.