-
Notifications
You must be signed in to change notification settings - Fork 0
/
showlistmodel.h
executable file
·62 lines (47 loc) · 1.44 KB
/
showlistmodel.h
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
53
54
55
56
57
58
59
60
61
62
#ifndef SHOWLISTMODEL_H
#define SHOWLISTMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
#include <datastore.h>
typedef QPair<int, QString> ProgressPair;
Q_DECLARE_METATYPE(ProgressPair)
class ShowListModel : public QAbstractTableModel
{
Q_OBJECT
public:
ShowListModel(QObject *parent, DataStore & store, bool archive);
enum columns
{
COLUMN_TITLE,
COLUMN_EP,
COLUMN_DATE,
COLUMN_PERSO,
COLUMN_ID,
COLUMN_DOWNLOAD,
COLUMNS_SIZE
};
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool isFavorite(int row);
bool isWatched(int row);
Show & show(int row);
int showRow(const Show & cur_show);
ProgressPair & progress(int row);
void setProgress(int row, int percentage, const QString &text);
void resetProgress(int row);
void setFavorite(int row, bool checked);
void setWatched(int row, QDate date);
DataStore & dataStore();
private:
bool is_archive;
QStringList columns_names;
QHash<int, ProgressPair> percentages;
DataStore & data_store;
QVector<Show> list;
private slots:
//void onWatched(int row);
void onShowsChanged();
};
#endif // SHOWLISTMODEL_H