Showing the changes to interface/src/Application.cpp (1 of 120 files). Show all
Unified · Split
| @@ -299,9 +299,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 298 unmodified lines | ||
| 299 | 299 | |
| 300 | 300 | AddressManager& addressManager = AddressManager::getInstance(); |
| 301 | 301 | |
| 302 | − // connect to the domainChangeRequired signal on AddressManager | |
| 303 | − connect(&addressManager, &AddressManager::possibleDomainChangeRequired, | |
| 302 | + // use our MyAvatar position and quat for address manager path | |
| 303 | + addressManager.setPositionGetter(getPositionForPath); | |
| 304 | + addressManager.setOrientationGetter(getOrientationForPath); | |
| 305 | + | |
| 306 | + // handle domain change signals from AddressManager | |
| 307 | + connect(&addressManager, &AddressManager::possibleDomainChangeRequiredToHostname, | |
| 304 | 308 | this, &Application::changeDomainHostname); |
| 309 | + | |
| 310 | + connect(&addressManager, &AddressManager::possibleDomainChangeRequiredViaICEForID, | |
| 311 | + &domainHandler, &DomainHandler::setIceServerHostnameAndID); | |
| 305 | 312 | |
| 306 | 313 | _settings = new QSettings(this); |
| 307 | 314 | _numChangedSettings = 0; |
| @@ -1796,16 +1803,25 @@ void Application::init() { · 1488 unmodified lines | ||
| 1796 | 1803 | |
| 1797 | 1804 | Menu::getInstance()->loadSettings(); |
| 1798 | 1805 | _audio.setReceivedAudioStreamSettings(Menu::getInstance()->getReceivedAudioStreamSettings()); |
| 1799 | − | |
| 1800 | − qDebug() << "Loaded settings"; | |
| 1801 | 1806 | |
| 1802 | 1807 | // when --url in command line, teleport to location |
| 1803 | 1808 | const QString HIFI_URL_COMMAND_LINE_KEY = "--url"; |
| 1804 | 1809 | int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY); |
| 1805 | 1810 | if (urlIndex != -1) { |
| 1806 | 1811 | AddressManager::getInstance().handleLookupString(arguments().value(urlIndex + 1)); |
| 1812 | + } else { | |
| 1813 | + // check if we have a URL in settings to load to jump back to | |
| 1814 | + // we load this separate from the other settings so we don't double lookup a URL | |
| 1815 | + QSettings* interfaceSettings = lockSettings(); | |
| 1816 | + QUrl addressURL = interfaceSettings->value(SETTINGS_ADDRESS_KEY).toUrl(); | |
| 1817 | + | |
| 1818 | + AddressManager::getInstance().handleLookupString(addressURL.toString()); | |
| 1819 | + | |
| 1820 | + unlockSettings(); | |
| 1807 | 1821 | } |
| 1808 | 1822 | |
| 1823 | + qDebug() << "Loaded settings"; | |
| 1824 | + | |
| 1809 | 1825 | #ifdef __APPLE__ |
| 1810 | 1826 | if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseEnabled)) { |
| 1811 | 1827 | // on OS X we only setup sixense if the user wants it on - this allows running without the hid_init crash |
| @@ -3426,7 +3442,7 @@ void Application::updateWindowTitle(){ · 1614 unmodified lines | ||
| 3426 | 3442 | QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) "; |
| 3427 | 3443 | QString username = AccountManager::getInstance().getAccountInfo().getUsername(); |
| 3428 | 3444 | QString title = QString() + (!username.isEmpty() ? username + " @ " : QString()) |
| 3429 | − + nodeList->getDomainHandler().getHostname() + connectionStatus + buildVersion; | |
| 3445 | + + AddressManager::getInstance().getCurrentDomain() + connectionStatus + buildVersion; | |
| 3430 | 3446 | |
| 3431 | 3447 | AccountManager& accountManager = AccountManager::getInstance(); |
| 3432 | 3448 | if (accountManager.getAccountInfo().hasBalance()) { |
| @@ -3448,25 +3464,23 @@ void Application::updateWindowTitle(){ · 15 unmodified lines | ||
| 3448 | 3464 | void Application::updateLocationInServer() { |
| 3449 | 3465 | |
| 3450 | 3466 | AccountManager& accountManager = AccountManager::getInstance(); |
| 3451 | − const QUuid& domainUUID = NodeList::getInstance()->getDomainHandler().getUUID(); | |
| 3467 | + DomainHandler& domainHandler = NodeList::getInstance()->getDomainHandler(); | |
| 3452 | 3468 | |
| 3453 | − if (accountManager.isLoggedIn() && !domainUUID.isNull()) { | |
| 3469 | + if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) { | |
| 3454 | 3470 | |
| 3455 | 3471 | // construct a QJsonObject given the user's current address information |
| 3456 | 3472 | QJsonObject rootObject; |
| 3457 | 3473 | |
| 3458 | 3474 | QJsonObject locationObject; |
| 3459 | 3475 | |
| 3460 | − QString pathString = AddressManager::pathForPositionAndOrientation(_myAvatar->getPosition(), | |
| 3461 | − true, | |
| 3462 | − _myAvatar->getOrientation()); | |
| 3476 | + QString pathString = AddressManager::getInstance().currentPath(); | |
| 3463 | 3477 | |
| 3464 | 3478 | const QString LOCATION_KEY_IN_ROOT = "location"; |
| 3465 | 3479 | const QString PATH_KEY_IN_LOCATION = "path"; |
| 3466 | 3480 | const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id"; |
| 3467 | 3481 | |
| 3468 | 3482 | locationObject.insert(PATH_KEY_IN_LOCATION, pathString); |
| 3469 | − locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainUUID.toString()); | |
| 3483 | + locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainHandler.getUUID().toString()); | |
| 3470 | 3484 | |
| 3471 | 3485 | rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject); |
| 3472 | 3486 | |
| @@ -3876,6 +3890,7 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser · 403 unmodified lines | ||
| 3876 | 3890 | connect(scriptEngine, SIGNAL(loadScript(const QString&, bool)), this, SLOT(loadScript(const QString&, bool))); |
| 3877 | 3891 | |
| 3878 | 3892 | scriptEngine->registerGlobalObject("Overlays", &_overlays); |
| 3893 | + qScriptRegisterMetaType(scriptEngine, RayToOverlayIntersectionResultToScriptValue, RayToOverlayIntersectionResultFromScriptValue); | |
| 3879 | 3894 | |
| 3880 | 3895 | QScriptValue windowValue = scriptEngine->registerGlobalObject("Window", WindowScriptingInterface::getInstance()); |
| 3881 | 3896 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, |