Showing the changes to interface/src/Application.cpp (1 of 6 files). Show all
Unified · Split
| @@ -339,6 +339,8 @@ static const QString SNAPSHOT_EXTENSION = ".jpg"; · 338 unmodified lines | ||
| 339 | 339 | static const QString JPG_EXTENSION = ".jpg"; |
| 340 | 340 | static const QString PNG_EXTENSION = ".png"; |
| 341 | 341 | static const QString SVO_EXTENSION = ".svo"; |
| 342 | +static const QString SERVERLESS_DOMAIN_EXTENSION = ".domain.json"; | |
| 343 | +static const QString SERVERLESS_DOMAIN_GZ_EXTENSION = ".domain.json.gz"; | |
| 342 | 344 | static const QString SVO_JSON_EXTENSION = ".svo.json"; |
| 343 | 345 | static const QString JSON_GZ_EXTENSION = ".json.gz"; |
| 344 | 346 | static const QString JSON_EXTENSION = ".json"; |
| @@ -349,8 +351,6 @@ static const QString OBJ_EXTENSION = ".obj"; · 4 unmodified lines | ||
| 349 | 351 | static const QString AVA_JSON_EXTENSION = ".ava.json"; |
| 350 | 352 | static const QString WEB_VIEW_TAG = "noDownload=true"; |
| 351 | 353 | static const QString ZIP_EXTENSION = ".zip"; |
| 352 | −static const QString SERVERLESS_DOMAIN_EXTENSION = ".domain.json"; | |
| 353 | −static const QString SERVERLESS_DOMAIN_GZ_EXTENSION = ".domain.json.gz"; | |
| 354 | 354 | |
| 355 | 355 | static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f; |
| 356 | 356 | |
| @@ -382,13 +382,13 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi · 25 unmodified lines | ||
| 382 | 382 | { SVO_EXTENSION, &Application::importSVOFromURL }, |
| 383 | 383 | { SVO_JSON_EXTENSION, &Application::importSVOFromURL }, |
| 384 | 384 | { AVA_JSON_EXTENSION, &Application::askToWearAvatarAttachmentUrl }, |
| 385 | + { SERVERLESS_DOMAIN_EXTENSION, &Application::visitServerlessDomain }, | |
| 386 | + { SERVERLESS_DOMAIN_GZ_EXTENSION, &Application::visitServerlessDomain }, | |
| 385 | 387 | { JSON_EXTENSION, &Application::importJSONFromURL }, |
| 386 | 388 | { JS_EXTENSION, &Application::askToLoadScript }, |
| 387 | 389 | { FST_EXTENSION, &Application::askToSetAvatarUrl }, |
| 388 | 390 | { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent }, |
| 389 | 391 | { ZIP_EXTENSION, &Application::importFromZIP }, |
| 390 | − { SERVERLESS_DOMAIN_EXTENSION, &Application::visitServerlessDomain }, | |
| 391 | − { SERVERLESS_DOMAIN_GZ_EXTENSION, &Application::visitServerlessDomain }, | |
| 392 | 392 | { JPG_EXTENSION, &Application::importImage }, |
| 393 | 393 | { PNG_EXTENSION, &Application::importImage } |
| 394 | 394 | }; |
| @@ -1086,6 +1086,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 691 unmodified lines | ||
| 1086 | 1086 | connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle); |
| 1087 | 1087 | connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress); |
| 1088 | 1088 | |
| 1089 | + connect(addressManager.data(), &AddressManager::setServersEnabled, this, &Application::setServersEnabled); | |
| 1090 | + | |
| 1089 | 1091 | connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateThreadPoolCount); |
| 1090 | 1092 | connect(this, &Application::activeDisplayPluginChanged, this, [](){ |
| 1091 | 1093 | qApp->setProperty(hifi::properties::HMD, qApp->isHMDMode()); |
| @@ -2944,9 +2946,25 @@ bool Application::importFromZIP(const QString& filePath) { · 1852 unmodified lines | ||
| 2944 | 2946 | return true; |
| 2945 | 2947 | } |
| 2946 | 2948 | |
| 2949 | +void Application::setServersEnabled(bool serversEnabled) { | |
| 2950 | + qDebug() << "QQQQ serversEnabled =" << serversEnabled; | |
| 2951 | + if (_serversEnabled != serversEnabled) { | |
| 2952 | + _serversEnabled = serversEnabled; | |
| 2953 | + | |
| 2954 | + auto nodeList = DependencyManager::get<NodeList>(); | |
| 2955 | + nodeList->getDomainHandler().setAPIRefreshTimerEnabled(serversEnabled); | |
| 2956 | + | |
| 2957 | + if (!_serversEnabled) { | |
| 2958 | + nodeList->reset(); | |
| 2959 | + clearDomainOctreeDetails(); | |
| 2960 | + } | |
| 2961 | + } | |
| 2962 | +} | |
| 2963 | + | |
| 2947 | 2964 | bool Application::visitServerlessDomain(const QString& urlString) { |
| 2948 | 2965 | qDebug() << "QQQQ visit serverless domain" << urlString; |
| 2949 | − setServerlessMode(true); | |
| 2966 | + DependencyManager::get<AddressManager>()->handleLookupString(urlString); | |
| 2967 | + return true; | |
| 2950 | 2968 | } |
| 2951 | 2969 | |
| 2952 | 2970 | bool Application::importImage(const QString& urlString) { |
| @@ -5597,10 +5615,15 @@ void Application::updateWindowTitle() const { · 2644 unmodified lines | ||
| 5597 | 5615 | |
| 5598 | 5616 | QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)"; |
| 5599 | 5617 | QString username = accountManager->getAccountInfo().getUsername(); |
| 5600 | − QString currentPlaceName = DependencyManager::get<AddressManager>()->getHost(); | |
| 5601 | 5618 | |
| 5602 | − if (currentPlaceName.isEmpty()) { | |
| 5603 | − currentPlaceName = nodeList->getDomainHandler().getHostname(); | |
| 5619 | + QString currentPlaceName; | |
| 5620 | + if (isServerlessMode()) { | |
| 5621 | + currentPlaceName = "serverless"; // XXX filename? | |
| 5622 | + } else { | |
| 5623 | + currentPlaceName = DependencyManager::get<AddressManager>()->getHost(); | |
| 5624 | + if (currentPlaceName.isEmpty()) { | |
| 5625 | + currentPlaceName = nodeList->getDomainHandler().getHostname(); | |
| 5626 | + } | |
| 5604 | 5627 | } |
| 5605 | 5628 | |
| 5606 | 5629 | QString title = QString() + (!username.isEmpty() ? username + " @ " : QString()) |