History

Merge 'master' into 'out-of-body-experience'

Andrew Meadows committed 10 years ago

Commit d54c07e2 parents 77e8082 58d4eb7101 files · +3904 −271Browse files

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

Unified · Split

interface/src/Application.cpp+89−29
@@ -87,6 +87,7 @@ · 86 unmodified lines
8787 #include <PhysicsEngine.h>
8888 #include <PhysicsHelpers.h>
8989 #include <plugins/PluginManager.h>
90+#include <plugins/PluginUtils.h>
9091 #include <plugins/CodecPlugin.h>
9192 #include <RecordingScriptingInterface.h>
9293 #include <RenderableWebEntityItem.h>
@@ -1255,8 +1256,87 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 1162 unmodified lines
12551256 return entityServerNode && !isPhysicsEnabled();
12561257 });
12571258
1259+
1260+
1261+ // Get sandbox content set version, if available
1262+ auto acDirPath = PathUtils::getRootDataDirectory() + BuildInfo::MODIFIED_ORGANIZATION + "/assignment-client/";
1263+ auto contentVersionPath = acDirPath + "content-version.txt";
1264+ qDebug() << "Checking " << contentVersionPath << " for content version";
1265+ auto contentVersion = 0;
1266+ QFile contentVersionFile(contentVersionPath);
1267+ if (contentVersionFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
1268+ QString line = contentVersionFile.readAll();
1269+ // toInt() returns 0 if the conversion fails, so we don't need to specifically check for failure
1270+ contentVersion = line.toInt();
1271+ }
1272+ qDebug() << "Server content version: " << contentVersion;
1273+
1274+ bool hasTutorialContent = contentVersion >= 1;
1275+
1276+ Setting::Handle<bool> firstRun { Settings::firstRun, true };
1277+ bool hasHMDAndHandControllers = PluginUtils::isHMDAvailable("OpenVR (Vive)") && PluginUtils::isHandControllerAvailable();
1278+ Setting::Handle<bool> tutorialComplete { "tutorialComplete", false };
1279+
1280+ bool shouldGoToTutorial = hasHMDAndHandControllers && hasTutorialContent && !tutorialComplete.get();
1281+
1282+ qDebug() << "Has HMD + Hand Controllers: " << hasHMDAndHandControllers << ", current plugin: " << _displayPlugin->getName();
1283+ qDebug() << "Has tutorial content: " << hasTutorialContent;
1284+ qDebug() << "Tutorial complete: " << tutorialComplete.get();
1285+ qDebug() << "Should go to tutorial: " << shouldGoToTutorial;
1286+
1287+ // when --url in command line, teleport to location
1288+ const QString HIFI_URL_COMMAND_LINE_KEY = "--url";
1289+ int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY);
1290+ QString addressLookupString;
1291+ if (urlIndex != -1) {
1292+ addressLookupString = arguments().value(urlIndex + 1);
1293+ }
1294+
1295+ const QString TUTORIAL_PATH = "/tutorial_begin";
1296+
1297+ if (shouldGoToTutorial) {
1298+ DependencyManager::get<AddressManager>()->ifLocalSandboxRunningElse([=]() {
1299+ qDebug() << "Home sandbox appears to be running, going to Home.";
1300+ DependencyManager::get<AddressManager>()->goToLocalSandbox(TUTORIAL_PATH);
1301+ }, [=]() {
1302+ qDebug() << "Home sandbox does not appear to be running, going to Entry.";
1303+ if (firstRun.get()) {
1304+ showHelp();
1305+ }
1306+ if (addressLookupString.isEmpty()) {
1307+ DependencyManager::get<AddressManager>()->goToEntry();
1308+ } else {
1309+ DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
1310+ }
1311+ });
1312+ } else {
1313+
1314+ bool isFirstRun = firstRun.get();
1315+
1316+ if (isFirstRun) {
1317+ showHelp();
1318+ }
1319+
1320+ // If this is a first run we short-circuit the address passed in
1321+ if (isFirstRun) {
1322+ if (hasHMDAndHandControllers) {
1323+ DependencyManager::get<AddressManager>()->ifLocalSandboxRunningElse([=]() {
1324+ qDebug() << "Home sandbox appears to be running, going to Home.";
1325+ DependencyManager::get<AddressManager>()->goToLocalSandbox();
1326+ }, [=]() {
1327+ qDebug() << "Home sandbox does not appear to be running, going to Entry.";
1328+ DependencyManager::get<AddressManager>()->goToEntry();
1329+ });
1330+ } else {
1331+ DependencyManager::get<AddressManager>()->goToEntry();
1332+ }
1333+ } else {
1334+ qDebug() << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString);
1335+ DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
1336+ }
1337+ }
1338+
12581339 // After all of the constructor is completed, then set firstRun to false.
1259− Setting::Handle<bool> firstRun{ Settings::firstRun, true };
12601340 firstRun.set(false);
12611341 }
12621342
@@ -3279,15 +3359,6 @@ void Application::init() { · 2016 unmodified lines
32793359
32803360 _timerStart.start();
32813361 _lastTimeUpdated.start();
3282−
3283− // when --url in command line, teleport to location
3284− const QString HIFI_URL_COMMAND_LINE_KEY = "--url";
3285− int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY);
3286− QString addressLookupString;
3287− if (urlIndex != -1) {
3288− addressLookupString = arguments().value(urlIndex + 1);
3289− }
3290−
32913362 // when +connect_lobby in command line, join steam lobby
32923363 const QString STEAM_LOBBY_COMMAND_LINE_KEY = "+connect_lobby";
32933364 int lobbyIndex = arguments().indexOf(STEAM_LOBBY_COMMAND_LINE_KEY);
@@ -3296,21 +3367,6 @@ void Application::init() { · 2 unmodified lines
32963367 SteamClient::joinLobby(lobbyId);
32973368 }
32983369
3299− Setting::Handle<bool> firstRun { Settings::firstRun, true };
3300− if (addressLookupString.isEmpty() && firstRun.get()) {
3301− qCDebug(interfaceapp) << "First run and no URL passed... attempting to go to Home or Entry...";
3302− DependencyManager::get<AddressManager>()->ifLocalSandboxRunningElse([](){
3303− qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home.";
3304− DependencyManager::get<AddressManager>()->goToLocalSandbox();
3305− },
3306− [](){
3307− qCDebug(interfaceapp) << "Home sandbox does not appear to be running, going to Entry.";
3308− DependencyManager::get<AddressManager>()->goToEntry();
3309− });
3310− } else {
3311− qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString);
3312− DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
3313− }
33143370
33153371 qCDebug(interfaceapp) << "Loaded settings";
33163372
@@ -4562,11 +4618,15 @@ void Application::resetSensors(bool andReload) { · 1245 unmodified lines
45624618
45634619 void Application::updateWindowTitle() const {
45644620
4565− QString buildVersion = " (build " + applicationVersion() + ")";
45664621 auto nodeList = DependencyManager::get<NodeList>();
4622+ auto accountManager = DependencyManager::get<AccountManager>();
4623+
4624+ QString buildVersion = " (build " + applicationVersion() + ")";
4625+
4626+ QString loginStatus = accountManager->isLoggedIn() ? "" : " (NOT LOGGED IN)";
45674627
4568− QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) ";
4569− QString username = DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();
4628+ QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)";
4629+ QString username = accountManager->getAccountInfo().getUsername();
45704630 QString currentPlaceName = DependencyManager::get<AddressManager>()->getHost();
45714631
45724632 if (currentPlaceName.isEmpty()) {
@@ -4574,7 +4634,7 @@ void Application::updateWindowTitle() const { · 1 unmodified line
45744634 }
45754635
45764636 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
4577− + currentPlaceName + connectionStatus + buildVersion;
4637+ + currentPlaceName + connectionStatus + loginStatus + buildVersion;
45784638
45794639 #ifndef WIN32
45804640 // crashes with vs2013/win32

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