Files
Upsilon/apps/usb_timer.cpp
Émilie Feral beeed6ab2b [ion] No led when charging in sleep mode
Change-Id: I8cdea4d435226fbc877e398909926c83642e0e55
2017-05-05 10:19:05 +02:00

29 lines
774 B
C++

#include "usb_timer.h"
#include "global_preferences.h"
#include "apps_container.h"
USBTimer::USBTimer(AppsContainer * container) :
Timer(1),
m_container(container),
m_previousPluggedState(false)
{
}
void USBTimer::fire() {
if (Ion::USB::isPlugged()) {
if (!m_previousPluggedState && GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
m_container->displayExamModePopUp(false, true);
}
#if LED_WHILE_CHARGING
KDColor LEDColor = Ion::Battery::isCharging() ? KDColorYellow : KDColorGreen;
Ion::LED::setColor(LEDColor);
m_previousPluggedState = true;
} else {
if (m_previousPluggedState) {
Ion::LED::setColor(KDColorBlack);
m_previousPluggedState = false;
}
#endif
}
}