2018-06-16 14:03:31 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef QPREF_H
|
|
|
|
#define QPREF_H
|
|
|
|
#include "core/pref.h"
|
2018-08-14 07:56:20 +00:00
|
|
|
#include "ssrf-version.h"
|
|
|
|
|
2018-07-25 17:49:48 +00:00
|
|
|
#include <QObject>
|
2018-09-04 09:18:43 +00:00
|
|
|
#include <QQmlEngine>
|
2018-06-16 14:03:31 +00:00
|
|
|
|
|
|
|
class qPref : public QObject {
|
|
|
|
Q_OBJECT
|
2018-07-07 20:59:26 +00:00
|
|
|
Q_PROPERTY(QString canonical_version READ canonical_version);
|
|
|
|
Q_PROPERTY(QString mobile_version READ mobile_version);
|
2018-06-16 14:03:31 +00:00
|
|
|
|
|
|
|
public:
|
2018-06-16 08:08:34 +00:00
|
|
|
qPref(QObject *parent = NULL);
|
2018-06-16 14:03:31 +00:00
|
|
|
static qPref *instance();
|
|
|
|
|
|
|
|
// Load/Sync local settings (disk) and struct preference
|
2018-08-14 07:56:20 +00:00
|
|
|
static void load() { loadSync(false); }
|
|
|
|
static void sync() { loadSync(true); }
|
2018-06-16 14:03:31 +00:00
|
|
|
|
2018-08-31 09:57:28 +00:00
|
|
|
// Register QML
|
2018-09-04 09:18:43 +00:00
|
|
|
void registerQML(QQmlEngine *engine);
|
2018-08-31 09:57:28 +00:00
|
|
|
|
2018-06-16 14:03:31 +00:00
|
|
|
public:
|
2018-08-14 07:56:20 +00:00
|
|
|
static const QString canonical_version() { return QString(CANONICAL_VERSION_STRING); }
|
|
|
|
static const QString mobile_version() { return QString(MOBILE_VERSION_STRING); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void loadSync(bool doSync);
|
2018-06-16 14:03:31 +00:00
|
|
|
};
|
|
|
|
#endif
|