[apps] Add LED switch on/off to usb timer

Change-Id: I6685ab5e21829eb9f2751819b635177a4955d403
This commit is contained in:
Émilie Feral
2017-04-11 17:01:55 +02:00
parent 9ad32a31fe
commit 26495d6c36
6 changed files with 33 additions and 29 deletions

24
apps/usb_timer.cpp Normal file
View File

@@ -0,0 +1,24 @@
#include "usb_timer.h"
#include "global_preferences.h"
#include "apps_container.h"
USBTimer::USBTimer(AppsContainer * container) :
Timer(2),
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() ? KDColorBlue : KDColorGreen;
Ion::LED::setColor(LEDColor);
m_previousPluggedState = true;
} else {
Ion::LED::setColor(KDColorBlack);
m_previousPluggedState = false;
}
}