update epan/dissectors/pidl/drsuapi/drsuapi.idl from samba
[wireshark-sm.git] / ui / qt / models / fileset_entry_model.h
blob40e6796f4e53728ac723d0ef46e6158065739084
1 /** @file
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
8 */
10 #ifndef FILESET_ENTRY_MODEL_H
11 #define FILESET_ENTRY_MODEL_H
13 #include <config.h>
15 #include <fileset.h>
17 #include <QAbstractItemModel>
18 #include <QModelIndex>
19 #include <QVector>
21 class FilesetEntryModel : public QAbstractItemModel
23 Q_OBJECT
25 public:
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.
40 void clear();
42 private:
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