| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
fileset_entry_model.h
Go to the documentation of this file.
1
9
10#ifndef FILESET_ENTRY_MODEL_H
11#define FILESET_ENTRY_MODEL_H
12
13#include <config.h>
14
15#include <fileset.h>
16
17#include <QAbstractItemModel>
18#include <QModelIndex>
19#include <QVector>
20
24 class FilesetEntryModel : public QAbstractItemModel
25{
26 Q_OBJECT
27
28 public:
33 explicit FilesetEntryModel(QObject * parent = 0);
34
41 QModelIndex index(int row, int column, const QModelIndex & = QModelIndex()) const override;
42
47 virtual QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
48
54 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
55
60 virtual int columnCount(const QModelIndex &) const override { return ColumnCount; }
61
68 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
69
77 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
78
83 virtual void appendEntry(const fileset_entry *entry);
84
90 const fileset_entry *getRowEntry(int row) const { return entries_.value(row, NULL); }
91
96 int entryCount() const { return static_cast<int>(entries_.count()); }
97
101 void clear();
102
103 private:
105 QVector<const fileset_entry *> entries_;
106
110 enum Column {
111 Name,
112 Created,
113 Modified,
114 Size,
115 ColumnCount
116 };
117
123 QString nameToDate(const char *name) const;
124
130 QString time_tToString(time_t clock) const;
131};
132
133#endif // FILESET_ENTRY_MODEL_H
FilesetEntryModel::parent
virtual QModelIndex parent(const QModelIndex &) const override
Retrieves the parent of a given index. Everything is under the root.
Definition fileset_entry_model.h:47
FilesetEntryModel::FilesetEntryModel
FilesetEntryModel(QObject *parent=0)
Constructs a new FilesetEntryModel.
Definition fileset_entry_model.cpp:18
FilesetEntryModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under a given parent.
Definition fileset_entry_model.cpp:31
FilesetEntryModel::index
QModelIndex index(int row, int column, const QModelIndex &=QModelIndex()) const override
Generates an index for the given row and column.
Definition fileset_entry_model.cpp:22
FilesetEntryModel::entryCount
int entryCount() const
Retrieves the total number of entries in the model.
Definition fileset_entry_model.h:96
FilesetEntryModel::clear
void clear()
Calls fileset_delete and clears our model data.
Definition fileset_entry_model.cpp:115
FilesetEntryModel::data
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Retrieves data from the model for a given index and role.
Definition fileset_entry_model.cpp:36
FilesetEntryModel::getRowEntry
const fileset_entry * getRowEntry(int row) const
Retrieves the fileset entry at a specific row.
Definition fileset_entry_model.h:90
FilesetEntryModel::appendEntry
virtual void appendEntry(const fileset_entry *entry)
Appends a new entry to the fileset model.
Definition fileset_entry_model.cpp:108
FilesetEntryModel::columnCount
virtual int columnCount(const QModelIndex &) const override
Returns the number of columns under a given parent.
Definition fileset_entry_model.h:60
FilesetEntryModel::headerData
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Retrieves the header data for a specific section and role.
Definition fileset_entry_model.cpp:89
fileset.h
fileset_entry
struct _fileset_entry fileset_entry
Describes a single file belonging to a capture file set.