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:
Berthold Stoeger 2019-04-03 23:31:28 +02:00 committed by Dirk Hohndel
parent e9fa298d06
commit a89b36c661
2 changed files with 1 additions and 17 deletions

View file

@ -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());

View file

@ -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); }