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 | 251 | QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection); |
| 252 | 252 | |
| 253 | 253 | _settings = new QSettings(this); |
| 254 | − | |
| 254 | + | |
| 255 | 255 | // Check to see if the user passed in a command line option for loading a local |
| 256 | 256 | // Voxel File. |
| 257 | 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 | 331 | LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree()); |
| 332 | 332 | LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard); |
| 333 | − | |
| 334 | − // do this as late as possible so that all required subsystems are inialized | |
| 335 | − loadScripts(); | |
| 333 | + | |
| 334 | + // check first run... | |
| 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 | 347 | Application::~Application() { |
| @@ -3454,6 +3463,13 @@ void Application::loadScripts() { · 3115 unmodified lines | ||
| 3454 | 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 | 3473 | void Application::saveScripts() { |
| 3458 | 3474 | // saves all current running scripts |
| 3459 | 3475 | QSettings* settings = new QSettings(this); |