Files
Upsilon/apps/usb_timer.cpp
Émilie Feral 061a9724bd [kandinsky] Add color Orange
Change-Id: I7d471977d8308f09366de26a426381b5e81497af
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(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() ? KDColorOrange : KDColorGreen;
Ion::LED::setColor(LEDColor);
m_previousPluggedState = true;
} else {
Ion::LED::setColor(KDColorBlack);
m_previousPluggedState = false;
}
}