mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
27 lines
744 B
C++
27 lines
744 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 {
|
|
if (m_previousPluggedState) {
|
|
Ion::LED::setColor(KDColorBlack);
|
|
m_previousPluggedState = false;
|
|
}
|
|
}
|
|
}
|