mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-07 20:03:23 +00:00
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
This commit is contained in:
parent
253d868328
commit
0825f644e0
3 changed files with 13 additions and 18 deletions
|
@ -1,7 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
#include "qPref.h"
|
#include "qPref.h"
|
||||||
#include "qPrefPrivate.h"
|
#include "qPrefPrivate.h"
|
||||||
#include "ssrf-version.h"
|
|
||||||
|
|
||||||
qPref::qPref(QObject *parent) : QObject(parent)
|
qPref::qPref(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -14,6 +13,9 @@ qPref *qPref::instance()
|
||||||
|
|
||||||
void qPref::loadSync(bool doSync)
|
void qPref::loadSync(bool doSync)
|
||||||
{
|
{
|
||||||
|
if (!doSync)
|
||||||
|
uiLanguage(NULL);
|
||||||
|
|
||||||
qPrefAnimations::instance()->loadSync(doSync);
|
qPrefAnimations::instance()->loadSync(doSync);
|
||||||
qPrefCloudStorage::instance()->loadSync(doSync);
|
qPrefCloudStorage::instance()->loadSync(doSync);
|
||||||
qPrefDisplay::instance()->loadSync(doSync);
|
qPrefDisplay::instance()->loadSync(doSync);
|
||||||
|
@ -30,13 +32,3 @@ void qPref::loadSync(bool doSync)
|
||||||
qPrefUnits::instance()->loadSync(doSync);
|
qPrefUnits::instance()->loadSync(doSync);
|
||||||
qPrefUpdateManager::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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
#ifndef QPREF_H
|
#ifndef QPREF_H
|
||||||
#define QPREF_H
|
#define QPREF_H
|
||||||
|
|
||||||
#include "core/pref.h"
|
#include "core/pref.h"
|
||||||
|
#include "ssrf-version.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "qPrefAnimations.h"
|
#include "qPrefAnimations.h"
|
||||||
|
@ -32,9 +33,8 @@ public:
|
||||||
static qPref *instance();
|
static qPref *instance();
|
||||||
|
|
||||||
// Load/Sync local settings (disk) and struct preference
|
// Load/Sync local settings (disk) and struct preference
|
||||||
void loadSync(bool doSync);
|
static void load() { loadSync(false); }
|
||||||
void load() { loadSync(false); }
|
static void sync() { loadSync(true); }
|
||||||
void sync() { loadSync(true); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum cloud_status {
|
enum cloud_status {
|
||||||
|
@ -45,8 +45,11 @@ public:
|
||||||
CS_NOCLOUD
|
CS_NOCLOUD
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString canonical_version() const;
|
static const QString canonical_version() { return QString(CANONICAL_VERSION_STRING); }
|
||||||
const QString mobile_version() const;
|
static const QString mobile_version() { return QString(MOBILE_VERSION_STRING); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void loadSync(bool doSync);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -51,7 +51,7 @@ void qPrefGeneral::set_default_file_behavior(enum def_file_behavior value)
|
||||||
prefs.default_file_behavior = value;
|
prefs.default_file_behavior = value;
|
||||||
}
|
}
|
||||||
disk_default_file_behavior(true);
|
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)
|
void qPrefGeneral::disk_default_file_behavior(bool doSync)
|
||||||
|
|
Loading…
Add table
Reference in a new issue