Files
Upsilon/apps/usb_timer.cpp
Émilie Feral e82e9a9571 [ion][kandinsky] Change LED color in sleep mode to yellow (does no
require a timer)

Change-Id: I3ffcf5d050fd94f8b06662646577a3a391e78190
2017-04-13 12:06:37 +02:00

25 lines
700 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);
}
KDColor LEDColor = Ion::Battery::isCharging() ? KDColorYellow : KDColorGreen;
Ion::LED::setColor(LEDColor);
m_previousPluggedState = true;
} else {
Ion::LED::setColor(KDColorBlack);
m_previousPluggedState = false;
}
}