[apps/settings] Modify preferences_controller to add symbols

This commit is contained in:
Danny Simmons
2019-12-08 15:37:17 -05:00
parent caf04ad635
commit b332d183fc

View File

@@ -130,6 +130,22 @@ Layout PreferencesController::layoutForPreferences(I18n::Message message) {
return LayoutHelper::String(text, strlen(text), k_layoutFont);
}
// Symbol controller
case I18n::Message::SymbolMultiplicationCross: // × and · aren't single characters, so they cannot be constructed into codepoints..?
{
const char * text = "×";
return LayoutHelper::String(text, strlen(text), k_layoutFont);
}
case I18n::Message::SymbolMultiplicationMiddleDot:
{
const char * text = "·";
return LayoutHelper::String(text, strlen(text), k_layoutFont);
}
case I18n::Message::SymbolMultiplicationStar:
return CodePointLayout::Builder('*', k_layoutFont);
case I18n::Message::SymbolMultiplicationAutoSymbol:
return CodePointLayout::Builder(' ', k_layoutFont);
default:
assert(false);
return Layout();
@@ -167,6 +183,8 @@ void PreferencesController::setPreferenceWithValueIndex(I18n::Message message, i
preferences->setComplexFormat((Preferences::ComplexFormat)valueIndex);
} else if (message == I18n::Message::LEDColor) {
preferences->setColorOfLED((Preferences::LEDColor)valueIndex);
} else if (message == I18n::Message::SymbolMultiplication) {
preferences->setSymbolMultiplication((Preferences::SymbolMultiplication)valueIndex);
}
}
@@ -187,6 +205,9 @@ int PreferencesController::valueIndexForPreference(I18n::Message message) {
if (message == I18n::Message::LEDColor) {
return (int)preferences->colorOfLED();
}
if (message == I18n::Message::SymbolMultiplication) {
return (int)preferences->symbolofMultiplication();
}
return 0;
}