From 30386e53f67050b0158798054f8620b64184295f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Guid=C3=A9e?= Date: Wed, 12 Feb 2020 23:05:53 +0100 Subject: [PATCH] Fixed some errors with E13 --- apps/code/editor_view.h | 1 + apps/exam_mode_configuration_non_official.cpp | 2 +- apps/settings/main_controller.cpp | 14 +--------- apps/settings/main_controller.h | 28 +++++++++++-------- apps/settings/main_controller_prompt_none.cpp | 4 +-- apps/settings/sub_menu/about_controller.cpp | 6 ++-- apps/settings/sub_menu/about_controller.h | 2 ++ .../sub_menu/exam_mode_controller.cpp | 12 ++------ apps/settings/sub_menu/exam_mode_controller.h | 2 +- .../sub_menu/preferences_controller.cpp | 7 +---- apps/shared/round_cursor_view.cpp | 5 ++-- apps/title_bar_view.cpp | 6 ++-- build/config.mak | 3 +- 13 files changed, 37 insertions(+), 55 deletions(-) diff --git a/apps/code/editor_view.h b/apps/code/editor_view.h index d963522df..bbc608e88 100644 --- a/apps/code/editor_view.h +++ b/apps/code/editor_view.h @@ -37,6 +37,7 @@ private: KDSize minimalSizeForOptimalDisplay() const override; private: static constexpr KDCoordinate k_margin = 2; + const KDFont * m_font; KDCoordinate m_offset; }; diff --git a/apps/exam_mode_configuration_non_official.cpp b/apps/exam_mode_configuration_non_official.cpp index 2f94ceef7..c2aa4724f 100644 --- a/apps/exam_mode_configuration_non_official.cpp +++ b/apps/exam_mode_configuration_non_official.cpp @@ -3,7 +3,7 @@ constexpr Settings::SettingsMessageTree ExamModeConfiguration::s_modelExamChildren[] = {Settings::SettingsMessageTree(I18n::Message::ActivateExamMode), Settings::SettingsMessageTree(I18n::Message::Default)}; int ExamModeConfiguration::numberOfAvailableExamMode() { - return 1; + return 3; } GlobalPreferences::ExamMode ExamModeConfiguration::examModeAtIndex(int index) { diff --git a/apps/settings/main_controller.cpp b/apps/settings/main_controller.cpp index 0959a0a9d..81a9e0839 100644 --- a/apps/settings/main_controller.cpp +++ b/apps/settings/main_controller.cpp @@ -18,7 +18,7 @@ constexpr SettingsMessageTree s_modelFontChildren[2] = {SettingsMessageTree(I18n constexpr SettingsMessageTree s_accessibilityChildren[6] = {SettingsMessageTree(I18n::Message::AccessibilityInvertColors), SettingsMessageTree(I18n::Message::AccessibilityMagnify),SettingsMessageTree(I18n::Message::AccessibilityGamma),SettingsMessageTree(I18n::Message::AccessibilityGammaRed),SettingsMessageTree(I18n::Message::AccessibilityGammaGreen),SettingsMessageTree(I18n::Message::AccessibilityGammaBlue)}; constexpr SettingsMessageTree s_contributorsChildren[17] = {SettingsMessageTree(I18n::Message::Developers), SettingsMessageTree(I18n::Message::QuentinGuidee), SettingsMessageTree(I18n::Message::DannySimmons), SettingsMessageTree(I18n::Message::JoachimLeFournis), SettingsMessageTree(I18n::Message::JeanBaptisteBoric), SettingsMessageTree(I18n::Message::MaximeFriess), SettingsMessageTree(I18n::Message::David), SettingsMessageTree(I18n::Message::DamienNicolet), SettingsMessageTree(I18n::Message::EvannDreumont), SettingsMessageTree(I18n::Message::SzaboLevente), SettingsMessageTree(I18n::Message::VenceslasDuet), SettingsMessageTree(I18n::Message::BetaTesters), SettingsMessageTree(I18n::Message::CyprienMejat), SettingsMessageTree(I18n::Message::TimeoArnouts), SettingsMessageTree(I18n::Message::LouisC), SettingsMessageTree(I18n::Message::LucaRusso), SettingsMessageTree(I18n::Message::LelahelHideux)}; #ifdef USERNAME -constexpr SettingsMessageTree s_modelAboutChildren[8] = {SettingsMessageTree(I18n::Message::Username), SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::CustomSoftwareVersion), SettingsMessageTree(I18n::Message::MicroPythonVersion), SettingsMessageTree(I18n::Message::MemUse), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId), SettingsMessageTree(I18n::Message::Contributors, s_contributorsChildren, 17)}; +constexpr SettingsMessageTree s_modelAboutChildren[8] = {SettingsMessageTree(I18n::Message::Username), SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::CustomSoftwareVersion), SettingsMessageTree(I18n::Message::MicroPythonVersion), SettingsMessageTree(I18n::Message::MemUse), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId), SettingsMessageTree(I18n::Message::Contributors, s_contributorsChildren)}; #else constexpr SettingsMessageTree s_modelAboutChildren[7] = {SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::CustomSoftwareVersion), SettingsMessageTree(I18n::Message::MicroPythonVersion), SettingsMessageTree(I18n::Message::MemUse), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId), SettingsMessageTree(I18n::Message::Contributors, s_contributorsChildren)}; #endif @@ -195,18 +195,6 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) { MessageTableCellWithChevronAndMessage * myTextCell = (MessageTableCellWithChevronAndMessage *)cell; int childIndex = -1; switch (index) { - case k_indexOfAngleUnitCell: - childIndex = (int)preferences->angleUnit(); - break; - case k_indexOfDisplayModeCell: - childIndex = (int)preferences->displayMode(); - break; - case k_indexOfEditionModeCell: - childIndex = (int)preferences->editionMode(); - break; - case k_indexOfComplexFormatCell: - childIndex = (int)preferences->complexFormat(); - break; case k_indexOfFontCell: childIndex = GlobalPreferences::sharedGlobalPreferences()->font() == KDFont::LargeFont ? 0 : 1; break; diff --git a/apps/settings/main_controller.h b/apps/settings/main_controller.h index 53a1bb53d..f2717b65d 100644 --- a/apps/settings/main_controller.h +++ b/apps/settings/main_controller.h @@ -17,9 +17,16 @@ extern const SettingsMessageTree s_modelAngleChildren[3]; extern const SettingsMessageTree s_modelEditionModeChildren[2]; extern const SettingsMessageTree s_modelFloatDisplayModeChildren[4]; extern const SettingsMessageTree s_modelComplexFormatChildren[3]; +extern const SettingsMessageTree s_symbolChildren[4]; +extern const SettingsMessageTree s_modelMathOptionsChildren[5]; extern const SettingsMessageTree s_modelFontChildren[2]; -extern const SettingsMessageTree s_modelExamChildren[2]; -extern const SettingsMessageTree s_modelAboutChildren[3]; +extern const SettingsMessageTree s_accessibilityChildren[6]; +extern const SettingsMessageTree s_contributorsChildren[17]; +#ifdef USERNAME +extern const SettingsMessageTree s_modelAboutChildren[8]; +#else +extern const SettingsMessageTree s_modelAboutChildren[7]; +#endif extern const SettingsMessageTree s_model; class MainController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource { @@ -38,26 +45,23 @@ public: void willDisplayCellForIndex(HighlightCell * cell, int index) override; void viewWillAppear() override; private: - constexpr static int k_indexOfAngleUnitCell = 0; - constexpr static int k_indexOfDisplayModeCell = k_indexOfAngleUnitCell + 1; - constexpr static int k_indexOfEditionModeCell = k_indexOfDisplayModeCell + 1; - constexpr static int k_indexOfComplexFormatCell = k_indexOfEditionModeCell + 1; - constexpr static int k_indexOfBrightnessCell = k_indexOfComplexFormatCell + 1; - constexpr static int k_indexOfFontCell = k_indexOfBrightnessCell + 1; - constexpr static int k_indexOfLanguageCell = k_indexOfFontCell + 1; + constexpr static int k_indexOfMathOptionsChildren = 0; + constexpr static int k_indexOfBrightnessCell = k_indexOfMathOptionsChildren + 1; + constexpr static int k_indexOfLanguageCell = k_indexOfBrightnessCell + 1; constexpr static int k_indexOfExamModeCell = k_indexOfLanguageCell + 1; + constexpr static int k_indexOfFontCell = k_indexOfExamModeCell + 1; /* Pop-up cell and About cell are located at the same index because pop-up * cell is optional. We must always correct k_indexOfAboutCell with * hasPrompt() (TODO: make hasPrompt() constexpr and correct * k_indexOfAboutCell) */ - constexpr static int k_indexOfPopUpCell = k_indexOfExamModeCell + 1; - constexpr static int k_indexOfAboutCell = k_indexOfExamModeCell + 1; + constexpr static int k_indexOfPopUpCell = k_indexOfFontCell + 1; + constexpr static int k_indexOfAboutCell = k_indexOfFontCell + 1; static const SettingsMessageTree * model(); private: StackViewController * stackController() const; I18n::Message promptMessage() const; bool hasPrompt() const { return promptMessage() != I18n::Message::Default; } - constexpr static int k_numberOfSimpleChevronCells = 6; + constexpr static int k_numberOfSimpleChevronCells = 8; MessageTableCellWithChevronAndMessage m_cells[k_numberOfSimpleChevronCells]; MessageTableCellWithGaugeWithSeparator m_brightnessCell; MessageTableCellWithSwitch m_popUpCell; diff --git a/apps/settings/main_controller_prompt_none.cpp b/apps/settings/main_controller_prompt_none.cpp index 913fc7d7a..ac670ab4c 100644 --- a/apps/settings/main_controller_prompt_none.cpp +++ b/apps/settings/main_controller_prompt_none.cpp @@ -7,10 +7,10 @@ namespace Settings { constexpr SettingsMessageTree s_modelMenu[] = {SettingsMessageTree(I18n::Message::MathOptions, s_modelMathOptionsChildren), SettingsMessageTree(I18n::Message::Brightness), - SettingsMessageTree(I18n::Message::FontSizes, s_modelFontChildren), SettingsMessageTree(I18n::Message::Language), SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren), - SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren, + SettingsMessageTree(I18n::Message::FontSizes, s_modelFontChildren), + SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren), SettingsMessageTree(I18n::Message::About, s_modelAboutChildren)}; constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu); diff --git a/apps/settings/sub_menu/about_controller.cpp b/apps/settings/sub_menu/about_controller.cpp index 879bc2938..4a6a0d9a2 100644 --- a/apps/settings/sub_menu/about_controller.cpp +++ b/apps/settings/sub_menu/about_controller.cpp @@ -13,8 +13,8 @@ namespace Settings { AboutController::AboutController(Responder * parentResponder) : GenericSubController(parentResponder), - //m_contributorsController(this), - //m_contributorsCell(KDFont::LargeFont, KDFont::SmallFont), + m_contributorsController(this), + m_contributorsCell(KDFont::LargeFont, KDFont::SmallFont), m_view(&m_selectableTableView) { for (int i = 0; i < k_totalNumberOfCell; i++) { @@ -99,7 +99,7 @@ HighlightCell * AboutController::reusableCell(int index, int type) { return &m_cells[index]; } assert(index == 0); - return &m_contributorsCell; + return &m_contributorsCell; //E13HELP } int AboutController::typeAtLocation(int i, int j) { diff --git a/apps/settings/sub_menu/about_controller.h b/apps/settings/sub_menu/about_controller.h index 8b5e78af3..d93633e73 100644 --- a/apps/settings/sub_menu/about_controller.h +++ b/apps/settings/sub_menu/about_controller.h @@ -24,6 +24,8 @@ private: #else constexpr static int k_totalNumberOfCell = 7; #endif + ContributorsController m_contributorsController; + MessageTableCellWithChevronAndMessage m_contributorsCell; SelectableViewWithMessages m_view; MessageTableCellWithBuffer m_cells[k_totalNumberOfCell]; HardwareTest::PopUpController m_hardwareTestPopUpController; diff --git a/apps/settings/sub_menu/exam_mode_controller.cpp b/apps/settings/sub_menu/exam_mode_controller.cpp index 121566e6c..669097fb1 100644 --- a/apps/settings/sub_menu/exam_mode_controller.cpp +++ b/apps/settings/sub_menu/exam_mode_controller.cpp @@ -57,15 +57,7 @@ int ExamModeController::numberOfRows() const { HighlightCell * ExamModeController::reusableCell(int index, int type) { assert(type == 0); assert(index >= 0 && index < 3); - - switch(index) { - case 0: - return &m_ledCell; - case 1: - return &m_modeCell; - case 2: - return &m_examModeCell; - } + return &m_cell[index]; } int ExamModeController::reusableCellCount(int type) { @@ -75,7 +67,7 @@ int ExamModeController::reusableCellCount(int type) { void ExamModeController::willDisplayCellForIndex(HighlightCell * cell, int index) { if(index == 0){ - m_examModeCell.setHighlighted(false); + m_cell[2].setHighlighted(false); } Preferences * preferences = Preferences::sharedPreferences(); GenericSubController::willDisplayCellForIndex(cell, index); diff --git a/apps/settings/sub_menu/exam_mode_controller.h b/apps/settings/sub_menu/exam_mode_controller.h index db1e423ef..31851b554 100644 --- a/apps/settings/sub_menu/exam_mode_controller.h +++ b/apps/settings/sub_menu/exam_mode_controller.h @@ -23,7 +23,7 @@ private: int numberOfCautionLines() const; int initialSelectedRow() const override; GlobalPreferences::ExamMode examMode(); - static constexpr int k_maxNumberOfCells = 2; + static constexpr int k_maxNumberOfCells = 4; SelectableViewWithMessages m_contentView; MessageTableCell m_cell[k_maxNumberOfCells]; }; diff --git a/apps/settings/sub_menu/preferences_controller.cpp b/apps/settings/sub_menu/preferences_controller.cpp index cad2960fd..c5db57bc7 100644 --- a/apps/settings/sub_menu/preferences_controller.cpp +++ b/apps/settings/sub_menu/preferences_controller.cpp @@ -177,12 +177,7 @@ Layout PreferencesController::layoutForPreferences(I18n::Message message) { return CodePointLayout::Builder('*', k_layoutFont); case I18n::Message::SymbolMultiplicationAutoSymbol: return CodePointLayout::Builder(' ', k_layoutFont); - - // Font size - case I18n::Message::Large: - return LayoutHelper::String("000", 3, KDFont::LargeFont); - case I18n::Message::Small: - return LayoutHelper::String("000", 3, KDFont::SmallFont); + // Font size case I18n::Message::LargeFont: case I18n::Message::SmallFont: diff --git a/apps/shared/round_cursor_view.cpp b/apps/shared/round_cursor_view.cpp index 2b800b3f0..cf9bbc739 100644 --- a/apps/shared/round_cursor_view.cpp +++ b/apps/shared/round_cursor_view.cpp @@ -59,14 +59,13 @@ bool RoundCursorView::eraseCursorIfPossible() { return false; } // Erase the cursor - KDColor cursorWorkingBuffer[cursorSize*cursorSize]; KDContext * ctx = KDIonContext::sharedContext(); ctx->setOrigin(currentFrame.origin()); ctx->setClippingRect(currentFrame); - ctx->fillRectWithPixels(KDRect(0,0,k_cursorSize, k_cursorSize), m_underneathPixelBuffer, cursorWorkingBuffer); + ctx->fillRectWithPixels(KDRect(0,0,k_cursorSize, k_cursorSize), m_underneathPixelBuffer, s_cursorWorkingBuffer); // TODO Restore the context to previous values? return true; } #endif -} +} \ No newline at end of file diff --git a/apps/title_bar_view.cpp b/apps/title_bar_view.cpp index 4e6b35740..ca6250e9b 100644 --- a/apps/title_bar_view.cpp +++ b/apps/title_bar_view.cpp @@ -72,16 +72,16 @@ void TitleBarView::layoutSubviews(bool force) { KDSize batterySize = m_batteryView.minimalSizeForOptimalDisplay(); m_batteryView.setFrame(KDRect(bounds().width() - batterySize.width() - Metric::TitleBarExternHorizontalMargin, (bounds().height()- batterySize.height())/2, batterySize), force); if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) { - m_examModeIconView.setFrame(KDRect(bounds().width() - batterySize.width() - k_examIconWidth - k_alphaRightMargin - Metric::TitleBarExternHorizontalMargin, (bounds().height() - k_examIconHeight)/2, k_examIconWidth, k_examIconHeight)); + m_examModeIconView.setFrame(KDRect(bounds().width() - batterySize.width() - k_examIconWidth - k_alphaRightMargin - Metric::TitleBarExternHorizontalMargin, (bounds().height() - k_examIconHeight)/2, k_examIconWidth, k_examIconHeight), force); } else { m_examModeIconView.setFrame(KDRectZero, force); } KDSize shiftAlphaLockSize = m_shiftAlphaLockView.minimalSizeForOptimalDisplay(); if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) { // The Shift/Alpha frame is shifted when examination mode is active - m_shiftAlphaLockView.setFrame(KDRect(bounds().width()-batterySize.width()-k_examIconWidth-Metric::TitleBarExternHorizontalMargin-2*k_alphaRightMargin-shiftAlphaLockSize.width(), (bounds().height()- shiftAlphaLockSize.height())/2, shiftAlphaLockSize)); + m_shiftAlphaLockView.setFrame(KDRect(bounds().width()-batterySize.width()-k_examIconWidth-Metric::TitleBarExternHorizontalMargin-2*k_alphaRightMargin-shiftAlphaLockSize.width(), (bounds().height()- shiftAlphaLockSize.height())/2, shiftAlphaLockSize), force); } else { - m_shiftAlphaLockView.setFrame(KDRect(bounds().width()-batterySize.width()-Metric::TitleBarExternHorizontalMargin-k_alphaRightMargin-shiftAlphaLockSize.width(), (bounds().height()- shiftAlphaLockSize.height())/2, shiftAlphaLockSize)); + m_shiftAlphaLockView.setFrame(KDRect(bounds().width()-batterySize.width()-Metric::TitleBarExternHorizontalMargin-k_alphaRightMargin-shiftAlphaLockSize.width(), (bounds().height()- shiftAlphaLockSize.height())/2, shiftAlphaLockSize), force); } } diff --git a/build/config.mak b/build/config.mak index bf5b6479f..9ae3da405 100644 --- a/build/config.mak +++ b/build/config.mak @@ -7,7 +7,8 @@ EPSILON_VERSION ?= 13.0.0 EPSILON_CUSTOM_VERSION ?= 1.19.0-0 # USERNAME ?= N/A # Valid values are "none", "update", "beta" -EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings external +EPSILON_APPS ?= calculation graph code statistics probability solver atom sequence regression settings external +# EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings external EPSILON_I18N ?= en fr es de pt # EPSILON_I18N ?= en fr es de pt hu EPSILON_GETOPT ?= 0