Context Overlays
Showing the changes to interface/src/Application.cpp (1 of 32 files). Show all
Unified · Split
| @@ -70,7 +70,7 @@ · 69 unmodified lines | ||
| 70 | 70 | #include <EntityScriptClient.h> |
| 71 | 71 | #include <EntityScriptServerLogClient.h> |
| 72 | 72 | #include <EntityScriptingInterface.h> |
| 73 | −#include <HoverOverlayInterface.h> | |
| 73 | +#include "ui/overlays/ContextOverlayInterface.h" | |
| 74 | 74 | #include <ErrorDialog.h> |
| 75 | 75 | #include <FileScriptingInterface.h> |
| 76 | 76 | #include <Finally.h> |
| @@ -595,7 +595,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 518 unmodified lines | ||
| 595 | 595 | DependencyManager::set<Snapshot>(); |
| 596 | 596 | DependencyManager::set<CloseEventSender>(); |
| 597 | 597 | DependencyManager::set<ResourceManager>(); |
| 598 | − DependencyManager::set<HoverOverlayInterface>(); | |
| 598 | + DependencyManager::set<ContextOverlayInterface>(); | |
| 599 | 599 | |
| 600 | 600 | return previousSessionCrashed; |
| 601 | 601 | } |
| @@ -1324,12 +1324,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 722 unmodified lines | ||
| 1324 | 1324 | // Keyboard focus handling for Web overlays. |
| 1325 | 1325 | auto overlays = &(qApp->getOverlays()); |
| 1326 | 1326 | |
| 1327 | − connect(overlays, &Overlays::mousePressOnOverlay, [=](OverlayID overlayID, const PointerEvent& event) { | |
| 1328 | − setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); | |
| 1329 | − setKeyboardFocusOverlay(overlayID); | |
| 1327 | + connect(overlays, &Overlays::mousePressOnOverlay, [=](const OverlayID& overlayID, const PointerEvent& event) { | |
| 1328 | + auto thisOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays->getOverlay(overlayID)); | |
| 1329 | + // Only Web overlays can have keyboard focus. | |
| 1330 | + if (thisOverlay) { | |
| 1331 | + setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); | |
| 1332 | + setKeyboardFocusOverlay(overlayID); | |
| 1333 | + } | |
| 1330 | 1334 | }); |
| 1331 | 1335 | |
| 1332 | − connect(overlays, &Overlays::overlayDeleted, [=](OverlayID overlayID) { | |
| 1336 | + connect(overlays, &Overlays::overlayDeleted, [=](const OverlayID& overlayID) { | |
| 1333 | 1337 | if (overlayID == _keyboardFocusedOverlay.get()) { |
| 1334 | 1338 | setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); |
| 1335 | 1339 | } |
| @@ -1344,6 +1348,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 8 unmodified lines | ||
| 1344 | 1348 | setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); |
| 1345 | 1349 | }); |
| 1346 | 1350 | |
| 1351 | + connect(overlays, | |
| 1352 | + SIGNAL(mousePressOnOverlay(const OverlayID&, const PointerEvent&)), | |
| 1353 | + DependencyManager::get<ContextOverlayInterface>().data(), | |
| 1354 | + SLOT(contextOverlays_mousePressOnOverlay(const OverlayID&, const PointerEvent&))); | |
| 1355 | + | |
| 1356 | + connect(overlays, | |
| 1357 | + SIGNAL(hoverEnterOverlay(const OverlayID&, const PointerEvent&)), | |
| 1358 | + DependencyManager::get<ContextOverlayInterface>().data(), | |
| 1359 | + SLOT(contextOverlays_hoverEnterOverlay(const OverlayID&, const PointerEvent&))); | |
| 1360 | + | |
| 1361 | + connect(overlays, | |
| 1362 | + SIGNAL(hoverLeaveOverlay(const OverlayID&, const PointerEvent&)), | |
| 1363 | + DependencyManager::get<ContextOverlayInterface>().data(), | |
| 1364 | + SLOT(contextOverlays_hoverLeaveOverlay(const OverlayID&, const PointerEvent&))); | |
| 1365 | + | |
| 1347 | 1366 | // Add periodic checks to send user activity data |
| 1348 | 1367 | static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000; |
| 1349 | 1368 | static int NEARBY_AVATAR_RADIUS_METERS = 10; |
| @@ -1470,7 +1489,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 120 unmodified lines | ||
| 1470 | 1489 | properties["atp_mapping_requests"] = atpMappingRequests; |
| 1471 | 1490 | |
| 1472 | 1491 | properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false; |
| 1473 | − | |
| 1492 | + | |
| 1474 | 1493 | QJsonObject bytesDownloaded; |
| 1475 | 1494 | bytesDownloaded["atp"] = statTracker->getStat(STAT_ATP_RESOURCE_TOTAL_BYTES).toInt(); |
| 1476 | 1495 | bytesDownloaded["http"] = statTracker->getStat(STAT_HTTP_RESOURCE_TOTAL_BYTES).toInt(); |
| @@ -2131,7 +2150,7 @@ void Application::initializeUi() { · 654 unmodified lines | ||
| 2131 | 2150 | surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor()); |
| 2132 | 2151 | |
| 2133 | 2152 | surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); |
| 2134 | − surfaceContext->setContextProperty("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data()); | |
| 2153 | + surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data()); | |
| 2135 | 2154 | |
| 2136 | 2155 | if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) { |
| 2137 | 2156 | surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get())); |
| @@ -5397,6 +5416,17 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 3259 unmodified lines | ||
| 5397 | 5416 | } |
| 5398 | 5417 | renderArgs->_debugFlags = renderDebugFlags; |
| 5399 | 5418 | //ViveControllerManager::getInstance().updateRendering(renderArgs, _main3DScene, transaction); |
| 5419 | + | |
| 5420 | + RenderArgs::OutlineFlags renderOutlineFlags = RenderArgs::RENDER_OUTLINE_NONE; | |
| 5421 | + auto contextOverlayInterface = DependencyManager::get<ContextOverlayInterface>(); | |
| 5422 | + if (contextOverlayInterface->getEnabled()) { | |
| 5423 | + if (DependencyManager::get<ContextOverlayInterface>()->getIsInMarketplaceInspectionMode()) { | |
| 5424 | + renderOutlineFlags = RenderArgs::RENDER_OUTLINE_MARKETPLACE_MODE; | |
| 5425 | + } else { | |
| 5426 | + renderOutlineFlags = RenderArgs::RENDER_OUTLINE_WIREFRAMES; | |
| 5427 | + } | |
| 5428 | + } | |
| 5429 | + renderArgs->_outlineFlags = renderOutlineFlags; | |
| 5400 | 5430 | } |
| 5401 | 5431 | } |
| 5402 | 5432 | |
| @@ -5860,7 +5890,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 457 unmodified lines | ||
| 5860 | 5890 | auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>(); |
| 5861 | 5891 | scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data()); |
| 5862 | 5892 | scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance()); |
| 5863 | − scriptEngine->registerGlobalObject("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data()); | |
| 5893 | + scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data()); | |
| 5864 | 5894 | |
| 5865 | 5895 | qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue); |
| 5866 | 5896 | |