mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
[apps] Add LED switch on/off to usb timer
Change-Id: I6685ab5e21829eb9f2751819b635177a4955d403
This commit is contained in:
24
apps/usb_timer.cpp
Normal file
24
apps/usb_timer.cpp
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user