Fixed some errors with E13

This commit is contained in:
Quentin Guidée
2020-02-12 23:05:53 +01:00
parent 123b41232b
commit 30386e53f6
13 changed files with 37 additions and 55 deletions

View File

@@ -37,6 +37,7 @@ private:
KDSize minimalSizeForOptimalDisplay() const override;
private:
static constexpr KDCoordinate k_margin = 2;
const KDFont * m_font;
KDCoordinate m_offset;
};

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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);

View File

@@ -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];
};

View File

@@ -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:

View File

@@ -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
}
}

View File

@@ -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);
}
}

View File

@@ -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