History

make domain-manager and pals be still when interface is in serverless mode

Seth Alves committed 8 years ago

Commit 17e2db91 parent 0f4b68c6 files · +99 −29Browse files

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

Unified · Split

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