History

add first cut at firstrun support

ZappoMan committed 12 years ago

Commit 571ecf01 parent c34b64e2 files · +21 −4Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+20−4
@@ -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 local255 // 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 inialized334 // 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
338Application::~Application() {347Application::~Application() {
@@ -3454,6 +3463,13 @@ void Application::loadScripts() { · 3115 unmodified lines
3454 settings->endArray();3463 settings->endArray();
3455}3464}
3456 3465
3466void Application::clearScriptsBeforeRunning() {
3467 // clears all scripts from the settings
3468 QSettings* settings = new QSettings(this);
3469 settings->beginWriteArray("Settings");
3470 settings->endArray();
3471}
3472
3457void Application::saveScripts() {3473void Application::saveScripts() {
3458 // saves all current running scripts3474 // saves all current running scripts
3459 QSettings* settings = new QSettings(this);3475 QSettings* settings = new QSettings(this);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t