mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/settings] Non-official builds don't feature Dutch exam mode
This commit is contained in:
@@ -20,6 +20,14 @@ apps_prompt_none_src += apps/settings/main_controller_prompt_none.cpp
|
||||
apps_prompt_beta_src += apps/settings/main_controller_prompt_beta.cpp
|
||||
apps_prompt_update_src += apps/settings/main_controller_prompt_update.cpp
|
||||
|
||||
apps_settings_official += $(addprefix apps/settings/,\
|
||||
sub_menu/exam_mode_controller_multi.cpp \
|
||||
)
|
||||
|
||||
apps_settings_non_official += $(addprefix apps/settings/,\
|
||||
sub_menu/exam_mode_controller_single.cpp \
|
||||
)
|
||||
|
||||
i18n_files += $(addprefix apps/settings/,\
|
||||
base.de.i18n\
|
||||
base.en.i18n\
|
||||
|
||||
@@ -68,14 +68,7 @@ ExamModeController::ExamModeController(Responder * parentResponder) :
|
||||
|
||||
bool ExamModeController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
GlobalPreferences::ExamMode mode = GlobalPreferences::ExamMode::Standard;
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
// If the exam mode is already on, this re-activate the same exam mode
|
||||
mode = GlobalPreferences::sharedGlobalPreferences()->examMode();
|
||||
} else if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::ActivateDutchExamMode) {
|
||||
mode = GlobalPreferences::ExamMode::Dutch;
|
||||
}
|
||||
AppsContainer::sharedAppsContainer()->displayExamModePopUp(mode);
|
||||
AppsContainer::sharedAppsContainer()->displayExamModePopUp(examMode());
|
||||
return true;
|
||||
}
|
||||
return GenericSubController::handleEvent(event);
|
||||
@@ -91,13 +84,6 @@ void ExamModeController::didEnterResponderChain(Responder * previousFirstRespond
|
||||
m_contentView.layoutSubviews(true);
|
||||
}
|
||||
|
||||
int ExamModeController::numberOfRows() const {
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->language() != I18n::Language::EN || GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
return 1;
|
||||
}
|
||||
return GenericSubController::numberOfRows();
|
||||
}
|
||||
|
||||
HighlightCell * ExamModeController::reusableCell(int index, int type) {
|
||||
assert(type == 0);
|
||||
assert(index >= 0 && index < k_maxNumberOfCells);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define SETTINGS_EXAM_MODE_CONTROLLER_H
|
||||
|
||||
#include "generic_sub_controller.h"
|
||||
#include "../../global_preferences.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
@@ -31,6 +32,7 @@ private:
|
||||
MessageTextView m_deactivateLine3;
|
||||
};
|
||||
int initialSelectedRow() const override;
|
||||
GlobalPreferences::ExamMode examMode();
|
||||
static constexpr int k_maxNumberOfCells = 2;
|
||||
ContentView m_contentView;
|
||||
MessageTableCell m_cell[k_maxNumberOfCells];
|
||||
|
||||
26
apps/settings/sub_menu/exam_mode_controller_multi.cpp
Normal file
26
apps/settings/sub_menu/exam_mode_controller_multi.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "exam_mode_controller.h"
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
GlobalPreferences::ExamMode ExamModeController::examMode() {
|
||||
GlobalPreferences::ExamMode mode = GlobalPreferences::ExamMode::Standard;
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
// If the exam mode is already on, this re-activate the same exam mode
|
||||
mode = GlobalPreferences::sharedGlobalPreferences()->examMode();
|
||||
} else if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::ActivateDutchExamMode) {
|
||||
mode = GlobalPreferences::ExamMode::Dutch;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
int ExamModeController::numberOfRows() const {
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->language() != I18n::Language::EN || GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
return 1;
|
||||
}
|
||||
return GenericSubController::numberOfRows();
|
||||
}
|
||||
|
||||
}
|
||||
16
apps/settings/sub_menu/exam_mode_controller_single.cpp
Normal file
16
apps/settings/sub_menu/exam_mode_controller_single.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "exam_mode_controller.h"
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
GlobalPreferences::ExamMode ExamModeController::examMode() {
|
||||
return GlobalPreferences::ExamMode::Standard;
|
||||
}
|
||||
|
||||
int ExamModeController::numberOfRows() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user