mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 22:30:30 +01:00
[apps/settings] Add a row "about" in settings
Change-Id: I2c7dd5a26133d7460b9c7fce087347e5f99b9467
This commit is contained in:
@@ -17,7 +17,7 @@ constexpr static char deviationFrenchDefinition[] = {Ion::Charset::SmallSigma, '
|
||||
constexpr static char deviationEnglishDefinition[] = {Ion::Charset::SmallSigma, ' ', ':', ' ', 'S', 't', 'a', 'n', 'd', 'a', 'r', 'd', ' ','d','e', 'v', 'i', 'a', 't','i','o','n', 0};
|
||||
constexpr static char deviationSpanishDefinition[] = {Ion::Charset::SmallSigma, ' ', ':', ' ', 'D', 'e','s','v','i','a','c','i','o','n',' ','t','i','p','i','c','a',0};
|
||||
|
||||
const char * messages[198][3] {
|
||||
const char * messages[201][3] {
|
||||
{"Attention", "Warning", "Cuidado"},
|
||||
{"Valider", "Confirm", "Confirmar"},
|
||||
{"Suivant", "Next", "Siguiente"},
|
||||
@@ -244,6 +244,7 @@ const char * messages[198][3] {
|
||||
{"Format resultat", "Result format", "Formato resultado"},
|
||||
{"Forme complexe", "Complex format", "Formato complejo"},
|
||||
{"Langue", "Language", "Idioma"},
|
||||
{"A propos", "About", "Acerca"},
|
||||
{"Degres ", "Degrees ", "Grados "},
|
||||
{"Radians ", "Radians ", "Radianes "},
|
||||
{"Auto ", "Auto ", "Auto "},
|
||||
@@ -251,6 +252,8 @@ const char * messages[198][3] {
|
||||
{"deg", "deg", "gra"},
|
||||
{"rad", "rad", "rad"},
|
||||
{"sci/", "sci/", "sci/"},
|
||||
{"Version du logiciel", "Software version", "Versión de software"},
|
||||
{"Numero de serie", "Serial number", "Número de serie"},
|
||||
};
|
||||
|
||||
const char sxy[4] = {Ion::Charset::CapitalSigma, 'x', 'y', 0};
|
||||
|
||||
@@ -216,6 +216,7 @@ namespace I18n {
|
||||
DisplayMode,
|
||||
ComplexFormat,
|
||||
Language,
|
||||
About,
|
||||
Degres,
|
||||
Radian,
|
||||
Auto,
|
||||
@@ -223,6 +224,8 @@ namespace I18n {
|
||||
Deg,
|
||||
Rad,
|
||||
Sci,
|
||||
SoftwareVersion,
|
||||
SerialNumber,
|
||||
|
||||
/* UNIVERSAL MESSAGES */
|
||||
Default = 0x8000,
|
||||
|
||||
@@ -13,15 +13,16 @@ const SettingsNode angleChildren[2] = {SettingsNode(I18n::Message::Degres), Sett
|
||||
const SettingsNode FloatDisplayModeChildren[2] = {SettingsNode(I18n::Message::Auto), SettingsNode(I18n::Message::Scientific)};
|
||||
const SettingsNode complexFormatChildren[2] = {SettingsNode(I18n::Message::Default), SettingsNode(I18n::Message::Default)};
|
||||
const SettingsNode languageChildren[3] = {SettingsNode(I18n::Message::French), SettingsNode(I18n::Message::English), SettingsNode(I18n::Message::Spanish)};
|
||||
const SettingsNode aboutChildren[2] = {SettingsNode(I18n::Message::SoftwareVersion), SettingsNode(I18n::Message::SerialNumber)};
|
||||
|
||||
const SettingsNode menu[4] = {SettingsNode(I18n::Message::AngleUnit, angleChildren, 2), SettingsNode(I18n::Message::DisplayMode, FloatDisplayModeChildren, 2), SettingsNode(I18n::Message::ComplexFormat, complexFormatChildren, 2),
|
||||
SettingsNode(I18n::Message::Language, languageChildren, 3)};
|
||||
const SettingsNode model = SettingsNode(I18n::Message::SettingsApp, menu, 4);
|
||||
const SettingsNode menu[5] = {SettingsNode(I18n::Message::AngleUnit, angleChildren, 2), SettingsNode(I18n::Message::DisplayMode, FloatDisplayModeChildren, 2), SettingsNode(I18n::Message::ComplexFormat, complexFormatChildren, 2),
|
||||
SettingsNode(I18n::Message::Language, languageChildren, 3), SettingsNode(I18n::Message::About, aboutChildren, 2)};
|
||||
const SettingsNode model = SettingsNode(I18n::Message::SettingsApp, menu, 5);
|
||||
|
||||
MainController::MainController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_cells{MessageTableCellWithChevronAndMessage(KDText::FontSize::Large, KDText::FontSize::Small),
|
||||
MessageTableCellWithChevronAndMessage(KDText::FontSize::Large, KDText::FontSize::Small), MessageTableCellWithChevronAndMessage(KDText::FontSize::Large, KDText::FontSize::Small)},
|
||||
MessageTableCellWithChevronAndMessage(KDText::FontSize::Large, KDText::FontSize::Small), MessageTableCellWithChevronAndMessage(KDText::FontSize::Large, KDText::FontSize::Small), MessageTableCellWithChevronAndMessage(KDText::FontSize::Large, KDText::FontSize::Small)},
|
||||
m_complexFormatCell(MessageTableCellWithChevronAndExpression(I18n::Message::Default, KDText::FontSize::Large)),
|
||||
m_selectableTableView(SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
@@ -133,6 +134,9 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
case 3:
|
||||
myTextCell->setSubtitle(m_nodeModel->children(index)->children((int)GlobalPreferences::sharedGlobalPreferences()->language()-1)->label());
|
||||
break;
|
||||
case 4:
|
||||
myTextCell->setSubtitle(I18n::Message::Default);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void viewWillAppear() override;
|
||||
private:
|
||||
StackViewController * stackController() const;
|
||||
constexpr static int k_totalNumberOfCell = 4;
|
||||
constexpr static int k_totalNumberOfCell = 5;
|
||||
MessageTableCellWithChevronAndMessage m_cells[k_totalNumberOfCell-1];
|
||||
MessageTableCellWithChevronAndExpression m_complexFormatCell;
|
||||
Poincare::ExpressionLayout * m_complexFormatLayout;
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace Settings {
|
||||
|
||||
SubController::SubController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_cells{MessageTableCell(I18n::Message::Default, KDText::FontSize::Large), MessageTableCell(I18n::Message::Default, KDText::FontSize::Large),
|
||||
MessageTableCell(I18n::Message::Default, KDText::FontSize::Large)},
|
||||
m_cells{MessageTableCellWithBuffer(I18n::Message::Default, KDText::FontSize::Large, KDText::FontSize::Small, Palette::GreyDark), MessageTableCellWithBuffer(I18n::Message::Default, KDText::FontSize::Large, KDText::FontSize::Small, Palette::GreyDark),
|
||||
MessageTableCellWithBuffer(I18n::Message::Default, KDText::FontSize::Large, KDText::FontSize::Small, Palette::GreyDark)},
|
||||
m_selectableTableView(SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_nodeModel(nullptr),
|
||||
@@ -55,6 +55,18 @@ void SubController::didEnterResponderChain(Responder * previousResponder) {
|
||||
|
||||
bool SubController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK) {
|
||||
if (m_preferenceIndex == 4) {
|
||||
if (m_selectableTableView.selectedRow() == 1) {
|
||||
return false;
|
||||
}
|
||||
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)m_selectableTableView.cellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
|
||||
if (strcmp(myCell->accessoryText(), Ion::patchLevel()) == 0) {
|
||||
myCell->setAccessoryText(Ion::softwareVersion());
|
||||
return true;
|
||||
}
|
||||
myCell->setAccessoryText(Ion::patchLevel());
|
||||
return true;
|
||||
}
|
||||
setPreferenceAtIndexWithValueIndex(m_preferenceIndex, m_selectableTableView.selectedRow());
|
||||
AppsContainer * myContainer = (AppsContainer * )app()->container();
|
||||
myContainer->refreshPreferences();
|
||||
@@ -96,8 +108,18 @@ void SubController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
if (m_preferenceIndex == 2) {
|
||||
return;
|
||||
}
|
||||
MessageTableCell * myCell = (MessageTableCell *)cell;
|
||||
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)cell;
|
||||
myCell->setMessage(m_nodeModel->children(index)->label());
|
||||
myCell->setMessageFontSize(KDText::FontSize::Large);
|
||||
myCell->setAccessoryText("");
|
||||
if (m_preferenceIndex == 4) {
|
||||
myCell->setMessageFontSize(KDText::FontSize::Small);
|
||||
const char * accessoryMessage = Ion::softwareVersion();
|
||||
if (index == 1) {
|
||||
accessoryMessage = Ion::serialNumber();
|
||||
}
|
||||
myCell->setAccessoryText(accessoryMessage);
|
||||
}
|
||||
}
|
||||
|
||||
void SubController::setNodeModel(const Node * nodeModel, int preferenceIndex) {
|
||||
@@ -131,6 +153,8 @@ void SubController::setPreferenceAtIndexWithValueIndex(int preferenceIndex, int
|
||||
case 3:
|
||||
GlobalPreferences::sharedGlobalPreferences()->setLanguage((I18n::Language)(valueIndex+1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +168,8 @@ int SubController::valueIndexAtPreferenceIndex(int preferenceIndex) {
|
||||
return (int)Preferences::sharedPreferences()->complexFormat();
|
||||
case 3:
|
||||
return (int)GlobalPreferences::sharedGlobalPreferences()->language()-1;
|
||||
case 4:
|
||||
return 0;
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
void setPreferenceAtIndexWithValueIndex(int preferenceIndex, int valueIndex);
|
||||
int valueIndexAtPreferenceIndex(int preferenceIndex);
|
||||
constexpr static int k_totalNumberOfCell = 3;
|
||||
MessageTableCell m_cells[k_totalNumberOfCell];
|
||||
MessageTableCellWithBuffer m_cells[k_totalNumberOfCell];
|
||||
ExpressionTableCell m_complexFormatCells[2];
|
||||
Poincare::ExpressionLayout * m_complexFormatLayout[2];
|
||||
SelectableTableView m_selectableTableView;
|
||||
|
||||
Reference in New Issue
Block a user