[apps/sequence] Forbid negative values and round float in values table and interval

settings.

Change-Id: Idf18b42dbba1c5cae940bb98cae57b67e7b6a4fd
This commit is contained in:
Émilie Feral
2017-04-05 11:32:16 +02:00
parent f34fac94a3
commit ee67b6ba03
10 changed files with 91 additions and 16 deletions

View File

@@ -6,11 +6,12 @@ using namespace Shared;
namespace Sequence {
ValuesController::ValuesController(Responder * parentResponder, SequenceStore * sequenceStore, ButtonRowController * header) :
Shared::ValuesController(parentResponder, header, I18n::Message::NColumn),
Shared::ValuesController(parentResponder, header, I18n::Message::NColumn, &m_intervalParameterController),
m_sequenceTitleCells{SequenceTitleCell(FunctionTitleCell::Orientation::HorizontalIndicator), SequenceTitleCell(FunctionTitleCell::Orientation::HorizontalIndicator),
SequenceTitleCell(FunctionTitleCell::Orientation::HorizontalIndicator)},
m_sequenceStore(sequenceStore),
m_sequenceParameterController(Shared::ValuesFunctionParameterController('n'))
m_sequenceParameterController(Shared::ValuesFunctionParameterController('n')),
m_intervalParameterController(IntervalParameterController(this, &m_interval))
{
}
@@ -42,6 +43,17 @@ I18n::Message ValuesController::emptyMessage() {
return I18n::Message::NoActivatedSequence;
}
IntervalParameterController * ValuesController::intervalParameterController() {
return &m_intervalParameterController;
}
bool ValuesController::setDataAtLocation(float floatBody, int columnIndex, int rowIndex) {
if (floatBody < 0) {
return false;
}
return Shared::ValuesController::setDataAtLocation(roundf(floatBody), columnIndex, rowIndex);
}
int ValuesController::maxNumberOfCells() {
return k_maxNumberOfCells;
}