Put proper comments and indentation.

This commit is contained in:
volansystech 2017-05-25 18:32:46 +05:30
parent 8d51be644d
commit a2851b5bcb
4 changed files with 22 additions and 23 deletions

View file

@ -1339,14 +1339,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
properties["using_hmd"] = isHMDMode();
if (isOculusRiftPluginAvailable()) {
// If Oculus Rift Plugin is Available,And Current Display Plugin is not Oculus Rift
// If Oculus Rift Plugin is available and current display plugin is not Oculus Rift
// then startOculusRiftStandBySession to listen Oculus HMD Mounted status.
if (getActiveDisplayPlugin()->getName() != "Oculus Rift" &&
!oculusRiftPlugin->isFakeSessionActive()) {
!oculusRiftPlugin->isStandBySessionActive()) {
startOculusRiftStandBySession();
}
// Poll periodically to check whether the user has worn Oculus HMD or not. And switch mode
// accordingly. If the user wear HMD, switch to VR mode, if remove switch to Desktop mode.
// Poll periodically to check whether the user has worn Oculus HMD or not. And switch Display mode accordingly.
// If the user wear Oculus HMD then switch to VR mode. If the user removes Oculus HMD then switch to Desktop mode.
QTimer *switchDisplayModeTimer = new QTimer(this);
connect(switchDisplayModeTimer, SIGNAL(timeout()), this, SLOT(switchDisplayModeForOculus()));
switchDisplayModeTimer->start(500);
@ -1581,7 +1581,7 @@ void Application::aboutToQuit() {
}
getActiveDisplayPlugin()->deactivate();
if (oculusRiftPlugin && oculusRiftPlugin->isFakeSessionActive()){
if (oculusRiftPlugin && oculusRiftPlugin->isStandBySessionActive()) {
oculusRiftPlugin->endStandBySession();
}
// Hide Running Scripts dialog so that it gets destroyed in an orderly manner; prevents warnings at shutdown.
@ -6853,7 +6853,7 @@ bool Application::isOculusRiftPluginAvailable(){
DisplayPluginPointer defaultplugin = displayPlugins.at(0);
if (defaultplugin->isHmd() && defaultplugin->getName() == "Oculus Rift") {
oculusRiftPlugin = defaultplugin;
return true; // No need to iterate again,so return
return true;
}
// Iterate to check If Oculus Rift Plugin is available
foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {

View file

@ -685,9 +685,8 @@ private:
DisplayPluginPointer oculusRiftPlugin;
bool isOculusRiftPluginAvailable();
bool _oculusHMDMountedStatus; // Keep track of HMD Mounted Flag
bool _oculusHMDMountedStatus; // Keep track of Oculus Rift HMDMounted Flag
bool startOculusRiftStandBySession();
void endOculusRiftStandBySession();
};

View file

@ -54,16 +54,16 @@ public:
return _active;
}
virtual bool startStandBySession() {
_standbysessionactive = true;
return _standbysessionactive;
_standbysessionstatus = true;
return _standbysessionstatus;
}
virtual void endStandBySession() {
_standbysessionactive = false;
_standbysessionstatus = false;
}
virtual bool isFakeSessionActive() {
return _standbysessionactive;
virtual bool isStandBySessionActive() {
return _standbysessionstatus;
}
/**
@ -85,7 +85,7 @@ signals:
protected:
bool _active { false };
bool _standbysessionactive { false };
bool _standbysessionstatus { false };
PluginContainer* _container { nullptr };
static const char* UNKNOWN_PLUGIN_ID;