mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[Fix] Examination level
This commit is contained in:
Submodule apps/atom updated: dd990a4900...8f710a9d3f
@@ -17,8 +17,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::CalculAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot {
|
||||
|
||||
@@ -14,8 +14,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::CodeAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::BasicExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Basic;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot {
|
||||
|
||||
@@ -22,7 +22,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -58,10 +58,13 @@ KDColor ExamModeConfiguration::examModeColor(GlobalPreferences::ExamMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
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()->language() != I18n::Language::EN
|
||||
&& GlobalPreferences::sharedGlobalPreferences()->language() != I18n::Language::NL)
|
||||
|| GlobalPreferences::sharedGlobalPreferences()->isInExamMode())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
4
apps/external/app.cpp
vendored
4
apps/external/app.cpp
vendored
@@ -12,8 +12,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::ExternalAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::BasicExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Basic;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
2
apps/external/app.h
vendored
2
apps/external/app.h
vendored
@@ -12,7 +12,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot {
|
||||
|
||||
@@ -16,8 +16,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::FunctionAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public Shared::FunctionApp::Snapshot {
|
||||
|
||||
@@ -97,7 +97,7 @@ 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);
|
||||
|
||||
@@ -15,8 +15,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::ProbaAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot {
|
||||
|
||||
@@ -15,8 +15,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::RegressionAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot, public TabViewDataSource {
|
||||
|
||||
2
apps/rpn
2
apps/rpn
Submodule apps/rpn updated: 923fd2de53...279ec6333a
@@ -14,8 +14,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::SequenceAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public Shared::FunctionApp::Snapshot {
|
||||
|
||||
@@ -12,8 +12,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::SettingsAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot {
|
||||
|
||||
@@ -14,8 +14,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::SolverAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot {
|
||||
|
||||
@@ -15,8 +15,8 @@ I18n::Message App::Descriptor::upperName() {
|
||||
return I18n::Message::StatsAppCapital;
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::StrictExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::Strict;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon() {
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
int examinationLevel() override;
|
||||
App::Descriptor::ExaminationLevel examinationLevel() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot, public TabViewDataSource {
|
||||
|
||||
@@ -29,12 +29,13 @@ public:
|
||||
public:
|
||||
virtual I18n::Message name() { return (I18n::Message)0; }
|
||||
virtual I18n::Message upperName() { return (I18n::Message)0; }
|
||||
virtual int examinationLevel();
|
||||
enum class ExaminationLevel {
|
||||
No= 0,
|
||||
Basic = 1,
|
||||
Strict = 2,
|
||||
};
|
||||
virtual ExaminationLevel examinationLevel();
|
||||
virtual const Image * icon() { return nullptr; }
|
||||
|
||||
const int NoExaminationLevel = 0;
|
||||
const int BasicExaminationLevel = 1;
|
||||
const int StrictExaminationLevel = 2;
|
||||
};
|
||||
class Snapshot {
|
||||
public:
|
||||
|
||||
@@ -5,8 +5,8 @@ extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
|
||||
int App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::NoExaminationLevel;
|
||||
App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() {
|
||||
return App::Descriptor::ExaminationLevel::No;
|
||||
}
|
||||
|
||||
void App::Snapshot::pack(App * app) {
|
||||
|
||||
2
themes
2
themes
Submodule themes updated: 885b5bb12d...d9bc63ee68
Reference in New Issue
Block a user