Files
Upsilon/apps/usb_timer.cpp
Émilie Feral a30bdf0d8d [escher] Redraw the window when a timer fires
Change-Id: Ib62ad7ec9641e6da61f8c3cbf00fbd470d46326c
2017-05-18 14:16:41 +02:00

31 lines
798 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);
}
#if LED_WHILE_CHARGING
KDColor LEDColor = Ion::Battery::isCharging() ? KDColorYellow : KDColorGreen;
Ion::LED::setColor(LEDColor);
#endif
m_previousPluggedState = true;
} else {
if (m_previousPluggedState) {
#if LED_WHILE_CHARGING
Ion::LED::setColor(KDColorBlack);
#endif
m_previousPluggedState = false;
}
}
}