mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:28:37 +02:00
add first cut at firstrun support
This commit is contained in:
parent
c34b64e296
commit
571ecf0964
2 changed files with 21 additions and 4 deletions
|
@ -251,7 +251,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection);
|
||||||
|
|
||||||
_settings = new QSettings(this);
|
_settings = new QSettings(this);
|
||||||
|
|
||||||
// Check to see if the user passed in a command line option for loading a local
|
// Check to see if the user passed in a command line option for loading a local
|
||||||
// Voxel File.
|
// Voxel File.
|
||||||
_voxelsFilename = getCmdOption(argc, constArgv, "-i");
|
_voxelsFilename = getCmdOption(argc, constArgv, "-i");
|
||||||
|
@ -330,9 +330,18 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
|
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
||||||
|
|
||||||
// do this as late as possible so that all required subsystems are inialized
|
// check first run...
|
||||||
loadScripts();
|
QVariant firstRunValue = _settings->value("firstRun",QVariant(true));
|
||||||
|
if (firstRunValue.isValid() && firstRunValue.toBool()) {
|
||||||
|
qDebug() << "This is a first run...";
|
||||||
|
// clear the scripts, and set out script to our default scripts
|
||||||
|
clearScriptsBeforeRunning();
|
||||||
|
loadScript("http://public.highfidelity.io/scripts/defaultScripts.js");
|
||||||
|
} else {
|
||||||
|
// do this as late as possible so that all required subsystems are inialized
|
||||||
|
loadScripts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
@ -3454,6 +3463,13 @@ void Application::loadScripts() {
|
||||||
settings->endArray();
|
settings->endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::clearScriptsBeforeRunning() {
|
||||||
|
// clears all scripts from the settings
|
||||||
|
QSettings* settings = new QSettings(this);
|
||||||
|
settings->beginWriteArray("Settings");
|
||||||
|
settings->endArray();
|
||||||
|
}
|
||||||
|
|
||||||
void Application::saveScripts() {
|
void Application::saveScripts() {
|
||||||
// saves all current running scripts
|
// saves all current running scripts
|
||||||
QSettings* settings = new QSettings(this);
|
QSettings* settings = new QSettings(this);
|
||||||
|
|
|
@ -115,6 +115,7 @@ public:
|
||||||
void loadScript(const QString& fileNameString);
|
void loadScript(const QString& fileNameString);
|
||||||
void loadScripts();
|
void loadScripts();
|
||||||
void storeSizeAndPosition();
|
void storeSizeAndPosition();
|
||||||
|
void clearScriptsBeforeRunning();
|
||||||
void saveScripts();
|
void saveScripts();
|
||||||
void initializeGL();
|
void initializeGL();
|
||||||
void paintGL();
|
void paintGL();
|
||||||
|
|
Loading…
Reference in a new issue