mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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:
parent
891e8acaa8
commit
c33a952582
2 changed files with 18 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ class DiveObjectHelper : public QObject {
|
|||
Q_PROPERTY(int otu READ otu CONSTANT)
|
||||
Q_PROPERTY(QString sumWeight READ sumWeight CONSTANT)
|
||||
Q_PROPERTY(QStringList getCylinder READ getCylinder CONSTANT)
|
||||
Q_PROPERTY(QString startPressure READ startPressure CONSTANT)
|
||||
Q_PROPERTY(QString endPressure READ endPressure CONSTANT)
|
||||
Q_PROPERTY(QStringList startPressure READ startPressure CONSTANT)
|
||||
Q_PROPERTY(QStringList endPressure READ endPressure CONSTANT)
|
||||
Q_PROPERTY(QStringList firstGas READ firstGas CONSTANT)
|
||||
public:
|
||||
DiveObjectHelper(struct dive *dive = NULL);
|
||||
|
@ -90,8 +90,8 @@ public:
|
|||
int otu() const;
|
||||
QString sumWeight() const;
|
||||
QStringList getCylinder() const;
|
||||
QString startPressure() const;
|
||||
QString endPressure() const;
|
||||
QStringList startPressure() const;
|
||||
QStringList endPressure() const;
|
||||
QStringList firstGas() const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue