diff --git a/Makefile b/Makefile index c420bd2d2..ca8b3e65b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,11 @@ include build/config.mak +ifeq (${DEVICE}, n0110) + apps_list = ${EPSILON_APPS} +else + apps_list = $(foreach i, ${EPSILON_APPS}, $(if $(filter external, $(i)),,$(i))) +endif + # Disable default Make rules .SUFFIXES: diff --git a/apps/Makefile b/apps/Makefile index 4fdeb6cb1..ec6f067c2 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -3,12 +3,12 @@ include apps/home/Makefile include apps/on_boarding/Makefile include apps/hardware_test/Makefile include apps/usb/Makefile -apps = +apps = # All selected apps are included. Each Makefile below is responsible for setting # the $apps variable (name of the app class) and the $app_headers # (path to the apps header). -$(foreach i,${EPSILON_APPS},$(eval include apps/$(i)/Makefile)) +$(foreach i,${apps_list},${eval include apps/$(i)/Makefile}) app_src += $(addprefix apps/,\ apps_container.cpp \ @@ -43,7 +43,7 @@ snapshots_construction = $(foreach i,$(apps),,m_snapshot$(subst :,,$(i))Snapshot snapshots_list = $(foreach i,$(apps),,&m_snapshot$(subst :,,$(i))Snapshot) snapshots_count = $(words $(apps)) snapshot_includes = $(foreach i,$(app_headers),-include $(i) ) -epsilon_app_names = '$(foreach i,${EPSILON_APPS},"$(i)", )' +epsilon_app_names = '$(foreach i,${apps_list},"$(i)", )' $(call object_for,apps/apps_container_storage.cpp apps/apps_container.cpp apps/main.cpp): CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_APPS_DECLARATION="$(apps_declaration)" -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count) -DEPSILON_APPS_NAMES=$(epsilon_app_names) -DUSERNAME="$(USERNAME)" diff --git a/apps/calculation/app.cpp b/apps/calculation/app.cpp index 26f9ca1c9..2196d43ab 100644 --- a/apps/calculation/app.cpp +++ b/apps/calculation/app.cpp @@ -17,6 +17,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::CalculAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::CalculationIcon; } diff --git a/apps/calculation/app.h b/apps/calculation/app.h index 8d0f75add..e22222904 100644 --- a/apps/calculation/app.h +++ b/apps/calculation/app.h @@ -15,6 +15,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot { diff --git a/apps/code/app.cpp b/apps/code/app.cpp index b446187e8..deb081b0c 100644 --- a/apps/code/app.cpp +++ b/apps/code/app.cpp @@ -14,6 +14,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::CodeAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::BasicExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::CodeIcon; } diff --git a/apps/code/app.h b/apps/code/app.h index 68119237a..4033a99cc 100644 --- a/apps/code/app.h +++ b/apps/code/app.h @@ -18,6 +18,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot { diff --git a/apps/external/app.cpp b/apps/external/app.cpp index ac0f6141c..81d39e354 100644 --- a/apps/external/app.cpp +++ b/apps/external/app.cpp @@ -12,6 +12,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::ExternalAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::BasicExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::ExternalIcon; } diff --git a/apps/external/app.h b/apps/external/app.h index e1dd47043..bdc5c7453 100644 --- a/apps/external/app.h +++ b/apps/external/app.h @@ -12,6 +12,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot { diff --git a/apps/graph/app.cpp b/apps/graph/app.cpp index 510b133f5..52b94f4be 100644 --- a/apps/graph/app.cpp +++ b/apps/graph/app.cpp @@ -16,6 +16,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::FunctionAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::GraphIcon; } diff --git a/apps/graph/app.h b/apps/graph/app.h index 3af4a678d..49530fe73 100644 --- a/apps/graph/app.h +++ b/apps/graph/app.h @@ -17,6 +17,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public Shared::FunctionApp::Snapshot { diff --git a/apps/home/controller.cpp b/apps/home/controller.cpp index 41050bf54..59f5a0142 100644 --- a/apps/home/controller.cpp +++ b/apps/home/controller.cpp @@ -59,8 +59,10 @@ bool Controller::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::OK || event == Ion::Events::EXE) { AppsContainer * container = AppsContainer::sharedAppsContainer(); ::App::Snapshot * selectedSnapshot = container->appSnapshotAtIndex(selectionDataSource()->selectedRow()*k_numberOfColumns+selectionDataSource()->selectedColumn()+1); - if ((GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Dutch || GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::NoSym) && - (selectedSnapshot->descriptor()->name() == I18n::Message::CodeApp || selectedSnapshot->descriptor()->name() == I18n::Message::ExternalApp)) { + if (((GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Dutch || GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::NoSym) && + (selectedSnapshot->descriptor()->examinationLevel() < 2)) || + ((GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Standard) && (selectedSnapshot->descriptor()->examinationLevel() < 1))) { + //(selectedSnapshot->descriptor()->name() == I18n::Message::CodeApp || selectedSnapshot->descriptor()->name() == I18n::Message::ExternalApp)) { App::app()->displayWarning(I18n::Message::ForbidenAppInExamMode1, I18n::Message::ForbidenAppInExamMode2); } else { bool switched = container->switchTo(selectedSnapshot); diff --git a/apps/probability/app.cpp b/apps/probability/app.cpp index f247625d2..5387997ee 100644 --- a/apps/probability/app.cpp +++ b/apps/probability/app.cpp @@ -15,6 +15,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::ProbaAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::ProbabilityIcon; } diff --git a/apps/probability/app.h b/apps/probability/app.h index a4a45f6d4..a1b309d59 100644 --- a/apps/probability/app.h +++ b/apps/probability/app.h @@ -27,6 +27,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot { diff --git a/apps/regression/app.cpp b/apps/regression/app.cpp index 64d5bc973..6f27c7e8e 100644 --- a/apps/regression/app.cpp +++ b/apps/regression/app.cpp @@ -14,6 +14,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::RegressionAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::RegressionIcon; } diff --git a/apps/regression/app.h b/apps/regression/app.h index 3e5ba95c8..bf44d16cc 100644 --- a/apps/regression/app.h +++ b/apps/regression/app.h @@ -17,6 +17,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot, public TabViewDataSource { diff --git a/apps/sequence/app.cpp b/apps/sequence/app.cpp index 40b27f0fb..a98e3daac 100644 --- a/apps/sequence/app.cpp +++ b/apps/sequence/app.cpp @@ -14,6 +14,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::SequenceAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::SequenceIcon; } diff --git a/apps/sequence/app.h b/apps/sequence/app.h index 0ec8334f7..936d45a55 100644 --- a/apps/sequence/app.h +++ b/apps/sequence/app.h @@ -19,6 +19,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public Shared::FunctionApp::Snapshot { diff --git a/apps/settings/app.cpp b/apps/settings/app.cpp index 36bb89d00..a1c298eba 100644 --- a/apps/settings/app.cpp +++ b/apps/settings/app.cpp @@ -12,6 +12,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::SettingsAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::SettingsIcon; } diff --git a/apps/settings/app.h b/apps/settings/app.h index 3f4c064d0..d8e1fb3a3 100644 --- a/apps/settings/app.h +++ b/apps/settings/app.h @@ -12,6 +12,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot { diff --git a/apps/solver/app.cpp b/apps/solver/app.cpp index c461403a8..55a2a390d 100644 --- a/apps/solver/app.cpp +++ b/apps/solver/app.cpp @@ -14,6 +14,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::SolverAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::SolverIcon; } diff --git a/apps/solver/app.h b/apps/solver/app.h index f855ef14d..786c5c4bf 100644 --- a/apps/solver/app.h +++ b/apps/solver/app.h @@ -16,6 +16,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot { diff --git a/apps/statistics/app.cpp b/apps/statistics/app.cpp index f93912273..120edaaa3 100644 --- a/apps/statistics/app.cpp +++ b/apps/statistics/app.cpp @@ -14,6 +14,10 @@ I18n::Message App::Descriptor::upperName() { return I18n::Message::StatsAppCapital; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::StrictExaminationLevel; +} + const Image * App::Descriptor::icon() { return ImageStore::StatIcon; } diff --git a/apps/statistics/app.h b/apps/statistics/app.h index f39a086d2..6deed5259 100644 --- a/apps/statistics/app.h +++ b/apps/statistics/app.h @@ -17,6 +17,7 @@ public: public: I18n::Message name() override; I18n::Message upperName() override; + int examinationLevel() override; const Image * icon() override; }; class Snapshot : public ::App::Snapshot, public TabViewDataSource { diff --git a/escher/include/escher/app.h b/escher/include/escher/app.h index dd437a5de..6934235e6 100644 --- a/escher/include/escher/app.h +++ b/escher/include/escher/app.h @@ -27,7 +27,12 @@ public: public: virtual I18n::Message name(); virtual I18n::Message upperName(); + virtual int examinationLevel(); virtual const Image * icon(); + + const int NoExaminationLevel = 0; + const int BasicExaminationLevel = 1; + const int StrictExaminationLevel = 2; }; class Snapshot { public: diff --git a/escher/src/app.cpp b/escher/src/app.cpp index 79d2e3c8e..3879d8bf0 100644 --- a/escher/src/app.cpp +++ b/escher/src/app.cpp @@ -13,6 +13,10 @@ I18n::Message App::Descriptor::upperName() { return (I18n::Message)0; } +int App::Descriptor::examinationLevel() { + return App::Descriptor::NoExaminationLevel; +} + const Image * App::Descriptor::icon() { return nullptr; }