From 13fe95bb9877232114aaf63756b69632d15327d1 Mon Sep 17 00:00:00 2001 From: Danny Simmons Date: Sun, 8 Dec 2019 15:38:10 -0500 Subject: [PATCH] [apps/settings] Remove symbol_controller and references to it --- apps/settings/Makefile | 1 - apps/settings/main_controller.h | 1 - .../sub_menu/math_options_controller.cpp | 5 +- .../sub_menu/math_options_controller.h | 2 - apps/settings/sub_menu/symbol_controller.cpp | 136 ------------------ apps/settings/sub_menu/symbol_controller.h | 23 --- 6 files changed, 1 insertion(+), 167 deletions(-) delete mode 100644 apps/settings/sub_menu/symbol_controller.cpp delete mode 100644 apps/settings/sub_menu/symbol_controller.h diff --git a/apps/settings/Makefile b/apps/settings/Makefile index bb3156a6d..1226acb40 100644 --- a/apps/settings/Makefile +++ b/apps/settings/Makefile @@ -15,7 +15,6 @@ app_settings_src = $(addprefix apps/settings/,\ sub_menu/preferences_controller.cpp \ sub_menu/contributors_controller.cpp \ sub_menu/math_options_controller.cpp \ - sub_menu/symbol_controller.cpp \ ) app_src += $(app_settings_src) diff --git a/apps/settings/main_controller.h b/apps/settings/main_controller.h index 2a371b0c9..bfa85be37 100644 --- a/apps/settings/main_controller.h +++ b/apps/settings/main_controller.h @@ -8,7 +8,6 @@ #include "sub_menu/exam_mode_controller.h" #include "sub_menu/language_controller.h" #include "sub_menu/math_options_controller.h" -#include "sub_menu/symbol_controller.h" namespace Settings { diff --git a/apps/settings/sub_menu/math_options_controller.cpp b/apps/settings/sub_menu/math_options_controller.cpp index c4235fbc1..5b4b42b7b 100644 --- a/apps/settings/sub_menu/math_options_controller.cpp +++ b/apps/settings/sub_menu/math_options_controller.cpp @@ -9,8 +9,7 @@ namespace Settings { MathOptionsController::MathOptionsController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate) : GenericSubController(parentResponder), m_preferencesController(this), - m_displayModeController(this, inputEventHandlerDelegate), - m_symbolController(this) + m_displayModeController(this, inputEventHandlerDelegate) { for (int i = 0; i < k_totalNumberOfCell; i++) { m_cells[i].setMessageFont(KDFont::LargeFont); @@ -22,8 +21,6 @@ bool MathOptionsController::handleEvent(Ion::Events::Event event) { GenericSubController * subController = nullptr; if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::DisplayMode) subController = &m_displayModeController; - else if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::SymbolMultiplication) - subController = &m_symbolController; else subController = &m_preferencesController; subController->setMessageTreeModel(m_messageTreeModel->children(selectedRow())); diff --git a/apps/settings/sub_menu/math_options_controller.h b/apps/settings/sub_menu/math_options_controller.h index dcd073c10..1db4c3104 100644 --- a/apps/settings/sub_menu/math_options_controller.h +++ b/apps/settings/sub_menu/math_options_controller.h @@ -4,7 +4,6 @@ #include "generic_sub_controller.h" #include #include "display_mode_controller.h" -#include "symbol_controller.h" #include "preferences_controller.h" namespace Settings { @@ -21,7 +20,6 @@ private: MessageTableCellWithChevronAndMessage m_cells[k_totalNumberOfCell]; PreferencesController m_preferencesController; DisplayModeController m_displayModeController; - SymbolController m_symbolController; }; } diff --git a/apps/settings/sub_menu/symbol_controller.cpp b/apps/settings/sub_menu/symbol_controller.cpp deleted file mode 100644 index 33cebb801..000000000 --- a/apps/settings/sub_menu/symbol_controller.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include "symbol_controller.h" -#include -#include - -using namespace Shared; -using namespace Poincare; - -namespace Settings { - -SymbolController::SymbolController(Responder * parentResponder) : - GenericSubController(parentResponder) -{ - for (int i = 0; i < k_totalNumberOfSwitchCells; i++) { - m_switchCells[i].setMessageFont(KDFont::LargeFont); - } -} - -bool SymbolController::handleEvent(Ion::Events::Event event) { - Preferences * preferences = Preferences::sharedPreferences(); - Poincare::Preferences::SymbolMultiplication oldSymbolOfMultiplication = preferences->symbolofMultiplication(); - Poincare::Preferences::SymbolMultiplication newSymbolOfMultiplication = preferences->symbolofMultiplication(); - if (event == Ion::Events::OK || event == Ion::Events::EXE){ - switch(selectedRow()){ - case 0: - { - newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::Cross; - break; - } - case 1: - { - newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::MiddleDot; - break; - } - case 2: - { - newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::Star; - break; - } - case 3: - { - newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::Auto; - break; - } - default: - { - GenericSubController::handleEvent(event); - } - } - if (oldSymbolOfMultiplication == newSymbolOfMultiplication) { - if (newSymbolOfMultiplication == Poincare::Preferences::SymbolMultiplication::Auto) { - preferences->setSymbolMultiplication(Poincare::Preferences::SymbolMultiplication::Cross); - } else { - preferences->setSymbolMultiplication(Poincare::Preferences::SymbolMultiplication::Auto); - } - } else { - preferences->setSymbolMultiplication(newSymbolOfMultiplication); - } - m_selectableTableView.reloadData(); - return true; - } else { - return GenericSubController::handleEvent(event); - } -} - -HighlightCell * SymbolController::reusableCell(int index, int type) { - assert(type == 1 || type == 2); - if (type == 2) { - assert(index >= 0 && index < k_totalNumberOfSwitchCells); - return &m_switchCells[index]; - } - return nullptr; -} - -int SymbolController::reusableCellCount(int type) { - assert(type == 1 || type == 2); - if (type == 2) { - return k_totalNumberOfSwitchCells; - } - return 0; -} - -void SymbolController::willDisplayCellForIndex(HighlightCell * cell, int index) { - GenericSubController::willDisplayCellForIndex(cell, index); - - MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell; - - Preferences * preferences = Preferences::sharedPreferences(); - Poincare::Preferences::SymbolMultiplication symbolofMultiplication = preferences->symbolofMultiplication(); - - if (index == 0) { - SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView(); - if(symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::Cross){ - mySwitch->setState(true); - } else { - mySwitch->setState(false); - } - } - else if (index == 1) { - SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView(); - if(symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::MiddleDot){ - mySwitch->setState(true); - } else { - mySwitch->setState(false); - } - } - else if (index == 2) { - SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView(); - if (symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::Star){ - mySwitch->setState(true); - } else { - mySwitch->setState(false); - } - } - else if (index == 3){ - SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView(); - if(symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::Auto){ - mySwitch->setState(true); - } else { - mySwitch->setState(false); - } - } -} - -int SymbolController::typeAtLocation(int i, int j) { - switch (j) { - case 0: - case 1: - case 2: - case 3: - return 2; - default: - return 1; - } -} - -} diff --git a/apps/settings/sub_menu/symbol_controller.h b/apps/settings/sub_menu/symbol_controller.h deleted file mode 100644 index 2c01e1da2..000000000 --- a/apps/settings/sub_menu/symbol_controller.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SETTINGS_SYMBOLCONTROLLER_CONTROLLER_H -#define SETTINGS_SYMBOLCONTROLLER_CONTROLLER_H - -#include "generic_sub_controller.h" - -namespace Settings { - -class SymbolController : public GenericSubController { -public: - SymbolController(Responder * parentResponder); - bool handleEvent(Ion::Events::Event event) override; - HighlightCell * reusableCell(int index, int type) override; - int reusableCellCount(int type) override; - void willDisplayCellForIndex(HighlightCell * cell, int index) override; - int typeAtLocation(int i, int j) override; -private: - constexpr static int k_totalNumberOfSwitchCells = 4; - MessageTableCellWithSwitch m_switchCells[k_totalNumberOfSwitchCells]; -}; - -} - -#endif \ No newline at end of file