Mobile: return pressures for all used cylinders

Return all pressure values for all used cylinders as a list.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
Jocke 2018-07-17 11:49:42 +02:00 committed by Dirk Hohndel
parent 891e8acaa8
commit c33a952582
2 changed files with 18 additions and 10 deletions

View file

@ -35,9 +35,9 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx)
return fmt;
}
static QString getPressures(struct dive *dive, enum returnPressureSelector ret)
static QString getPressures(struct dive *dive, int i, enum returnPressureSelector ret)
{
cylinder_t *cyl = &dive->cylinder[0];
cylinder_t *cyl = &dive->cylinder[i];
QString fmt;
if (ret == START_PRESSURE) {
if (cyl->start.mbar)
@ -405,15 +405,23 @@ QStringList DiveObjectHelper::getCylinder() const
return getCylinder;
}
QString DiveObjectHelper::startPressure() const
QStringList DiveObjectHelper::startPressure() const
{
QString startPressure = getPressures(m_dive, START_PRESSURE);
QStringList startPressure;
for (int i = 0; i < MAX_CYLINDERS; i++) {
if (is_cylinder_used(m_dive, i))
startPressure << getPressures(m_dive, i, START_PRESSURE);
}
return startPressure;
}
QString DiveObjectHelper::endPressure() const
QStringList DiveObjectHelper::endPressure() const
{
QString endPressure = getPressures(m_dive, END_PRESSURE);
QStringList endPressure;
for (int i = 0; i < MAX_CYLINDERS; i++) {
if (is_cylinder_used(m_dive, i))
endPressure << getPressures(m_dive, i, END_PRESSURE);
}
return endPressure;
}