Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -251,7 +251,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 250 unmodified lines | |||
| 251 | QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection); | 251 | QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection); |
| 252 | 252 | ||
| 253 | _settings = new QSettings(this); | 253 | _settings = new QSettings(this); |
| 254 | 254 | ||
| 255 | // Check to see if the user passed in a command line option for loading a local | 255 | // Check to see if the user passed in a command line option for loading a local |
| 256 | // Voxel File. | 256 | // Voxel File. |
| 257 | _voxelsFilename = getCmdOption(argc, constArgv, "-i"); | 257 | _voxelsFilename = getCmdOption(argc, constArgv, "-i"); |
| @@ -330,9 +330,18 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 72 unmodified lines | |||
| 330 | 330 | ||
| 331 | LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree()); | 331 | LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree()); |
| 332 | LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard); | 332 | LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard); |
| 333 | 333 | ||
| 334 | // do this as late as possible so that all required subsystems are inialized | 334 | // check first run... |
| 335 | loadScripts(); | 335 | QVariant firstRunValue = _settings->value("firstRun",QVariant(true)); |
| 336 | if (firstRunValue.isValid() && firstRunValue.toBool()) { | ||
| 337 | qDebug() << "This is a first run..."; | ||
| 338 | // clear the scripts, and set out script to our default scripts | ||
| 339 | clearScriptsBeforeRunning(); | ||
| 340 | loadScript("http://public.highfidelity.io/scripts/defaultScripts.js"); | ||
| 341 | } else { | ||
| 342 | // do this as late as possible so that all required subsystems are inialized | ||
| 343 | loadScripts(); | ||
| 344 | } | ||
| 336 | } | 345 | } |
| 337 | 346 | ||
| 338 | Application::~Application() { | 347 | Application::~Application() { |
| @@ -3454,6 +3463,13 @@ void Application::loadScripts() { · 3115 unmodified lines | |||
| 3454 | settings->endArray(); | 3463 | settings->endArray(); |
| 3455 | } | 3464 | } |
| 3456 | 3465 | ||
| 3466 | void Application::clearScriptsBeforeRunning() { | ||
| 3467 | // clears all scripts from the settings | ||
| 3468 | QSettings* settings = new QSettings(this); | ||
| 3469 | settings->beginWriteArray("Settings"); | ||
| 3470 | settings->endArray(); | ||
| 3471 | } | ||
| 3472 | |||
| 3457 | void Application::saveScripts() { | 3473 | void Application::saveScripts() { |
| 3458 | // saves all current running scripts | 3474 | // saves all current running scripts |
| 3459 | QSettings* settings = new QSettings(this); | 3475 | QSettings* settings = new QSettings(this); |