History

Merge branch 'master' into sharks

Sam Gondelman committed 9 years ago

Commit fcaa39b2 parents 5e4a83d 2e7f62c141 files · +8824 −992Browse files

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

Unified · Split

interface/src/Application.cpp+29−5
@@ -69,6 +69,7 @@ · 68 unmodified lines
6969 #include <EntityScriptClient.h>
7070 #include <EntityScriptServerLogClient.h>
7171 #include <EntityScriptingInterface.h>
72+#include <HoverOverlayInterface.h>
7273 #include <ErrorDialog.h>
7374 #include <FileScriptingInterface.h>
7475 #include <Finally.h>
@@ -590,6 +591,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 515 unmodified lines
590591 DependencyManager::set<Snapshot>();
591592 DependencyManager::set<CloseEventSender>();
592593 DependencyManager::set<ResourceManager>();
594+ DependencyManager::set<HoverOverlayInterface>();
593595
594596 DependencyManager::set<LaserPointerScriptingInterface>();
595597 DependencyManager::set<LaserPointerManager>();
@@ -1473,6 +1475,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 877 unmodified lines
14731475 properties["atp_mapping_requests"] = atpMappingRequests;
14741476
14751477 properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false;
1478+
1479+ QJsonObject bytesDownloaded;
1480+ bytesDownloaded["atp"] = statTracker->getStat(STAT_ATP_RESOURCE_TOTAL_BYTES).toInt();
1481+ bytesDownloaded["http"] = statTracker->getStat(STAT_HTTP_RESOURCE_TOTAL_BYTES).toInt();
1482+ bytesDownloaded["file"] = statTracker->getStat(STAT_FILE_RESOURCE_TOTAL_BYTES).toInt();
1483+ bytesDownloaded["total"] = bytesDownloaded["atp"].toInt() + bytesDownloaded["http"].toInt()
1484+ + bytesDownloaded["file"].toInt();
1485+ properties["bytesDownloaded"] = bytesDownloaded;
14761486
14771487 auto myAvatar = getMyAvatar();
14781488 glm::vec3 avatarPosition = myAvatar->getPosition();
@@ -1711,9 +1721,7 @@ QString Application::getUserAgent() { · 232 unmodified lines
17111721 void Application::toggleTabletUI(bool shouldOpen) const {
17121722 auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
17131723 auto hmd = DependencyManager::get<HMDScriptingInterface>();
1714− TabletProxy* tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));
1715− bool messageOpen = tablet->isMessageDialogOpen();
1716− if ((!messageOpen || (messageOpen && !hmd->getShouldShowTablet())) && !(shouldOpen && hmd->getShouldShowTablet())) {
1724+ if (!(shouldOpen && hmd->getShouldShowTablet())) {
17171725 auto HMD = DependencyManager::get<HMDScriptingInterface>();
17181726 HMD->toggleShouldShowTablet();
17191727 }
@@ -2122,6 +2130,7 @@ void Application::initializeUi() { · 402 unmodified lines
21222130 surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
21232131
21242132 surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
2133+ surfaceContext->setContextProperty("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
21252134
21262135 if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
21272136 surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
@@ -2762,6 +2771,16 @@ bool Application::event(QEvent* event) { · 634 unmodified lines
27622771 static_cast<LambdaEvent*>(event)->call();
27632772 return true;
27642773
2774+ // Explicit idle keeps the idle running at a lower interval, but without any rendering
2775+ // see (windowMinimizedChanged)
2776+ case Event::Idle:
2777+ {
2778+ float nsecsElapsed = (float)_lastTimeUpdated.nsecsElapsed();
2779+ _lastTimeUpdated.start();
2780+ idle(nsecsElapsed);
2781+ }
2782+ return true;
2783+
27652784 case Event::Present:
27662785 if (!_renderRequested) {
27672786 float nsecsElapsed = (float)_lastTimeUpdated.nsecsElapsed();
@@ -5459,6 +5478,10 @@ void Application::updateWindowTitle() const { · 2691 unmodified lines
54595478 qCDebug(interfaceapp, "Application title set to: %s", title.toStdString().c_str());
54605479 #endif
54615480 _window->setWindowTitle(title);
5481+
5482+ // updateTitleWindow gets called whenever there's a change regarding the domain, so rather
5483+ // than placing this within domainChanged, it's placed here to cover the other potential cases.
5484+ DependencyManager::get< MessagesClient >()->sendLocalMessage("Toolbar-DomainChanged", "");
54625485 }
54635486
54645487 void Application::clearDomainOctreeDetails() {
@@ -5845,6 +5868,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 380 unmodified lines
58455868 auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>();
58465869 scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data());
58475870 scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance());
5871+ scriptEngine->registerGlobalObject("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
58485872
58495873 scriptEngine->registerGlobalObject("RayPick", DependencyManager::get<RayPickManager>().data());
58505874
@@ -6618,11 +6642,11 @@ void Application::setPreviousScriptLocation(const QString& location) { · 767 unmodified lines
66186642 }
66196643
66206644 void Application::loadScriptURLDialog() const {
6621− auto newScript = OffscreenUi::getText(OffscreenUi::ICON_NONE, "Open and Run Script", "Script URL");
6645+ QString newScript = OffscreenUi::getText(OffscreenUi::ICON_NONE, "Open and Run Script", "Script URL");
66226646 if (QUrl(newScript).scheme() == "atp") {
66236647 OffscreenUi::warning("Error Loading Script", "Cannot load client script over ATP");
66246648 } else if (!newScript.isEmpty()) {
6625− DependencyManager::get<ScriptEngines>()->loadScript(newScript);
6649+ DependencyManager::get<ScriptEngines>()->loadScript(newScript.trimmed());
66266650 }
66276651 }
66286652