mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: don't instantiate a QPref object
QPref has only static functions. There seems to be no point in instantiating a singleton of this object. Remove the instance() method and remove the Q_OBJECT macro. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e9fa298d06
commit
a89b36c661
2 changed files with 1 additions and 17 deletions
|
@ -18,16 +18,6 @@
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
|
||||||
qPref::qPref(QObject *parent) : QObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
qPref *qPref::instance()
|
|
||||||
{
|
|
||||||
static qPref *self = new qPref;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qPref::loadSync(bool doSync)
|
void qPref::loadSync(bool doSync)
|
||||||
{
|
{
|
||||||
if (!doSync)
|
if (!doSync)
|
||||||
|
@ -58,7 +48,6 @@ void qPref::registerQML(QQmlEngine *engine)
|
||||||
if (engine) {
|
if (engine) {
|
||||||
QQmlContext *ct = engine->rootContext();
|
QQmlContext *ct = engine->rootContext();
|
||||||
|
|
||||||
ct->setContextProperty("Pref", qPref::instance());
|
|
||||||
ct->setContextProperty("PrefCloudStorage", qPrefCloudStorage::instance());
|
ct->setContextProperty("PrefCloudStorage", qPrefCloudStorage::instance());
|
||||||
ct->setContextProperty("PrefDisplay", qPrefDisplay::instance());
|
ct->setContextProperty("PrefDisplay", qPrefDisplay::instance());
|
||||||
ct->setContextProperty("PrefDiveComputer", qPrefDiveComputer::instance());
|
ct->setContextProperty("PrefDiveComputer", qPrefDiveComputer::instance());
|
||||||
|
|
|
@ -6,13 +6,8 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
|
||||||
class qPref : public QObject {
|
class qPref {
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qPref(QObject *parent = NULL);
|
|
||||||
static qPref *instance();
|
|
||||||
|
|
||||||
// Load/Sync local settings (disk) and struct preference
|
// Load/Sync local settings (disk) and struct preference
|
||||||
static void load() { loadSync(false); }
|
static void load() { loadSync(false); }
|
||||||
static void sync() { loadSync(true); }
|
static void sync() { loadSync(true); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue