mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 16:23:39 +02:00
cleanup firstRun with a common setting
This commit is contained in:
parent
22f4beab1a
commit
33c5cb519a
6 changed files with 12 additions and 5 deletions
|
@ -1091,6 +1091,11 @@ void Application::checkChangeCursor() {
|
|||
|
||||
_cursorNeedsChanging = false;
|
||||
}
|
||||
|
||||
|
||||
// After all of the constructor is completed, then set firstRun to false.
|
||||
Setting::Handle<bool> firstRun{ Settings::firstRun, true };
|
||||
firstRun.set(false);
|
||||
}
|
||||
|
||||
void Application::showCursor(const QCursor& cursor) {
|
||||
|
@ -2950,7 +2955,7 @@ void Application::init() {
|
|||
addressLookupString = arguments().value(urlIndex + 1);
|
||||
}
|
||||
|
||||
Setting::Handle<bool> firstRun { "firstRun", true };
|
||||
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
||||
if (addressLookupString.isEmpty() && firstRun.get()) {
|
||||
qDebug() << "First run and no URL passed... attempting to Go Home...";
|
||||
DependencyManager::get<AddressManager>()->goHomeOrElsewhere();
|
||||
|
|
|
@ -270,12 +270,12 @@ void ScriptEngines::loadOneScript(const QString& scriptFilename) {
|
|||
|
||||
void ScriptEngines::loadScripts() {
|
||||
// check first run...
|
||||
if (_firstRun.get()) {
|
||||
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
||||
if (firstRun.get()) {
|
||||
qCDebug(scriptengine) << "This is a first run...";
|
||||
// clear the scripts, and set out script to our default scripts
|
||||
clearScripts();
|
||||
loadDefaultScripts();
|
||||
_firstRun.set(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,6 @@ protected:
|
|||
void onScriptEngineError(const QString& scriptFilename);
|
||||
void launchScriptEngine(ScriptEngine* engine);
|
||||
|
||||
|
||||
Setting::Handle<bool> _firstRun { "firstRun", true };
|
||||
QReadWriteLock _scriptEnginesHashLock;
|
||||
QHash<QUrl, ScriptEngine*> _scriptEnginesHash;
|
||||
QSet<ScriptEngine*> _allKnownScriptEngines;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
const QString Settings::firstRun { "firstRun" };
|
||||
|
||||
void Settings::getFloatValueIfValid(const QString& name, float& floatValue) {
|
||||
const QVariant badDefaultValue = NAN;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
// TODO: remove
|
||||
class Settings : public QSettings {
|
||||
public:
|
||||
static const QString firstRun;
|
||||
|
||||
void getFloatValueIfValid(const QString& name, float& floatValue);
|
||||
void getBoolValue(const QString& name, bool& boolValue);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <QVariant>
|
||||
|
||||
namespace Setting {
|
||||
|
||||
void preInit();
|
||||
void init();
|
||||
void cleanupSettings();
|
||||
|
|
Loading…
Reference in a new issue