From cb67aa535de061191b792f733ec035e2bf1d32e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 21 May 2018 10:33:04 +0200 Subject: [PATCH] [apps/shared] Create static ints for cell types --- apps/shared/store_controller.cpp | 8 ++++---- apps/shared/store_controller.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/shared/store_controller.cpp b/apps/shared/store_controller.cpp index e3aeb7633..e332a0385 100644 --- a/apps/shared/store_controller.cpp +++ b/apps/shared/store_controller.cpp @@ -39,10 +39,10 @@ int StoreController::indexFromCumulatedWidth(KDCoordinate offsetX) { HighlightCell * StoreController::reusableCell(int index, int type) { assert(index >= 0); switch (type) { - case 0: + case k_titleCellType: assert(index < k_numberOfTitleCells); return titleCells(index); - case 1: + case k_editableCellType: assert(index < k_maxNumberOfEditableCells); return m_editableCells[index]; default: @@ -52,14 +52,14 @@ HighlightCell * StoreController::reusableCell(int index, int type) { } int StoreController::reusableCellCount(int type) { - if (type == 0) { + if (type == k_titleCellType) { return k_numberOfTitleCells; } return k_maxNumberOfEditableCells; } int StoreController::typeAtLocation(int i, int j) { - return j!=0; + return j == 0 ? k_titleCellType : k_editableCellType; } void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) { diff --git a/apps/shared/store_controller.h b/apps/shared/store_controller.h index 915dad585..0bdf2b44d 100644 --- a/apps/shared/store_controller.h +++ b/apps/shared/store_controller.h @@ -26,6 +26,8 @@ protected: static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2; constexpr static int k_maxNumberOfEditableCells = 22; constexpr static int k_numberOfTitleCells = 2; + static constexpr int k_titleCellType = 0; + static constexpr int k_editableCellType = 1; Responder * tabController() const override; View * loadView() override; void unloadView(View * view) override;