10#ifndef PACKET_LIST_MODEL_H
11#define PACKET_LIST_MODEL_H
19#include <QAbstractItemModel>
84 QModelIndex
index(
int row,
int column,
85 const QModelIndex &
parent = QModelIndex())
const override;
91 QModelIndex
parent(
const QModelIndex &)
const override;
117 bool isEmpty()
const {
return physical_rows_.isEmpty(); }
129 int rowCount(
const QModelIndex &
parent = QModelIndex())
const override;
135 int columnCount(
const QModelIndex & = QModelIndex())
const override;
142 Qt::ItemFlags
flags(
const QModelIndex &
index)
const override;
150 QVariant
data(
const QModelIndex &d_index,
int role)
const override;
159 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
195 void setFrameMark(
const QVector<PacketListRecord *> &records,
bool set);
208 void setFrameIgnore(
const QVector<PacketListRecord *> &records,
bool set);
226 void addFrameComment(
const QModelIndexList &indices,
const QByteArray &comment);
265 void onThemeChanged();
282 void refreshThemeColors();
288 QList<QString> col_names_;
291 QVector<PacketListRecord *> physical_rows_;
struct _capture_file capture_file
Represents a capture file and its associated metadata.
void setFrameComment(const QModelIndex &index, const QByteArray &comment, unsigned c_number)
Sets a specific comment on a frame.
Definition packet_list_model.cpp:409
void deleteFrameComments(const QModelIndexList &indices)
Deletes comments from the specified frames.
Definition packet_list_model.cpp:440
void unsetAllFrameRefTime()
Unsets the reference time state for all frames.
Definition packet_list_model.cpp:344
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the item flags for the given index.
Definition packet_list_model.cpp:518
QModelIndex parent(const QModelIndex &) const override
Returns the parent of the model item.
Definition packet_list_model.cpp:102
void clear()
Clears the model data.
Definition packet_list_model.cpp:131
capture_file * captureFile() const
Returns the capture file associated with the model.
Definition packet_list_model.h:75
PacketListRecord * physicalRecordAt(int row) const
Retrieves the PacketListRecord at the given row.
Definition packet_list_model.cpp:123
void setFrameIgnore(const QVector< PacketListRecord * > &records, bool set)
Sets the ignore state for the given frames.
Definition packet_list_model.cpp:280
void flushNewRows()
Inserts the rows for any packets appended since the last flush.
Definition packet_list_model.cpp:662
void setFrameMark(const QVector< PacketListRecord * > &records, bool set)
Sets the mark state for the given frames.
Definition packet_list_model.cpp:234
void deleteAllFrameComments()
Deletes all frame comments from all frames.
Definition packet_list_model.cpp:473
void resetColorized()
Resets the colorized state for all rows.
Definition packet_list_model.cpp:194
void setCaptureFile(capture_file *cf)
Sets the capture file for the model.
Definition packet_list_model.cpp:82
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the data for the given role and section in the header.
Definition packet_list_model.cpp:637
QVariant data(const QModelIndex &d_index, int role) const override
Returns the data stored under the given role for the specified index.
Definition packet_list_model.cpp:527
int columnCount(const QModelIndex &=QModelIndex()) const override
Returns the number of columns.
Definition packet_list_model.cpp:513
void invalidateAllColumnStrings()
Invalidate any cached column strings.
Definition packet_list_model.cpp:140
bool isEmpty() const
Returns true if no packets have been appended.
Definition packet_list_model.h:117
void toggleFrameMark(const QModelIndexList &indices)
Toggles the mark state for the specified frames.
Definition packet_list_model.cpp:205
~PacketListModel()
Destroys the PacketListModel.
Definition packet_list_model.cpp:75
void toggleFrameIgnore(const QModelIndexList &indices)
Toggles the ignore state for the specified frames.
Definition packet_list_model.cpp:251
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
Definition packet_list_model.cpp:505
PacketListRecord * physicalRecordForFrameNum(int frame_num) const
Retrieves the PacketListRecord for a given frame/packet number regardless of whether it currently pas...
Definition packet_list_model.cpp:107
void toggleFrameRefTime(const QModelIndexList &indices)
Toggles the reference time state for the specified frames.
Definition packet_list_model.cpp:297
int appendPacket(frame_data *fdata)
Appends a packet to the model. The row is inserted the next time flushNewRows() runs,...
Definition packet_list_model.cpp:675
PacketListModel(QObject *parent=0, capture_file *cf=NULL)
Constructs a new PacketListModel.
Definition packet_list_model.cpp:60
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the item in the model.
Definition packet_list_model.cpp:88
@ HEADER_CAN_DISPLAY_DETAILS
Definition packet_list_model.h:47
@ COLORING_RULE_COLORS
Definition packet_list_model.h:50
@ HEADER_CAN_DISPLAY_STRINGS
Definition packet_list_model.h:45
void packetAppended(capture_file *cap_file, frame_data *fdata, qsizetype row)
Signal emitted when a packet is successfully appended.
void addFrameComment(const QModelIndexList &indices, const QByteArray &comment)
Adds a comment to the specified frames.
Definition packet_list_model.cpp:366
void resetColumns()
Rebuild columns from settings.
Definition packet_list_model.cpp:180
Represents a single record within the packet list.
Definition packet_list_record.h:40
DIAG_OFF_PEDANTIC struct _frame_data frame_data
Frame data structure.