From 4ba14c8597a5a974d96d2b18cf82b2b28afb049a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 8 Feb 2017 16:30:55 +0100 Subject: [PATCH] [apps/sequence] Personalize the button "add a function" for sequence app Change-Id: Ie84757feec57a934c80573ad24b71e868c0d7b81 --- apps/graph/list/list_controller.cpp | 2 +- apps/sequence/list/list_controller.cpp | 2 +- apps/shared/list_controller.cpp | 5 +++-- apps/shared/list_controller.h | 2 +- apps/shared/new_function_cell.cpp | 9 ++------- apps/shared/new_function_cell.h | 5 ++--- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index add1851dc..a50bd5115 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -7,7 +7,7 @@ using namespace Shared; namespace Graph { ListController::ListController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header) : - Shared::ListController(parentResponder, functionStore, header), + Shared::ListController(parentResponder, functionStore, header, "Ajouter une fonction"), m_functionTitleCells{FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator), FunctionTitleCell(FunctionTitleCell::Orientation::VerticalIndicator)}, m_parameterController(ListParameterController(this, functionStore)) diff --git a/apps/sequence/list/list_controller.cpp b/apps/sequence/list/list_controller.cpp index ae091e26c..7019ae973 100644 --- a/apps/sequence/list/list_controller.cpp +++ b/apps/sequence/list/list_controller.cpp @@ -6,7 +6,7 @@ using namespace Shared; namespace Sequence { ListController::ListController(Responder * parentResponder, SequenceStore * sequenceStore, HeaderViewController * header) : - Shared::ListController(parentResponder, sequenceStore, header), + Shared::ListController(parentResponder, sequenceStore, header, "Ajouter une suite"), m_functionTitleCells{SequenceTitleCell(&m_selectableTableView, &m_parameterController),SequenceTitleCell(&m_selectableTableView, &m_parameterController),SequenceTitleCell(&m_selectableTableView, &m_parameterController)}, m_expressionCells{SequenceExpressionCell(&m_selectableTableView),SequenceExpressionCell(&m_selectableTableView),SequenceExpressionCell(&m_selectableTableView)}, m_parameterController(ListParameterController(this, sequenceStore)), diff --git a/apps/shared/list_controller.cpp b/apps/shared/list_controller.cpp index 4e70e8c18..e6c103e26 100644 --- a/apps/shared/list_controller.cpp +++ b/apps/shared/list_controller.cpp @@ -3,11 +3,12 @@ namespace Shared { -ListController::ListController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header) : +ListController::ListController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header, const char * text) : ViewController(parentResponder), HeaderViewDelegate(header), m_selectableTableView(SelectableTableView(this, this, 0, 0, 0, 0, nullptr, false, true)), - m_functionStore(functionStore) + m_functionStore(functionStore), + m_addNewFunction(text) { } diff --git a/apps/shared/list_controller.h b/apps/shared/list_controller.h index f5f9d8358..5256b4e87 100644 --- a/apps/shared/list_controller.h +++ b/apps/shared/list_controller.h @@ -10,7 +10,7 @@ namespace Shared { class ListController : public ViewController, public HeaderViewDelegate, public TableViewDataSource { public: - ListController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header); + ListController(Responder * parentResponder, FunctionStore * functionStore, HeaderViewController * header, const char * text); View * view() override; int numberOfRows() override; int numberOfColumns() override; diff --git a/apps/shared/new_function_cell.cpp b/apps/shared/new_function_cell.cpp index 7ba2b350e..12bd6b4d5 100644 --- a/apps/shared/new_function_cell.cpp +++ b/apps/shared/new_function_cell.cpp @@ -3,11 +3,10 @@ namespace Shared { -NewFunctionCell::NewFunctionCell() : +NewFunctionCell::NewFunctionCell(const char * text) : EvenOddCell(), - m_pointerTextView(PointerTextView(KDText::FontSize::Large, nullptr, 0.5f, 0.5f)) + m_pointerTextView(PointerTextView(KDText::FontSize::Large, text, 0.5f, 0.5f)) { - m_pointerTextView.setText(text()); } void NewFunctionCell::reloadCell() { @@ -28,8 +27,4 @@ void NewFunctionCell::layoutSubviews() { m_pointerTextView.setFrame(bounds()); } -const char * NewFunctionCell::text() { - return "Ajouter une fonction"; -} - } diff --git a/apps/shared/new_function_cell.h b/apps/shared/new_function_cell.h index ecb70e817..9b576e9d4 100644 --- a/apps/shared/new_function_cell.h +++ b/apps/shared/new_function_cell.h @@ -7,13 +7,12 @@ namespace Shared { class NewFunctionCell : public EvenOddCell { public: - NewFunctionCell(); + NewFunctionCell(const char * text); void reloadCell() override; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; void layoutSubviews() override; -protected: - virtual const char * text(); +private: PointerTextView m_pointerTextView; };