mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
finalize about_controller w/ typed cells
Co-Authored-By: null <MixedMatched@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,8 @@ namespace Settings {
|
||||
|
||||
AboutController::AboutController(Responder * parentResponder) :
|
||||
GenericSubController(parentResponder),
|
||||
m_contributorsController(this)
|
||||
m_contributorsController(this),
|
||||
m_contributorsCell(KDFont::LargeFont, KDFont::SmallFont)
|
||||
{
|
||||
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
@@ -25,16 +26,14 @@ bool AboutController::handleEvent(Ion::Events::Event event) {
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
if (event == Ion::Events::Right) {
|
||||
if (childLabel == I18n::Message::Contributors) {
|
||||
GenericSubController * subController = &m_contributorsController;
|
||||
subController->setMessageTreeModel(m_messageTreeModel->children(selectedRow()));
|
||||
StackViewController * stack = stackController();
|
||||
stack->push(subController);
|
||||
return true;
|
||||
}
|
||||
if (childLabel == I18n::Message::Contributors) {
|
||||
GenericSubController * subController = &m_contributorsController;
|
||||
subController->setMessageTreeModel(m_messageTreeModel->children(selectedRow()));
|
||||
StackViewController * stack = stackController();
|
||||
stack->push(subController);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (!(event == Ion::Events::Right)) {
|
||||
if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::SoftwareVersion) {
|
||||
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)m_selectableTableView.selectedCell();
|
||||
if (strcmp(myCell->accessoryText(), Ion::patchLevel()) == 0) {
|
||||
@@ -60,14 +59,31 @@ bool AboutController::handleEvent(Ion::Events::Event event) {
|
||||
}
|
||||
|
||||
HighlightCell * AboutController::reusableCell(int index, int type) {
|
||||
assert(type == 0);
|
||||
assert(index >= 0 && index < k_totalNumberOfCell);
|
||||
return &m_cells[index];
|
||||
assert(index >= 0);
|
||||
if (type == 0) {
|
||||
assert(index < k_totalNumberOfCell-1);
|
||||
return &m_cells[index];
|
||||
}
|
||||
assert(index == 0);
|
||||
if (type == 1) {
|
||||
return &m_contributorsCell;
|
||||
}
|
||||
}
|
||||
|
||||
int AboutController::typeAtLocation(int i, int j) {
|
||||
return (j == numberOfRows() - 1 ? 1 : 0);
|
||||
}
|
||||
|
||||
int AboutController::reusableCellCount(int type) {
|
||||
assert(type == 0);
|
||||
return k_totalNumberOfCell;
|
||||
switch (type) {
|
||||
case 0:
|
||||
return k_totalNumberOfCell-1;
|
||||
case 1:
|
||||
return 1;
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AboutController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
|
||||
@@ -14,20 +14,15 @@ public:
|
||||
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:
|
||||
bool hasUsername(){
|
||||
#ifdef USERNAME
|
||||
return true;
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
#ifdef USERNAME
|
||||
constexpr static int k_totalNumberOfCell = 6;
|
||||
#else
|
||||
constexpr static int k_totalNumberOfCell = 5;
|
||||
#endif
|
||||
ContributorsController m_contributorsController;
|
||||
MessageTableCellWithChevronAndMessage m_contributorsCell;
|
||||
MessageTableCellWithBuffer m_cells[k_totalNumberOfCell];
|
||||
HardwareTest::PopUpController m_hardwareTestPopUpController;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user