History

handle startup overlay visibility correctly

Brad Hefta-Gaub committed 10 years ago

Commit 366aa391 parent 526f9dc7 files · +24 −14Browse files

Unified · Split

7 files
  1. interface/src/Application.cpp +15 −1
  2. interface/src/Application.h +1 −0
  3. interface/src/Menu.cpp +1 −1
  4. interface/src/ui/ApplicationCompositor.h +1 −1
  5. interface/src/ui/ApplicationOverlay.cpp +0 −4
  6. interface/src/ui/OverlayConductor.cpp +4 −5
  7. interface/src/ui/OverlayConductor.h +2 −2
interface/src/Application.cpp+15−1
@@ -1200,7 +1200,6 @@ void Application::initializeUi() { · 1199 unmodified lines
1200 // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to1200 // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
1201 // support the window management and scripting proxies for VR use1201 // support the window management and scripting proxies for VR use
1202 offscreenUi->createDesktop(QString("hifi/Desktop.qml"));1202 offscreenUi->createDesktop(QString("hifi/Desktop.qml"));
1203 connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
1204 1203
1205 // FIXME either expose so that dialogs can set this themselves or1204 // FIXME either expose so that dialogs can set this themselves or
1206 // do better detection in the offscreen UI of what has focus1205 // do better detection in the offscreen UI of what has focus
@@ -2435,6 +2434,17 @@ void Application::idle(uint64_t now) { · 1228 unmodified lines
2435 if (_aboutToQuit) {2434 if (_aboutToQuit) {
2436 return; // bail early, nothing to do here.2435 return; // bail early, nothing to do here.
2437 }2436 }
2437
2438 Stats::getInstance()->updateStats();
2439 AvatarInputs::getInstance()->update();
2440
2441 static bool firstIdle = true;
2442 if (firstIdle) {
2443 firstIdle = false;
2444 auto offscreenUi = DependencyManager::get<OffscreenUi>();
2445 connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
2446 }
2447
2438 2448
2439 auto displayPlugin = getActiveDisplayPlugin();2449 auto displayPlugin = getActiveDisplayPlugin();
2440 // depending on whether we're throttling or not.2450 // depending on whether we're throttling or not.
@@ -2998,6 +3008,10 @@ void Application::toggleOverlays() { · 557 unmodified lines
2998 _overlayConductor.setEnabled(overlaysVisible);3008 _overlayConductor.setEnabled(overlaysVisible);
2999}3009}
3000 3010
3011void Application::setOverlaysVisible(bool visible) {
3012 _overlayConductor.setEnabled(visible);
3013}
3014
3001void Application::cycleCamera() {3015void Application::cycleCamera() {
3002 auto menu = Menu::getInstance();3016 auto menu = Menu::getInstance();
3003 if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {3017 if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {
interface/src/Application.h+1−0
@@ -272,6 +272,7 @@ public slots: · 271 unmodified lines
272 void cycleCamera();272 void cycleCamera();
273 void cameraMenuChanged();273 void cameraMenuChanged();
274 void toggleOverlays();274 void toggleOverlays();
275 void setOverlaysVisible(bool visible);
275 276
276 void reloadResourceCaches();277 void reloadResourceCaches();
277 278
interface/src/Menu.cpp+1−1
@@ -257,7 +257,7 @@ Menu::Menu() { · 256 unmodified lines
257 257
258 // View > Overlays258 // View > Overlays
259 addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Overlays, 0, true,259 addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Overlays, 0, true,
260 qApp, SLOT(toggleOverlays()));260 qApp, SLOT(setOverlaysVisible(bool)));
261 261
262 // Navigate menu ----------------------------------262 // Navigate menu ----------------------------------
263 MenuWrapper* navigateMenu = addMenu("Navigate");263 MenuWrapper* navigateMenu = addMenu("Navigate");
interface/src/ui/ApplicationCompositor.h+1−1
@@ -131,7 +131,7 @@ private: · 130 unmodified lines
131 float _textureAspectRatio { 1.0f };131 float _textureAspectRatio { 1.0f };
132 int _hemiVerticesID { GeometryCache::UNKNOWN_ID };132 int _hemiVerticesID { GeometryCache::UNKNOWN_ID };
133 133
134 float _alpha { 1.0f };134 float _alpha { 0.0f }; // hidden by default
135 float _prevAlpha { 1.0f };135 float _prevAlpha { 1.0f };
136 float _fadeInAlpha { true };136 float _fadeInAlpha { true };
137 float _oculusUIRadius { 1.0f };137 float _oculusUIRadius { 1.0f };
interface/src/ui/ApplicationOverlay.cpp+0−4
@@ -58,10 +58,6 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) { · 57 unmodified lines
58 CHECK_GL_ERROR();58 CHECK_GL_ERROR();
59 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");59 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
60 60
61 // TODO move to Application::idle()?
62 Stats::getInstance()->updateStats();
63 AvatarInputs::getInstance()->update();
64
65 buildFramebufferObject();61 buildFramebufferObject();
66 62
67 if (!_overlayFramebuffer) {63 if (!_overlayFramebuffer) {
interface/src/ui/OverlayConductor.cpp+4−5
@@ -110,9 +110,12 @@ void OverlayConductor::setEnabled(bool enabled) { · 109 unmodified lines
110 return;110 return;
111 }111 }
112 112
113 qDebug() << "OverlayConductor::setEnabled() enabled:" << enabled;
113 Menu::getInstance()->setIsOptionChecked(MenuOption::Overlays, enabled);114 Menu::getInstance()->setIsOptionChecked(MenuOption::Overlays, enabled);
114 115
115 if (_enabled) {116 _enabled = enabled; // set the new value
117
118 if (!_enabled) {
116 // alpha fadeOut the overlay mesh.119 // alpha fadeOut the overlay mesh.
117 qApp->getApplicationCompositor().fadeOut();120 qApp->getApplicationCompositor().fadeOut();
118 121
@@ -122,8 +125,6 @@ void OverlayConductor::setEnabled(bool enabled) { · 3 unmodified lines
122 // disable QML events125 // disable QML events
123 auto offscreenUi = DependencyManager::get<OffscreenUi>();126 auto offscreenUi = DependencyManager::get<OffscreenUi>();
124 offscreenUi->getRootItem()->setEnabled(false);127 offscreenUi->getRootItem()->setEnabled(false);
125
126 _enabled = false;
127 } else {128 } else {
128 // alpha fadeIn the overlay mesh.129 // alpha fadeIn the overlay mesh.
129 qApp->getApplicationCompositor().fadeIn();130 qApp->getApplicationCompositor().fadeIn();
@@ -144,8 +145,6 @@ void OverlayConductor::setEnabled(bool enabled) { · 14 unmodified lines
144 t.setRotation(glm::quat_cast(camMat));145 t.setRotation(glm::quat_cast(camMat));
145 qApp->getApplicationCompositor().setModelTransform(t);146 qApp->getApplicationCompositor().setModelTransform(t);
146 }147 }
147
148 _enabled = true;
149 }148 }
150}149}
151 150
interface/src/ui/OverlayConductor.h+2−2
@@ -29,8 +29,8 @@ private: · 28 unmodified lines
29 STANDING29 STANDING
30 };30 };
31 31
32 Mode _mode = FLAT;32 Mode _mode { FLAT };
33 bool _enabled = true;33 bool _enabled { false };
34};34};
35 35
36#endif36#endif