Skip to content

Commit

Permalink
Fix default state of Session bools (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
psieg committed Sep 4, 2021
1 parent 9e0d7ed commit 92e2c5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
10 changes: 9 additions & 1 deletion Software/src/LightpackApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,11 @@ void LightpackApplication::onSessionChange(int change)
emit getLightpackApp()->settingsWnd()->switchOffLeds();
m_isLightsTurnedOffBySessionChange = true;
}
DEBUG_LOW_LEVEL << Q_FUNC_INFO << "Sleeping, isSessionLocked:" << m_isSessionLocked << "isLightsWereOnBeforeLock:" << m_isLightsWereOnBeforeLock << "isLightsTurnedOffBySessionChange : " << m_isLightsTurnedOffBySessionChange;
m_isSessionLocked = true;
break;
case SystemSession::Status::Unlocking:
DEBUG_LOW_LEVEL << Q_FUNC_INFO << "Unlocking, isSessionLocked:" << m_isSessionLocked << "isLightsWereOnBeforeLock:" << m_isLightsWereOnBeforeLock;
if (m_isSessionLocked && !SettingsScope::Settings::isKeepLightsOnAfterLock() && m_isLightsWereOnBeforeLock)
{
emit getLightpackApp()->settingsWnd()->switchOnLeds();
Expand All @@ -432,16 +434,22 @@ void LightpackApplication::onSessionChange(int change)
emit getLightpackApp()->settingsWnd()->switchOffLeds();
m_isLightsTurnedOffBySessionChange = true;
}

DEBUG_LOW_LEVEL << Q_FUNC_INFO << "Sleeping, isSuspending:" << m_isSuspending << "isLightsWereOnBeforeSuspend:" << m_isLightsWereOnBeforeSuspend << "isLightsTurnedOffBySessionChange : " << m_isLightsTurnedOffBySessionChange;
m_isSuspending = true;
break;
case SystemSession::Status::Resuming:
DEBUG_LOW_LEVEL << Q_FUNC_INFO << "Resuming, isSuspending:" << m_isSuspending << "isLightsWereOnBeforeSuspend:" << m_isLightsWereOnBeforeSuspend;

if (m_isSuspending && !SettingsScope::Settings::isKeepLightsOnAfterSuspend() && m_isLightsWereOnBeforeSuspend)
{
emit getLightpackApp()->settingsWnd()->switchOnLeds();
m_isLightsTurnedOffBySessionChange = false;
}
if (m_isSuspending)
QMetaObject::invokeMethod(m_ledDeviceManager, "updateDeviceSettings", Qt::QueuedConnection);

m_isSuspending = false;
QMetaObject::invokeMethod(m_ledDeviceManager, "updateDeviceSettings", Qt::QueuedConnection);
break;
case SystemSession::Status::DisplayOff:
if (!m_isDisplayOff)
Expand Down
14 changes: 7 additions & 7 deletions Software/src/LightpackApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ private slots:
typedef std::vector<QSharedPointer<QAbstractNativeEventFilter> > EventFilters;
EventFilters m_EventFilters;

bool m_isLightsTurnedOffBySessionChange;
bool m_isSessionLocked;
bool m_isDisplayOff;
bool m_isSuspending;
bool m_isLightsWereOnBeforeLock;
bool m_isLightsWereOnBeforeDisplaySleep;
bool m_isLightsWereOnBeforeSuspend;
bool m_isLightsTurnedOffBySessionChange = false;
bool m_isSessionLocked = false;
bool m_isDisplayOff = false;
bool m_isSuspending = false;
bool m_isLightsWereOnBeforeLock = false;
bool m_isLightsWereOnBeforeDisplaySleep = false;
bool m_isLightsWereOnBeforeSuspend = false;
};

0 comments on commit 92e2c5a

Please sign in to comment.