From 9c7ea6ac7c467ca215ba5a33524e28ad0a542686 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 21 Sep 2016 16:48:17 -0700 Subject: [PATCH] Update logic for going to tutorial on launch --- interface/src/Application.cpp | 37 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ef5f044cf0..7a505c96c0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1275,37 +1275,46 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : bool hasTutorialContent = contentVersion >= 1; Setting::Handle firstRun { Settings::firstRun, true }; - bool isOnVive = _displayPlugin && _displayPlugin->getName() == "OpenVR (Vive)"; + bool hasVive = false; + for (auto& displayPlugin : PluginManager::getInstance()->getDisplayPlugins()) { + if (displayPlugin->getName() == "OpenVR (Vive)") { + hasVive = true; + break; + } + } Setting::Handle tutorialComplete { "tutorialComplete", false }; - bool shouldGoToTutorial = isOnVive && hasTutorialContent && !tutorialComplete.get(); - qDebug() << "Is on vive " << isOnVive << ", " << _displayPlugin->getName(); + bool shouldGoToTutorial = hasVive && hasTutorialContent && !tutorialComplete.get(); + qDebug() << "has vive: " << hasVive << ", current plugin: " << _displayPlugin->getName(); qDebug() << "has tutorial content" << hasTutorialContent; qDebug() << "tutorial complete" << tutorialComplete.get(); qDebug() << "should go to tutorial " << shouldGoToTutorial; + // when --url in command line, teleport to location + const QString HIFI_URL_COMMAND_LINE_KEY = "--url"; + int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY); + QString addressLookupString; + if (urlIndex != -1) { + addressLookupString = arguments().value(urlIndex + 1); + } if (shouldGoToTutorial) { DependencyManager::get()->ifLocalSandboxRunningElse([=]() { qDebug() << "Home sandbox appears to be running, going to Home."; //DependencyManager::get()->goToLocalSandbox("/tutorial"); - DependencyManager::get()->loadSettings("hifi://sport/tutorial"); + DependencyManager::get()->loadSettings("hifi://sport/tutorial_begin"); }, [=]() { qDebug() << "Home sandbox does not appear to be running, going to Entry."; showHelp(); - DependencyManager::get()->goToEntry(); + if (addressLookupString.isEmpty()) { + DependencyManager::get()->goToEntry(); + } else { + DependencyManager::get()->loadSettings(addressLookupString); + } }); } else { - // when --url in command line, teleport to location - const QString HIFI_URL_COMMAND_LINE_KEY = "--url"; - int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY); - QString addressLookupString; - if (urlIndex != -1) { - addressLookupString = arguments().value(urlIndex + 1); - } - if (firstRun.get()) { showHelp(); } @@ -5391,8 +5400,6 @@ void Application::initPlugins(const QStringList& arguments) { auto preferredDisplays = parser.value(display).split(',', QString::SkipEmptyParts); qInfo() << "Setting prefered display plugins:" << preferredDisplays; PluginManager::getInstance()->setPreferredDisplayPlugins(preferredDisplays); - } else { - PluginManager::getInstance()->setPreferredDisplayPlugins({ "OpenVR (Vive)", "Oculus Rift" }); } if (parser.isSet(disableDisplays)) {