aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-02-14 17:33:18 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-14 12:37:37 -0800
commit8e4b4c788a12b428f22f346254ceebfba5f36c8c (patch)
tree618a8630e2aab0f22c346cdb5ef7057fa5c19472
parent8c38dbf3b7334983c0810a967b98cd35c1a0cfb0 (diff)
downloadsubsurface-8e4b4c788a12b428f22f346254ceebfba5f36c8c.tar.gz
Grab pressures from samples if required
If cylinder does not have start and end pressures assigned, attempt to grab them from the samples instead. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
index 9a6f31818..b05138980 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
@@ -38,9 +38,15 @@ static QString getPressures(struct dive *dive, enum returnPressureSelector ret)
cylinder_t *cyl = &dive->cylinder[0];
QString fmt;
if (ret == START_PRESSURE)
- fmt = get_pressure_string(cyl->start, true);
+ if (cyl->start.mbar)
+ fmt = get_pressure_string(cyl->start, true);
+ else if (cyl->sample_start.mbar)
+ fmt = get_pressure_string(cyl->sample_start, true);
if (ret == END_PRESSURE)
- fmt = get_pressure_string(cyl->end, true);
+ if (cyl->end.mbar)
+ fmt = get_pressure_string(cyl->end, true);
+ else if(cyl->sample_end.mbar)
+ fmt = get_pressure_string(cyl->sample_end, true);
return fmt;
}