Resolve the reviewed comments of @ZappoMan

This commit is contained in:
NeetBhagat 2017-06-02 14:37:17 +05:30
parent e08c3453a4
commit 6228ff19bf
3 changed files with 15 additions and 16 deletions

View file

@ -1349,16 +1349,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_autoSwitchDisplayModeSupportedHMDPlugin->getName(); _autoSwitchDisplayModeSupportedHMDPlugin->getName();
_previousHMDWornStatus = _previousHMDWornStatus =
_autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible(); _autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible();
qCDebug(interfaceapp) << "_autoSwitchModeSupportedPluginName::"
<< _autoSwitchDisplayModeSupportedHMDPluginName;
break; break;
} }
} }
if (_autoSwitchDisplayModeSupportedHMDPlugin != nullptr) { if (_autoSwitchDisplayModeSupportedHMDPlugin) {
// If HMD Plugin is available and current display plugin is not HMD plugin if (getActiveDisplayPlugin() != _autoSwitchDisplayModeSupportedHMDPlugin &&
// then startHMDStandBySession to poll HMD Worn status.
if (getActiveDisplayPlugin()->getName() != _autoSwitchDisplayModeSupportedHMDPluginName &&
!_autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) { !_autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) {
startHMDStandBySession(); startHMDStandBySession();
} }
@ -1600,7 +1596,7 @@ void Application::aboutToQuit() {
} }
getActiveDisplayPlugin()->deactivate(); getActiveDisplayPlugin()->deactivate();
if (_autoSwitchDisplayModeSupportedHMDPlugin != nullptr if (_autoSwitchDisplayModeSupportedHMDPlugin
&& _autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) { && _autoSwitchDisplayModeSupportedHMDPlugin->isStandBySessionActive()) {
_autoSwitchDisplayModeSupportedHMDPlugin->endStandBySession(); _autoSwitchDisplayModeSupportedHMDPlugin->endStandBySession();
} }
@ -6769,18 +6765,20 @@ void Application::updateDisplayMode() {
} }
void Application::switchDisplayMode() { void Application::switchDisplayMode() {
if (!_autoSwitchDisplayModeSupportedHMDPlugin) {
return;
}
bool currentHMDWornStatus = _autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible(); bool currentHMDWornStatus = _autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible();
if (currentHMDWornStatus != _previousHMDWornStatus) { if (currentHMDWornStatus != _previousHMDWornStatus) {
// Switch to respective mode as soon as currentHMDWornStatus changes // Switch to respective mode as soon as currentHMDWornStatus changes
if (currentHMDWornStatus == false && _previousHMDWornStatus == true) { if (currentHMDWornStatus) {
qCDebug(interfaceapp) << "Switching from HMD to desktop mode";
setActiveDisplayPlugin(DESKTOP_DISPLAY_PLUGIN_NAME);
startHMDStandBySession();
}
if (currentHMDWornStatus == true && _previousHMDWornStatus == false) {
qCDebug(interfaceapp) << "Switching from Desktop to HMD mode"; qCDebug(interfaceapp) << "Switching from Desktop to HMD mode";
endHMDStandBySession(); endHMDStandBySession();
setActiveDisplayPlugin(_autoSwitchDisplayModeSupportedHMDPluginName); setActiveDisplayPlugin(_autoSwitchDisplayModeSupportedHMDPluginName);
} else {
qCDebug(interfaceapp) << "Switching from HMD to desktop mode";
setActiveDisplayPlugin(DESKTOP_DISPLAY_PLUGIN_NAME);
startHMDStandBySession();
} }
} }
_previousHMDWornStatus = currentHMDWornStatus; _previousHMDWornStatus = currentHMDWornStatus;

View file

@ -681,7 +681,7 @@ private:
AudioInjector* _snapshotSoundInjector { nullptr }; AudioInjector* _snapshotSoundInjector { nullptr };
SharedSoundPointer _snapshotSound; SharedSoundPointer _snapshotSound;
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin = nullptr; DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
QString _autoSwitchDisplayModeSupportedHMDPluginName; QString _autoSwitchDisplayModeSupportedHMDPluginName;
bool _previousHMDWornStatus; bool _previousHMDWornStatus;
void startHMDStandBySession(); void startHMDStandBySession();

View file

@ -315,6 +315,7 @@ bool OpenGLDisplayPlugin::activate() {
if (isHmd() && (getHmdScreen() >= 0)) { if (isHmd() && (getHmdScreen() >= 0)) {
_container->showDisplayPluginsTools(); _container->showDisplayPluginsTools();
} }
return Parent::activate(); return Parent::activate();
} }
@ -347,7 +348,7 @@ bool OpenGLDisplayPlugin::startStandBySession() {
void OpenGLDisplayPlugin::endStandBySession() { void OpenGLDisplayPlugin::endStandBySession() {
deactivateStandBySession(); deactivateStandBySession();
return Parent::endStandBySession(); Parent::endStandBySession();
} }
void OpenGLDisplayPlugin::customizeContext() { void OpenGLDisplayPlugin::customizeContext() {