forked from CMon/QHumble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhumbledb.h
49 lines (44 loc) · 1.3 KB
/
humbledb.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
#ifndef HUMBLEDB_H
#define HUMBLEDB_H
#include <QObject>
#include <QSqlDatabase>
#include <QSqlDriver>
#include "db/purchase.h"
#include "db/product.h"
#include "db/download.h"
#include "db/file.h"
#include <QList>
#include "db/customquerymodel.h"
#include <QSortFilterProxyModel>
class HumbleDB : public QObject
{
Q_OBJECT
public:
explicit HumbleDB(QObject *parent = nullptr);
const QString databaseName = "qhumble";
void clearDB();
int addPurchase(Purchase purchase);
int addProduct(Product product);
int addDownload(Download download);
int addFile(File file);
void updatePurchase(Purchase purchase);
void updateProduct(Product product);
void updateDownload(Download download);
int getPurchaseCount();
int purchaseExists(Purchase purchase);
int productExists(Product product);
int downloadExists(Download download);
void eraseFilesForDownload(int download);
QSqlQueryModel *getPurchaseModel();
QSqlQueryModel *getProductModel(int purchaseId);
QSqlQueryModel *getProductPlatforms(int product);
QSqlQueryModel *getDownloadModel(int product);
QSqlQueryModel *getFileModel(int download);
QSortFilterProxyModel *getFilterablePurchaseModel();
signals:
void dbCleared();
void newDBEntry();
public slots:
private:
};
#endif // HUMBLEDB_H