6663b6c9
adorian
projet complet av...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "usb_timer.h"
#include "global_preferences.h"
#include "apps_container.h"
USBTimer::USBTimer(AppsContainer * container) :
Timer(1),
m_container(container),
m_previousPluggedState(false)
{
}
bool USBTimer::fire() {
bool needRedrawing = false;
if (Ion::USB::isPlugged()) {
if (!m_previousPluggedState && GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
m_container->displayExamModePopUp(false);
needRedrawing = true;
}
#if LED_WHILE_CHARGING
KDColor LEDColor = Ion::Battery::isCharging() ? KDColorYellow : KDColorGreen;
Ion::LED::setColor(LEDColor);
#endif
if (!m_previousPluggedState) {
Ion::Backlight::setBrightness(Ion::Backlight::MaxBrightness);
}
m_previousPluggedState = true;
} else {
if (m_previousPluggedState) {
#if LED_WHILE_CHARGING
Ion::LED::setColor(KDColorBlack);
#endif
m_previousPluggedState = false;
}
}
return needRedrawing;
}
|