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
69#include <EntityScriptClient.h>69#include <EntityScriptClient.h>
70#include <EntityScriptServerLogClient.h>70#include <EntityScriptServerLogClient.h>
71#include <EntityScriptingInterface.h>71#include <EntityScriptingInterface.h>
72#include <HoverOverlayInterface.h>
72#include <ErrorDialog.h>73#include <ErrorDialog.h>
73#include <FileScriptingInterface.h>74#include <FileScriptingInterface.h>
74#include <Finally.h>75#include <Finally.h>
@@ -590,6 +591,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 515 unmodified lines
590 DependencyManager::set<Snapshot>();591 DependencyManager::set<Snapshot>();
591 DependencyManager::set<CloseEventSender>();592 DependencyManager::set<CloseEventSender>();
592 DependencyManager::set<ResourceManager>();593 DependencyManager::set<ResourceManager>();
594 DependencyManager::set<HoverOverlayInterface>();
593 595
594 DependencyManager::set<LaserPointerScriptingInterface>();596 DependencyManager::set<LaserPointerScriptingInterface>();
595 DependencyManager::set<LaserPointerManager>();597 DependencyManager::set<LaserPointerManager>();
@@ -1473,6 +1475,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 877 unmodified lines
1473 properties["atp_mapping_requests"] = atpMappingRequests;1475 properties["atp_mapping_requests"] = atpMappingRequests;
1474 1476
1475 properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false;1477 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;
1476 1486
1477 auto myAvatar = getMyAvatar();1487 auto myAvatar = getMyAvatar();
1478 glm::vec3 avatarPosition = myAvatar->getPosition();1488 glm::vec3 avatarPosition = myAvatar->getPosition();
@@ -1711,9 +1721,7 @@ QString Application::getUserAgent() { · 232 unmodified lines
1711void Application::toggleTabletUI(bool shouldOpen) const {1721void Application::toggleTabletUI(bool shouldOpen) const {
1712 auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();1722 auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
1713 auto hmd = DependencyManager::get<HMDScriptingInterface>();1723 auto hmd = DependencyManager::get<HMDScriptingInterface>();
1714 TabletProxy* tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));1724 if (!(shouldOpen && hmd->getShouldShowTablet())) {
1715 bool messageOpen = tablet->isMessageDialogOpen();
1716 if ((!messageOpen || (messageOpen && !hmd->getShouldShowTablet())) && !(shouldOpen && hmd->getShouldShowTablet())) {
1717 auto HMD = DependencyManager::get<HMDScriptingInterface>();1725 auto HMD = DependencyManager::get<HMDScriptingInterface>();
1718 HMD->toggleShouldShowTablet();1726 HMD->toggleShouldShowTablet();
1719 }1727 }
@@ -2122,6 +2130,7 @@ void Application::initializeUi() { · 402 unmodified lines
2122 surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());2130 surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
2123 2131
2124 surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());2132 surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
2133 surfaceContext->setContextProperty("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
2125 2134
2126 if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {2135 if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
2127 surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));2136 surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
@@ -2762,6 +2771,16 @@ bool Application::event(QEvent* event) { · 634 unmodified lines
2762 static_cast<LambdaEvent*>(event)->call();2771 static_cast<LambdaEvent*>(event)->call();
2763 return true;2772 return true;
2764 2773
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
2765 case Event::Present:2784 case Event::Present:
2766 if (!_renderRequested) {2785 if (!_renderRequested) {
2767 float nsecsElapsed = (float)_lastTimeUpdated.nsecsElapsed();2786 float nsecsElapsed = (float)_lastTimeUpdated.nsecsElapsed();
@@ -5459,6 +5478,10 @@ void Application::updateWindowTitle() const { · 2691 unmodified lines
5459 qCDebug(interfaceapp, "Application title set to: %s", title.toStdString().c_str());5478 qCDebug(interfaceapp, "Application title set to: %s", title.toStdString().c_str());
5460#endif5479#endif
5461 _window->setWindowTitle(title);5480 _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", "");
5462}5485}
5463 5486
5464void Application::clearDomainOctreeDetails() {5487void Application::clearDomainOctreeDetails() {
@@ -5845,6 +5868,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 380 unmodified lines
5845 auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>();5868 auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>();
5846 scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data());5869 scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data());
5847 scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance());5870 scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance());
5871 scriptEngine->registerGlobalObject("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
5848 5872
5849 scriptEngine->registerGlobalObject("RayPick", DependencyManager::get<RayPickManager>().data());5873 scriptEngine->registerGlobalObject("RayPick", DependencyManager::get<RayPickManager>().data());
5850 5874
@@ -6618,11 +6642,11 @@ void Application::setPreviousScriptLocation(const QString& location) { · 767 unmodified lines
6618}6642}
6619 6643
6620void Application::loadScriptURLDialog() const {6644void 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");
6622 if (QUrl(newScript).scheme() == "atp") {6646 if (QUrl(newScript).scheme() == "atp") {
6623 OffscreenUi::warning("Error Loading Script", "Cannot load client script over ATP");6647 OffscreenUi::warning("Error Loading Script", "Cannot load client script over ATP");
6624 } else if (!newScript.isEmpty()) {6648 } else if (!newScript.isEmpty()) {
6625 DependencyManager::get<ScriptEngines>()->loadScript(newScript);6649 DependencyManager::get<ScriptEngines>()->loadScript(newScript.trimmed());
6626 }6650 }
6627}6651}
6628 6652