blob: aa812b0cf70a29c8dca02270290d788c22be78c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/** @file
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef FILESET_ENTRY_MODEL_H
#define FILESET_ENTRY_MODEL_H
#include <config.h>
#include <glib.h>
#include <fileset.h>
#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVector>
class FilesetEntryModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit FilesetEntryModel(QObject * parent = 0);
QModelIndex index(int row, int column, const QModelIndex & = QModelIndex()) const;
// Everything is under the root.
virtual QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &) const { return ColumnCount; }
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation, int role = Qt::DisplayRole) const;
virtual void appendEntry(const fileset_entry *entry);
const fileset_entry *getRowEntry(int row) const { return entries_.value(row, NULL); }
int entryCount() const { return static_cast<int>(entries_.count()); }
// Calls fileset_delete and clears our model data.
void clear();
private:
QVector<const fileset_entry *> entries_;
enum Column { Name, Created, Modified, Size, ColumnCount };
QString nameToDate(const char *name) const ;
QString time_tToString(time_t clock) const;
};
#endif // FILESET_ENTRY_MODEL_H
|