mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/settings] Remove symbol_controller and references to it
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "generic_sub_controller.h"
|
||||
#include <escher.h>
|
||||
#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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
#include "symbol_controller.h"
|
||||
#include <assert.h>
|
||||
#include <poincare/preferences.h>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user