-
Notifications
You must be signed in to change notification settings - Fork 16
/
settings.h
65 lines (57 loc) · 1.51 KB
/
settings.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
63
64
65
/*
* A wrapper around QSettings to store configurations
* Could perhaps be simplified
* By Yao Yujian
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include <QObject>
#include <QSettings>
#include <QStringList>
#include <QDateTime>
#include <QJsonDocument>
#include <QDir>
#include <QFile>
#include <QVariant>
#include "externalpageparser.h"
class Settings : public QObject
{
Q_OBJECT
public:
explicit Settings(QDir baseDir, QObject *parent = 0);
QString token();
QString directory();
bool notify();
const QStringList& recents();
void addRecentFile(const QString&);
double maxFileSize();
bool ignoreUploadable();
bool notifyAnnouncement();
QDateTime lastAnnouncementTime();
ExternalPageParser::Config pagesInfo();
QString pagesInfoJson();
static ExternalPageParser::Config convertJSONToConfig(const QVariantMap&);
signals:
public slots:
void setToken(const QString&);
void setDirectory(const QString&);
void setNotify(bool val);
void setMaxFileSize(double s);
void setIgnoreUploadable(bool);
void setNotifyAnnouncement(bool);
void setLastAnnouncementTime(QDateTime);
void setConfig(const QVariantMap&);
private:
QSettings* settingsPrivate;
QString _token;
QString _directory;
QStringList _recents;
bool _ignoreUploadable;
bool _notify;
bool _notifyAnnouncement;
QDateTime _lastAnnouncementTime;
ExternalPageParser::Config _pagesInfo;
QFile* pagesInfoFile;
QString _pagesInfoJson;
};
#endif // SETTINGS_H