-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatastore.h
executable file
·62 lines (47 loc) · 1.25 KB
/
datastore.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 DATASTORE_H
#define DATASTORE_H
#include "apionsen.h"
#include "downloadmanager.h"
#include <QHash>
#include <QList>
#include <QDate>
#include <QFile>
#include <QSet>
class DataStore : public QObject
{
Q_OBJECT
public:
QHash<QString, Show> shows;
DataStore();
int init(bool force = false);
void setFavorite(const Show & cur_show, bool fav);
void setWatched(const Show & cur_show, QDate date);
bool isFavorite(const Show & cur_show);
bool isWatched(const Show & cur_show);
//void addToArchive(const Show &);
int load();
void save();
int loadUser();
void saveUser();
private:
ApiOnsen api_onsen;
DownloadManager download_manager;
QFile shows_file;
QFile user_file;
QHash<QString, QDate> viewDates;
QSet<QString> favorites;
QDate last_sync;
QDataStream::Version data_version;
private slots:
void onGotProgress(qint64, qint64);
void onGotData(QByteArray data);
signals:
void showsChanged();
void downloadStarted();
void downloadProgress(qint64, qint64);
void downloadFinished(const QVector<Show> & new_shows, const QVector<Show> & new_fav_shows);
void statusChanged(QString);
void favorited(int);
void watched(int);
};
#endif // DATASTORE_H