mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 03:03:35 +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;
|
_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) {
|
void Application::showCursor(const QCursor& cursor) {
|
||||||
|
@ -2950,7 +2955,7 @@ void Application::init() {
|
||||||
addressLookupString = arguments().value(urlIndex + 1);
|
addressLookupString = arguments().value(urlIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Setting::Handle<bool> firstRun { "firstRun", true };
|
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
||||||
if (addressLookupString.isEmpty() && firstRun.get()) {
|
if (addressLookupString.isEmpty() && firstRun.get()) {
|
||||||
qDebug() << "First run and no URL passed... attempting to Go Home...";
|
qDebug() << "First run and no URL passed... attempting to Go Home...";
|
||||||
DependencyManager::get<AddressManager>()->goHomeOrElsewhere();
|
DependencyManager::get<AddressManager>()->goHomeOrElsewhere();
|
||||||
|
|
|
@ -270,12 +270,12 @@ void ScriptEngines::loadOneScript(const QString& scriptFilename) {
|
||||||
|
|
||||||
void ScriptEngines::loadScripts() {
|
void ScriptEngines::loadScripts() {
|
||||||
// check first run...
|
// check first run...
|
||||||
if (_firstRun.get()) {
|
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
||||||
|
if (firstRun.get()) {
|
||||||
qCDebug(scriptengine) << "This is a first run...";
|
qCDebug(scriptengine) << "This is a first run...";
|
||||||
// clear the scripts, and set out script to our default scripts
|
// clear the scripts, and set out script to our default scripts
|
||||||
clearScripts();
|
clearScripts();
|
||||||
loadDefaultScripts();
|
loadDefaultScripts();
|
||||||
_firstRun.set(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,6 @@ protected:
|
||||||
void onScriptEngineError(const QString& scriptFilename);
|
void onScriptEngineError(const QString& scriptFilename);
|
||||||
void launchScriptEngine(ScriptEngine* engine);
|
void launchScriptEngine(ScriptEngine* engine);
|
||||||
|
|
||||||
|
|
||||||
Setting::Handle<bool> _firstRun { "firstRun", true };
|
|
||||||
QReadWriteLock _scriptEnginesHashLock;
|
QReadWriteLock _scriptEnginesHashLock;
|
||||||
QHash<QUrl, ScriptEngine*> _scriptEnginesHash;
|
QHash<QUrl, ScriptEngine*> _scriptEnginesHash;
|
||||||
QSet<ScriptEngine*> _allKnownScriptEngines;
|
QSet<ScriptEngine*> _allKnownScriptEngines;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
const QString Settings::firstRun { "firstRun" };
|
||||||
|
|
||||||
void Settings::getFloatValueIfValid(const QString& name, float& floatValue) {
|
void Settings::getFloatValueIfValid(const QString& name, float& floatValue) {
|
||||||
const QVariant badDefaultValue = NAN;
|
const QVariant badDefaultValue = NAN;
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
// TODO: remove
|
// TODO: remove
|
||||||
class Settings : public QSettings {
|
class Settings : public QSettings {
|
||||||
public:
|
public:
|
||||||
|
static const QString firstRun;
|
||||||
|
|
||||||
void getFloatValueIfValid(const QString& name, float& floatValue);
|
void getFloatValueIfValid(const QString& name, float& floatValue);
|
||||||
void getBoolValue(const QString& name, bool& boolValue);
|
void getBoolValue(const QString& name, bool& boolValue);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
namespace Setting {
|
namespace Setting {
|
||||||
|
|
||||||
void preInit();
|
void preInit();
|
||||||
void init();
|
void init();
|
||||||
void cleanupSettings();
|
void cleanupSettings();
|
||||||
|
|
Loading…
Reference in a new issue