[apps] AppsContainer::activateExamMode can make the LED blink in orange

or red according to the chosen exam mode
This commit is contained in:
Émilie Feral
2019-12-13 11:31:40 +01:00
committed by LeaNumworks
parent 49d2a248da
commit 6cd98a3a48
4 changed files with 11 additions and 9 deletions

View File

@@ -214,9 +214,8 @@ void AppsContainer::run() {
* and it is visible when reflashing a N0100 (there is some noise on the
* screen before the logo appears). */
Ion::Display::pushRectUniform(screenRect, KDColorWhite);
// TODO
if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
activateExamMode();
activateExamMode(GlobalPreferences::sharedGlobalPreferences()->examMode());
}
refreshPreferences();
@@ -326,9 +325,10 @@ void AppsContainer::redrawWindow() {
m_window.redraw();
}
void AppsContainer::activateExamMode() {
void AppsContainer::activateExamMode(GlobalPreferences::ExamMode examMode) {
assert(examMode == GlobalPreferences::ExamMode::Standard || examMode == GlobalPreferences::ExamMode::Dutch);
reset();
Ion::LED::setColor(KDColorRed);
Ion::LED::setColor(examMode == GlobalPreferences::ExamMode::Dutch ? KDColorOrange : KDColorRed);
Ion::LED::setBlinking(1000, 0.1f);
}

View File

@@ -13,6 +13,7 @@
#include "exam_pop_up_controller_delegate.h"
#include "battery_timer.h"
#include "suspend_timer.h"
#include "global_preferences.h"
#include "backlight_dimming_timer.h"
#include "shared/global_context.h"
#include "on_boarding/pop_up_controller.h"
@@ -46,7 +47,7 @@ public:
void setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus newStatus);
OnBoarding::PopUpController * promptController();
void redrawWindow();
void activateExamMode();
void activateExamMode(GlobalPreferences::ExamMode examMode);
// Exam pop-up controller delegate
void examDeactivatingPopUpIsDismissed() override;
// Ion::StorageDelegate

View File

@@ -51,10 +51,11 @@ ExamPopUpController::ContentView::ContentView(Responder * parentResponder) :
m_okButton(parentResponder, I18n::Message::Ok, Invocation([](void * context, void * sender) {
ExamPopUpController * controller = (ExamPopUpController *)context;
// TODO
GlobalPreferences::sharedGlobalPreferences()->setExamMode(controller->isActivatingExamMode() ? GlobalPreferences::ExamMode::Dutch : GlobalPreferences::ExamMode::Off);
GlobalPreferences::ExamMode mode = controller->isActivatingExamMode() ? GlobalPreferences::ExamMode::Dutch : GlobalPreferences::ExamMode::Off;
GlobalPreferences::sharedGlobalPreferences()->setExamMode(mode);
AppsContainer * container = AppsContainer::sharedAppsContainer();
if (controller->isActivatingExamMode()) {
container->activateExamMode();
container->activateExamMode(mode);
} else {
Ion::LED::setColor(KDColorBlack);
Ion::LED::updateColorWithPlugAndCharge();

View File

@@ -49,8 +49,8 @@ void LogoController::viewDidDisappear() {
Ion::LED::setColor(m_previousLEDColor);
/* TODO: instead of setting again the exam mode, put the previous led color
* AND BLINKING.*/
if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) { // TODO
AppsContainer::sharedAppsContainer()->activateExamMode();
if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
AppsContainer::sharedAppsContainer()->activateExamMode(GlobalPreferences::sharedGlobalPreferences()->examMode());
}
}
ViewController::viewDidDisappear();