Add the LED Colors section to the settings menu in main_controller.

This commit is contained in:
BuildTools
2019-08-22 14:40:34 -04:00
parent 8109fbf00e
commit afe513857b
2 changed files with 16 additions and 11 deletions

View File

@@ -12,12 +12,13 @@ const SettingsMessageTree editionModeChildren[2] = {SettingsMessageTree(I18n::Me
const SettingsMessageTree floatDisplayModeChildren[3] = {SettingsMessageTree(I18n::Message::Decimal), SettingsMessageTree(I18n::Message::Scientific), SettingsMessageTree(I18n::Message::SignificantFigures)};
const SettingsMessageTree complexFormatChildren[3] = {SettingsMessageTree(I18n::Message::Real), SettingsMessageTree(I18n::Message::Cartesian), SettingsMessageTree(I18n::Message::Polar)};
const SettingsMessageTree examChildren[1] = {SettingsMessageTree(I18n::Message::ActivateExamMode)};
const SettingsMessageTree ledColorChildren[4] = {SettingsMessageTree(I18n::Message::ColorWhite), SettingsMessageTree(I18n::Message::ColorGreen), SettingsMessageTree(I18n::Message::ColorBlue), SettingsMessageTree(I18n::Message::ColorYellow)};
const SettingsMessageTree aboutChildren[4] = {SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::CustomSoftwareVersion), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId)};
#ifdef EPSILON_BOOT_PROMPT
const SettingsMessageTree menu[9] =
const SettingsMessageTree menu[10] =
#else
const SettingsMessageTree menu[8] =
const SettingsMessageTree menu[9] =
#endif
{SettingsMessageTree(I18n::Message::AngleUnit, angleChildren, 2),
SettingsMessageTree(I18n::Message::DisplayMode, floatDisplayModeChildren, 3),
@@ -26,6 +27,7 @@ const SettingsMessageTree menu[8] =
SettingsMessageTree(I18n::Message::Brightness),
SettingsMessageTree(I18n::Message::Language),
SettingsMessageTree(I18n::Message::ExamMode, examChildren, 1),
SettingsMessageTree(I18n::Message::LEDColor, ledColorChildren, 4),
#if EPSILON_BOOT_PROMPT == EPSILON_BETA_PROMPT
SettingsMessageTree(I18n::Message::BetaPopUp),
#elif EPSILON_BOOT_PROMPT == EPSILON_UPDATE_PROMPT
@@ -33,9 +35,9 @@ const SettingsMessageTree menu[8] =
#endif
SettingsMessageTree(I18n::Message::About, aboutChildren, 4)};
#ifdef EPSILON_BOOT_PROMPT
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 9);
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 10);
#else
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 8);
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 9);
#endif
MainController::MainController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate) :
@@ -116,9 +118,9 @@ bool MainController::handleEvent(Ion::Events::Event event) {
subController = &m_examModeController;
break;
#ifdef EPSILON_BOOT_PROMPT
case 8:
case 9:
#else
case 7:
case 8:
#endif
subController = &m_aboutController;
break;
@@ -177,7 +179,7 @@ int MainController::typeAtLocation(int i, int j) {
return 1;
}
#ifdef EPSILON_BOOT_PROMPT
if (j == 7) {
if (j == 8) {
return 2;
}
#endif
@@ -201,7 +203,7 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
return;
}
#ifdef EPSILON_BOOT_PROMPT
if (index == 7) {
if (index == 8) {
MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell;
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
mySwitch->setState(globalPreferences->showPopUp());
@@ -223,6 +225,9 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
case 3:
childIndex = (int)preferences->complexFormat();
break;
case 7:
childIndex = (int)preferences->colorOfLED();
break;
}
I18n::Message message = childIndex >= 0 ? m_messageTreeModel->children(index)->children(childIndex)->label() : I18n::Message::Default;
myTextCell->setSubtitle(message);

View File

@@ -29,12 +29,12 @@ public:
private:
StackViewController * stackController() const;
#ifdef EPSILON_BOOT_PROMPT
constexpr static int k_totalNumberOfCell = 9;
constexpr static int k_totalNumberOfCell = 10;
MessageTableCellWithSwitch m_popUpCell;
#else
constexpr static int k_totalNumberOfCell = 8;
constexpr static int k_totalNumberOfCell = 9;
#endif
constexpr static int k_numberOfSimpleChevronCells = 7;
constexpr static int k_numberOfSimpleChevronCells = 8;
MessageTableCellWithChevronAndMessage m_cells[k_numberOfSimpleChevronCells];
MessageTableCellWithGauge m_brightnessCell;
SelectableTableView m_selectableTableView;