mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[Exam] Fixed exam mode to omega one
This commit is contained in:
@@ -18,7 +18,7 @@ I18n::Message examModeActivationWarningMessage(GlobalPreferences::ExamMode mode,
|
||||
|
||||
// Exam mode behaviour
|
||||
KDColor examModeColor(GlobalPreferences::ExamMode mode);
|
||||
bool appIsForbiddenInExamMode(I18n::Message appName, GlobalPreferences::ExamMode mode);
|
||||
bool appIsForbiddenInExamMode(App::Descriptor::ExaminationLevel appExaminationLevel, GlobalPreferences::ExamMode mode);
|
||||
bool exactExpressionsAreForbidden(GlobalPreferences::ExamMode mode);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#include "exam_mode_configuration.h"
|
||||
|
||||
constexpr Shared::SettingsMessageTree ExamModeConfiguration::s_modelExamChildren[] = {Shared::SettingsMessageTree(I18n::Message::ActivateExamMode), Shared::SettingsMessageTree(I18n::Message::Default)};
|
||||
using namespace Poincare;
|
||||
|
||||
constexpr Shared::SettingsMessageTree s_examModeMode[] = {Shared::SettingsMessageTree(I18n::Message::ExamModeModeStandard), Shared::SettingsMessageTree(I18n::Message::ExamModeModeNoSym), Shared::SettingsMessageTree(I18n::Message::ExamModeModeNoSymNoText)};
|
||||
constexpr Shared::SettingsMessageTree ExamModeConfiguration::s_modelExamChildren[] = {Shared::SettingsMessageTree(I18n::Message::ExamModeMode, s_examModeMode), Shared::SettingsMessageTree(I18n::Message::ActivateExamMode)};
|
||||
|
||||
int ExamModeConfiguration::numberOfAvailableExamMode() {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
GlobalPreferences::ExamMode ExamModeConfiguration::examModeAtIndex(int index) {
|
||||
return GlobalPreferences::ExamMode::Standard;
|
||||
return (s_modelExamChildren[index].label() == I18n::Message::ExamModeModeStandard) ? GlobalPreferences::ExamMode::Standard : GlobalPreferences::ExamMode::NoSym;
|
||||
}
|
||||
|
||||
I18n::Message ExamModeConfiguration::examModeActivationMessage(int index) {
|
||||
@@ -19,20 +22,23 @@ I18n::Message ExamModeConfiguration::examModeActivationWarningMessage(GlobalPref
|
||||
I18n::Message warnings[] = {I18n::Message::ExitExamMode1, I18n::Message::ExitExamMode2, I18n::Message::Default};
|
||||
return warnings[line];
|
||||
}
|
||||
assert(mode == GlobalPreferences::ExamMode::Standard);
|
||||
assert(mode == GlobalPreferences::ExamMode::Standard || mode == GlobalPreferences::ExamMode::NoSym || mode == GlobalPreferences::ExamMode::NoSymNoText);
|
||||
I18n::Message warnings[] = {I18n::Message::ActiveExamModeMessage1, I18n::Message::ActiveExamModeMessage2, I18n::Message::ActiveExamModeMessage3};
|
||||
return warnings[line];
|
||||
}
|
||||
|
||||
KDColor ExamModeConfiguration::examModeColor(GlobalPreferences::ExamMode mode) {
|
||||
assert(mode == GlobalPreferences::ExamMode::Standard);
|
||||
assert(mode == GlobalPreferences::ExamMode::Standard || mode == GlobalPreferences::ExamMode::NoSym || mode == GlobalPreferences::ExamMode::NoSymNoText);
|
||||
return KDColorRed;
|
||||
}
|
||||
|
||||
bool ExamModeConfiguration::appIsForbiddenInExamMode(I18n::Message appName, GlobalPreferences::ExamMode mode) {
|
||||
bool ExamModeConfiguration::appIsForbiddenInExamMode(App::Descriptor::ExaminationLevel appExaminationLevel, GlobalPreferences::ExamMode mode) {
|
||||
if (mode == GlobalPreferences::ExamMode::NoSymNoText) {
|
||||
return appExaminationLevel == App::Descriptor::ExaminationLevel::Basic;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExamModeConfiguration::exactExpressionsAreForbidden(GlobalPreferences::ExamMode mode) {
|
||||
return false;
|
||||
return mode == GlobalPreferences::ExamMode::NoSymNoText ? true : false;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
// Caution: Dutch exam mode is subject to a compliance certification by a government agency. Distribution of a non-certified Dutch exam mode is illegal.
|
||||
|
||||
#include "exam_mode_configuration.h"
|
||||
|
||||
constexpr Shared::SettingsMessageTree ExamModeConfiguration::s_modelExamChildren[2] = {Shared::SettingsMessageTree(I18n::Message::ActivateExamMode), Shared::SettingsMessageTree(I18n::Message::ActivateDutchExamMode)};
|
||||
|
||||
int ExamModeConfiguration::numberOfAvailableExamMode() {
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->availableExamModes() == CountryPreferences::AvailableExamModes::StandardOnly
|
||||
|| GlobalPreferences::sharedGlobalPreferences()->isInExamMode())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
assert(GlobalPreferences::sharedGlobalPreferences()->availableExamModes() == CountryPreferences::AvailableExamModes::All);
|
||||
return 2;
|
||||
}
|
||||
|
||||
GlobalPreferences::ExamMode ExamModeConfiguration::examModeAtIndex(int index) {
|
||||
return index == 0 ? GlobalPreferences::ExamMode::Standard : GlobalPreferences::ExamMode::Dutch;
|
||||
}
|
||||
|
||||
I18n::Message ExamModeConfiguration::examModeActivationMessage(int index) {
|
||||
return index == 0 ? I18n::Message::ActivateExamMode : I18n::Message::ActivateDutchExamMode;
|
||||
}
|
||||
|
||||
I18n::Message ExamModeConfiguration::examModeActivationWarningMessage(GlobalPreferences::ExamMode mode, int line) {
|
||||
if (mode == GlobalPreferences::ExamMode::Off) {
|
||||
I18n::Message warnings[] = {I18n::Message::ExitExamMode1, I18n::Message::ExitExamMode2, I18n::Message::Default};
|
||||
return warnings[line];
|
||||
} else if (mode == GlobalPreferences::ExamMode::Standard) {
|
||||
I18n::Message warnings[] = {I18n::Message::ActiveExamModeMessage1, I18n::Message::ActiveExamModeMessage2, I18n::Message::ActiveExamModeMessage3};
|
||||
return warnings[line];
|
||||
}
|
||||
assert(mode == GlobalPreferences::ExamMode::Dutch);
|
||||
I18n::Message warnings[] = {I18n::Message::ActiveDutchExamModeMessage1, I18n::Message::ActiveDutchExamModeMessage2, I18n::Message::ActiveDutchExamModeMessage3};
|
||||
return warnings[line];
|
||||
}
|
||||
|
||||
KDColor ExamModeConfiguration::examModeColor(GlobalPreferences::ExamMode mode) {
|
||||
/* The Dutch exam mode LED is supposed to be orange but we can only make
|
||||
* blink "pure" colors: with RGB leds on or off (as the PWM is used for
|
||||
* blinking). The closest "pure" color is Yellow. Moreover, Orange LED is
|
||||
* already used when the battery is charging. Using yellow, we can assert
|
||||
* that the yellow LED only means that Dutch exam mode is on and avoid
|
||||
* confusing states when the battery is charging and states when the Dutch
|
||||
* exam mode is on. */
|
||||
return mode == GlobalPreferences::ExamMode::Dutch ? KDColorYellow : KDColorRed;
|
||||
}
|
||||
|
||||
bool ExamModeConfiguration::appIsForbiddenInExamMode(I18n::Message appName, GlobalPreferences::ExamMode mode) {
|
||||
return appName == I18n::Message::CodeApp && mode == GlobalPreferences::ExamMode::Dutch;
|
||||
}
|
||||
|
||||
bool ExamModeConfiguration::exactExpressionsAreForbidden(GlobalPreferences::ExamMode mode) {
|
||||
return mode == GlobalPreferences::ExamMode::Dutch;
|
||||
}
|
||||
@@ -98,7 +98,8 @@ bool Controller::handleEvent(Ion::Events::Event event) {
|
||||
} else {
|
||||
#endif
|
||||
::App::Snapshot * selectedSnapshot = container->appSnapshotAtIndex(index);
|
||||
if (ExamModeConfiguration::appIsForbiddenInExamMode(selectedSnapshot->descriptor()->name(), GlobalPreferences::sharedGlobalPreferences()->examMode())) {
|
||||
if (ExamModeConfiguration::appIsForbiddenInExamMode(selectedSnapshot->descriptor()->examinationLevel(), GlobalPreferences::sharedGlobalPreferences()->examMode())) {
|
||||
App::app()->displayWarning(I18n::Message::ForbidenAppInExamMode1, I18n::Message::ForbidenAppInExamMode2);
|
||||
} else {
|
||||
bool switched = container->switchTo(selectedSnapshot);
|
||||
assert(switched);
|
||||
|
||||
Reference in New Issue
Block a user