Files
Upsilon/apps/usb_timer.cpp
Émilie Feral f3cefe8359 [apps] Change battery icon iniation and update quicker
Change-Id: I528519deb0d768de48660d1f0ddfed3b570e74f4
2017-04-12 09:37:49 +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() ? KDColorOrange : KDColorGreen;
Ion::LED::setColor(LEDColor);
m_previousPluggedState = true;
} else {
Ion::LED::setColor(KDColorBlack);
m_previousPluggedState = false;
}
}