1 /*
2    Bacula(R) - The Network Backup Solution
3 
4    Copyright (C) 2000-2020 Kern Sibbald
5 
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8 
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13 
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16 
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 #ifndef JOBSMODEL_H
20 #define JOBSMODEL_H
21 
22 #include <QAbstractTableModel>
23 #include "common.h"
24 
25 class JobsModel : public QAbstractTableModel
26 {
27     Q_OBJECT
28 
29 public:
30     enum {
31         ID_COLUMN =0,
32         TDATE_COLUMN,
33         HASCACHE_COLUMN,
34         NAME_COLUMN,
35         NUM_COLUMN
36     };
37 
38     struct row_struct {
39         uint64_t    id;
40         QDateTime   tdate;
41         QString     hasCache;
42         QString     name;
43     };
44 
45     explicit JobsModel(const QList<row_struct>& t, QObject *parent = NULL);
46     // Header:
47     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
48 
49     // Basic functionality:
50     int rowCount(const QModelIndex &parent = QModelIndex()) const;
51     int columnCount(const QModelIndex &parent = QModelIndex()) const;
52 
53     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
54 
55 private:
56     QList<row_struct> table;
57 };
58 
59 #endif // JOBSMODEL_H
60