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
87#include <PhysicsEngine.h>87#include <PhysicsEngine.h>
88#include <PhysicsHelpers.h>88#include <PhysicsHelpers.h>
89#include <plugins/PluginManager.h>89#include <plugins/PluginManager.h>
90#include <plugins/PluginUtils.h>
90#include <plugins/CodecPlugin.h>91#include <plugins/CodecPlugin.h>
91#include <RecordingScriptingInterface.h>92#include <RecordingScriptingInterface.h>
92#include <RenderableWebEntityItem.h>93#include <RenderableWebEntityItem.h>
@@ -1255,8 +1256,87 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 1162 unmodified lines
1255 return entityServerNode && !isPhysicsEnabled();1256 return entityServerNode && !isPhysicsEnabled();
1256 });1257 });
1257 1258
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
1258 // After all of the constructor is completed, then set firstRun to false.1339 // After all of the constructor is completed, then set firstRun to false.
1259 Setting::Handle<bool> firstRun{ Settings::firstRun, true };
1260 firstRun.set(false);1340 firstRun.set(false);
1261}1341}
1262 1342
@@ -3279,15 +3359,6 @@ void Application::init() { · 2016 unmodified lines
3279 3359
3280 _timerStart.start();3360 _timerStart.start();
3281 _lastTimeUpdated.start();3361 _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
3291 // when +connect_lobby in command line, join steam lobby3362 // when +connect_lobby in command line, join steam lobby
3292 const QString STEAM_LOBBY_COMMAND_LINE_KEY = "+connect_lobby";3363 const QString STEAM_LOBBY_COMMAND_LINE_KEY = "+connect_lobby";
3293 int lobbyIndex = arguments().indexOf(STEAM_LOBBY_COMMAND_LINE_KEY);3364 int lobbyIndex = arguments().indexOf(STEAM_LOBBY_COMMAND_LINE_KEY);
@@ -3296,21 +3367,6 @@ void Application::init() { · 2 unmodified lines
3296 SteamClient::joinLobby(lobbyId);3367 SteamClient::joinLobby(lobbyId);
3297 }3368 }
3298 3369
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 }
3314 3370
3315 qCDebug(interfaceapp) << "Loaded settings";3371 qCDebug(interfaceapp) << "Loaded settings";
3316 3372
@@ -4562,11 +4618,15 @@ void Application::resetSensors(bool andReload) { · 1245 unmodified lines
4562 4618
4563void Application::updateWindowTitle() const {4619void Application::updateWindowTitle() const {
4564 4620
4565 QString buildVersion = " (build " + applicationVersion() + ")";
4566 auto nodeList = DependencyManager::get<NodeList>();4621 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)";
4567 4627
4568 QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) ";4628 QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)";
4569 QString username = DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();4629 QString username = accountManager->getAccountInfo().getUsername();
4570 QString currentPlaceName = DependencyManager::get<AddressManager>()->getHost();4630 QString currentPlaceName = DependencyManager::get<AddressManager>()->getHost();
4571 4631
4572 if (currentPlaceName.isEmpty()) {4632 if (currentPlaceName.isEmpty()) {
@@ -4574,7 +4634,7 @@ void Application::updateWindowTitle() const { · 1 unmodified line
4574 }4634 }
4575 4635
4576 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())4636 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
4577 + currentPlaceName + connectionStatus + buildVersion;4637 + currentPlaceName + connectionStatus + loginStatus + buildVersion;
4578 4638
4579#ifndef WIN324639#ifndef WIN32
4580 // crashes with vs2013/win324640 // 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