3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef FILESET_ENTRY_MODEL_H
11 #define FILESET_ENTRY_MODEL_H
17 #include <QAbstractItemModel>
18 #include <QModelIndex>
21 class FilesetEntryModel
: public QAbstractItemModel
26 explicit FilesetEntryModel(QObject
* parent
= 0);
28 QModelIndex
index(int row
, int column
, const QModelIndex
& = QModelIndex()) const;
29 // Everything is under the root.
30 virtual QModelIndex
parent(const QModelIndex
&) const { return QModelIndex(); }
31 virtual int rowCount(const QModelIndex
&parent
= QModelIndex()) const;
32 virtual int columnCount(const QModelIndex
&) const { return ColumnCount
; }
33 virtual QVariant
data(const QModelIndex
&index
, int role
= Qt::DisplayRole
) const;
34 virtual QVariant
headerData(int section
, Qt::Orientation
, int role
= Qt::DisplayRole
) const;
36 virtual void appendEntry(const fileset_entry
*entry
);
37 const fileset_entry
*getRowEntry(int row
) const { return entries_
.value(row
, NULL
); }
38 int entryCount() const { return static_cast<int>(entries_
.count()); }
39 // Calls fileset_delete and clears our model data.
43 QVector
<const fileset_entry
*> entries_
;
44 enum Column
{ Name
, Created
, Modified
, Size
, ColumnCount
};
46 QString
nameToDate(const char *name
) const ;
47 QString
time_tToString(time_t clock
) const;
50 #endif // FILESET_ENTRY_MODEL_H