summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-14 09:56:20 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-15 16:11:39 -0700
commit0825f644e0b98190d68e0b63c4204fa8282e84b4 (patch)
tree82f9c2bfba158b25f1988e8614d28d2d67221a50 /core
parent253d868328a8c43aacff3ad9e40c923881cae862 (diff)
downloadsubsurface-0825f644e0b98190d68e0b63c4204fa8282e84b4.tar.gz
core: make qPref.* use static
Prepare qPref.* to run load/sync Make variables and methods static to give easy access Make getter inline to give faster access Signed-off-by: Jan Iversen <jani@apache.org>:wq
Diffstat (limited to 'core')
-rw-r--r--core/settings/qPref.cpp14
-rw-r--r--core/settings/qPref.h15
-rw-r--r--core/settings/qPrefGeneral.cpp2
3 files changed, 13 insertions, 18 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp
index 36ec4d6c3..e5f662470 100644
--- a/core/settings/qPref.cpp
+++ b/core/settings/qPref.cpp
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "qPref.h"
#include "qPrefPrivate.h"
-#include "ssrf-version.h"
qPref::qPref(QObject *parent) : QObject(parent)
{
@@ -14,6 +13,9 @@ qPref *qPref::instance()
void qPref::loadSync(bool doSync)
{
+ if (!doSync)
+ uiLanguage(NULL);
+
qPrefAnimations::instance()->loadSync(doSync);
qPrefCloudStorage::instance()->loadSync(doSync);
qPrefDisplay::instance()->loadSync(doSync);
@@ -30,13 +32,3 @@ void qPref::loadSync(bool doSync)
qPrefUnits::instance()->loadSync(doSync);
qPrefUpdateManager::instance()->loadSync(doSync);
}
-
-const QString qPref::canonical_version() const
-{
- return QString(CANONICAL_VERSION_STRING);
-}
-
-const QString qPref::mobile_version() const
-{
- return QString(MOBILE_VERSION_STRING);
-}
diff --git a/core/settings/qPref.h b/core/settings/qPref.h
index 805bf68c5..36fd9d09a 100644
--- a/core/settings/qPref.h
+++ b/core/settings/qPref.h
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
#ifndef QPREF_H
#define QPREF_H
-
#include "core/pref.h"
+#include "ssrf-version.h"
+
#include <QObject>
#include "qPrefAnimations.h"
@@ -32,9 +33,8 @@ public:
static qPref *instance();
// Load/Sync local settings (disk) and struct preference
- void loadSync(bool doSync);
- void load() { loadSync(false); }
- void sync() { loadSync(true); }
+ static void load() { loadSync(false); }
+ static void sync() { loadSync(true); }
public:
enum cloud_status {
@@ -45,8 +45,11 @@ public:
CS_NOCLOUD
};
- const QString canonical_version() const;
- const QString mobile_version() const;
+ 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);
};
#endif
diff --git a/core/settings/qPrefGeneral.cpp b/core/settings/qPrefGeneral.cpp
index 4364ce731..85c828de8 100644
--- a/core/settings/qPrefGeneral.cpp
+++ b/core/settings/qPrefGeneral.cpp
@@ -51,7 +51,7 @@ void qPrefGeneral::set_default_file_behavior(enum def_file_behavior value)
prefs.default_file_behavior = value;
}
disk_default_file_behavior(true);
- emit default_file_behavior_changed(value);
+ emit qPrefGeneral::instance()->default_file_behavior_changed(value);
}
}
void qPrefGeneral::disk_default_file_behavior(bool doSync)