forked from powersst/Maple-Tree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamelibrary.h
47 lines (39 loc) · 1.1 KB
/
gamelibrary.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
#ifndef GAMELIBRARY_H
#define GAMELIBRARY_H
#include <QDir>
#include <QDirIterator>
#include <QFile>
#include <QMessageBox>
#include <QObject>
#include <QVector>
#include <QtConcurrent>
#include "titleinfo.h"
#include "libraryentry.h"
class GameLibrary : public QObject {
Q_OBJECT
public:
explicit GameLibrary(QObject* parent = nullptr);
~GameLibrary();
void init(const QString& directory);
void setupLibrary(bool force = false);
void setupLibrary(QString directory, bool force);
static QString processLibItem(const QString &baseDir);
void setupDatabase(QByteArray qbyteArray);
static QVariant processDbItem(const QVariant &item);
bool saveDatabase();
bool load(QString filepath);
bool save(QString filepath);
QString jsonFile;
QString baseDirectory;
QMap<QString, LibraryEntry*> library;
QMap<QString, TitleInfo*> database;
static GameLibrary* self;
signals:
void changed(LibraryEntry*);
void addTitle(LibraryEntry*);
void progress(quint32 min, quint32 max);
void loadComplete();
private:
QMutex mutex;
};
#endif // GAMELIBRARY_H