From ae2715af31f5469f1cacac45dc175a541d84a08a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 1 Nov 2018 08:57:12 +1300 Subject: [PATCH] Add option to start up at home location --- interface/src/Application.cpp | 12 +++++++++++- interface/src/Menu.cpp | 8 ++++++++ interface/src/Menu.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 7cd91d76a0..04d3a07ad4 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3503,7 +3503,17 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { } else { #if !defined(Q_OS_ANDROID) - qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString); + QString goingTo = ""; + if (addressLookupString.isEmpty()) { + if (Menu::getInstance()->isOptionChecked(MenuOption::HomeLocation)) { + auto locationBookmarks = DependencyManager::get(); + addressLookupString = locationBookmarks->addressForBookmark(LocationBookmarks::HOME_BOOKMARK); + goingTo = "home location"; + } else { + goingTo = "previous location"; + } + } + qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(!goingTo.isEmpty() ? goingTo : addressLookupString); DependencyManager::get()->loadSettings(addressLookupString); sentTo = SENT_TO_PREVIOUS_LOCATION; #endif diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 539bdabe7d..df6de25118 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -226,6 +226,14 @@ Menu::Menu() { addActionToQMenuAndActionHash(navigateMenu, MenuOption::CopyPath, 0, addressManager.data(), SLOT(copyPath())); + // Navigate > Start-up Location + MenuWrapper* startupLocationMenu = navigateMenu->addMenu(MenuOption::StartUpLocation); + QActionGroup* startupLocatiopnGroup = new QActionGroup(startupLocationMenu); + startupLocatiopnGroup->setExclusive(true); + startupLocatiopnGroup->addAction(addCheckableActionToQMenuAndActionHash(startupLocationMenu, MenuOption::HomeLocation, 0, + false)); + startupLocatiopnGroup->addAction(addCheckableActionToQMenuAndActionHash(startupLocationMenu, MenuOption::LastLocation, 0, + true)); // Settings menu ---------------------------------- MenuWrapper* settingsMenu = addMenu("Settings"); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 1e9955a760..885ef08ce9 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -117,9 +117,11 @@ namespace MenuOption { const QString FrameTimer = "Show Timer"; const QString FullscreenMirror = "Mirror"; const QString Help = "Help..."; + const QString HomeLocation = "Home"; const QString IncreaseAvatarSize = "Increase Avatar Size"; const QString IndependentMode = "Independent Mode"; const QString ActionMotorControl = "Enable Default Motor Control"; + const QString LastLocation = "Last Location"; const QString LoadScript = "Open and Run Script File..."; const QString LoadScriptURL = "Open and Run Script from URL..."; const QString LodTools = "LOD Tools"; @@ -197,6 +199,7 @@ namespace MenuOption { const QString SimulateEyeTracking = "Simulate"; const QString SMIEyeTracking = "SMI Eye Tracking"; const QString SparseTextureManagement = "Enable Sparse Texture Management"; + const QString StartUpLocation = "Start-Up Location"; const QString Stats = "Show Statistics"; const QString AnimStats = "Show Animation Stats"; const QString StopAllScripts = "Stop All Scripts";