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
339339 static const QString JPG_EXTENSION = ".jpg";
340340 static const QString PNG_EXTENSION = ".png";
341341 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";
342344 static const QString SVO_JSON_EXTENSION = ".svo.json";
343345 static const QString JSON_GZ_EXTENSION = ".json.gz";
344346 static const QString JSON_EXTENSION = ".json";
@@ -349,8 +351,6 @@ static const QString OBJ_EXTENSION = ".obj"; · 4 unmodified lines
349351 static const QString AVA_JSON_EXTENSION = ".ava.json";
350352 static const QString WEB_VIEW_TAG = "noDownload=true";
351353 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";
354354
355355 static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f;
356356
@@ -382,13 +382,13 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi · 25 unmodified lines
382382 { SVO_EXTENSION, &Application::importSVOFromURL },
383383 { SVO_JSON_EXTENSION, &Application::importSVOFromURL },
384384 { AVA_JSON_EXTENSION, &Application::askToWearAvatarAttachmentUrl },
385+ { SERVERLESS_DOMAIN_EXTENSION, &Application::visitServerlessDomain },
386+ { SERVERLESS_DOMAIN_GZ_EXTENSION, &Application::visitServerlessDomain },
385387 { JSON_EXTENSION, &Application::importJSONFromURL },
386388 { JS_EXTENSION, &Application::askToLoadScript },
387389 { FST_EXTENSION, &Application::askToSetAvatarUrl },
388390 { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent },
389391 { ZIP_EXTENSION, &Application::importFromZIP },
390− { SERVERLESS_DOMAIN_EXTENSION, &Application::visitServerlessDomain },
391− { SERVERLESS_DOMAIN_GZ_EXTENSION, &Application::visitServerlessDomain },
392392 { JPG_EXTENSION, &Application::importImage },
393393 { PNG_EXTENSION, &Application::importImage }
394394 };
@@ -1086,6 +1086,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 691 unmodified lines
10861086 connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
10871087 connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
10881088
1089+ connect(addressManager.data(), &AddressManager::setServersEnabled, this, &Application::setServersEnabled);
1090+
10891091 connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateThreadPoolCount);
10901092 connect(this, &Application::activeDisplayPluginChanged, this, [](){
10911093 qApp->setProperty(hifi::properties::HMD, qApp->isHMDMode());
@@ -2944,9 +2946,25 @@ bool Application::importFromZIP(const QString& filePath) { · 1852 unmodified lines
29442946 return true;
29452947 }
29462948
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+
29472964 bool Application::visitServerlessDomain(const QString& urlString) {
29482965 qDebug() << "QQQQ visit serverless domain" << urlString;
2949− setServerlessMode(true);
2966+ DependencyManager::get<AddressManager>()->handleLookupString(urlString);
2967+ return true;
29502968 }
29512969
29522970 bool Application::importImage(const QString& urlString) {
@@ -5597,10 +5615,15 @@ void Application::updateWindowTitle() const { · 2644 unmodified lines
55975615
55985616 QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)";
55995617 QString username = accountManager->getAccountInfo().getUsername();
5600− QString currentPlaceName = DependencyManager::get<AddressManager>()->getHost();
56015618
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+ }
56045627 }
56055628
56065629 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())