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
12001200 // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
12011201 // support the window management and scripting proxies for VR use
12021202 offscreenUi->createDesktop(QString("hifi/Desktop.qml"));
1203− connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
12041203
12051204 // FIXME either expose so that dialogs can set this themselves or
12061205 // do better detection in the offscreen UI of what has focus
@@ -2435,6 +2434,17 @@ void Application::idle(uint64_t now) { · 1228 unmodified lines
24352434 if (_aboutToQuit) {
24362435 return; // bail early, nothing to do here.
24372436 }
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+
24382448
24392449 auto displayPlugin = getActiveDisplayPlugin();
24402450 // depending on whether we're throttling or not.
@@ -2998,6 +3008,10 @@ void Application::toggleOverlays() { · 557 unmodified lines
29983008 _overlayConductor.setEnabled(overlaysVisible);
29993009 }
30003010
3011+void Application::setOverlaysVisible(bool visible) {
3012+ _overlayConductor.setEnabled(visible);
3013+}
3014+
30013015 void Application::cycleCamera() {
30023016 auto menu = Menu::getInstance();
30033017 if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {
interface/src/Application.h+1−0
@@ -272,6 +272,7 @@ public slots: · 271 unmodified lines
272272 void cycleCamera();
273273 void cameraMenuChanged();
274274 void toggleOverlays();
275+ void setOverlaysVisible(bool visible);
275276
276277 void reloadResourceCaches();
277278
interface/src/Menu.cpp+1−1
@@ -257,7 +257,7 @@ Menu::Menu() { · 256 unmodified lines
257257
258258 // View > Overlays
259259 addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Overlays, 0, true,
260− qApp, SLOT(toggleOverlays()));
260+ qApp, SLOT(setOverlaysVisible(bool)));
261261
262262 // Navigate menu ----------------------------------
263263 MenuWrapper* navigateMenu = addMenu("Navigate");
interface/src/ui/ApplicationCompositor.h+1−1
@@ -131,7 +131,7 @@ private: · 130 unmodified lines
131131 float _textureAspectRatio { 1.0f };
132132 int _hemiVerticesID { GeometryCache::UNKNOWN_ID };
133133
134− float _alpha { 1.0f };
134+ float _alpha { 0.0f }; // hidden by default
135135 float _prevAlpha { 1.0f };
136136 float _fadeInAlpha { true };
137137 float _oculusUIRadius { 1.0f };
interface/src/ui/ApplicationOverlay.cpp+0−4
@@ -58,10 +58,6 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) { · 57 unmodified lines
5858 CHECK_GL_ERROR();
5959 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
6060
61− // TODO move to Application::idle()?
62− Stats::getInstance()->updateStats();
63− AvatarInputs::getInstance()->update();
64−
6561 buildFramebufferObject();
6662
6763 if (!_overlayFramebuffer) {
interface/src/ui/OverlayConductor.cpp+4−5
@@ -110,9 +110,12 @@ void OverlayConductor::setEnabled(bool enabled) { · 109 unmodified lines
110110 return;
111111 }
112112
113+ qDebug() << "OverlayConductor::setEnabled() enabled:" << enabled;
113114 Menu::getInstance()->setIsOptionChecked(MenuOption::Overlays, enabled);
114115
115− if (_enabled) {
116+ _enabled = enabled; // set the new value
117+
118+ if (!_enabled) {
116119 // alpha fadeOut the overlay mesh.
117120 qApp->getApplicationCompositor().fadeOut();
118121
@@ -122,8 +125,6 @@ void OverlayConductor::setEnabled(bool enabled) { · 3 unmodified lines
122125 // disable QML events
123126 auto offscreenUi = DependencyManager::get<OffscreenUi>();
124127 offscreenUi->getRootItem()->setEnabled(false);
125−
126− _enabled = false;
127128 } else {
128129 // alpha fadeIn the overlay mesh.
129130 qApp->getApplicationCompositor().fadeIn();
@@ -144,8 +145,6 @@ void OverlayConductor::setEnabled(bool enabled) { · 14 unmodified lines
144145 t.setRotation(glm::quat_cast(camMat));
145146 qApp->getApplicationCompositor().setModelTransform(t);
146147 }
147−
148− _enabled = true;
149148 }
150149 }
151150
interface/src/ui/OverlayConductor.h+2−2
@@ -29,8 +29,8 @@ private: · 28 unmodified lines
2929 STANDING
3030 };
3131
32− Mode _mode = FLAT;
33− bool _enabled = true;
32+ Mode _mode { FLAT };
33+ bool _enabled { false };
3434 };
3535
3636 #endif