diff options
author | Monty Taylor <mordred@inaugust.com> | 2020-05-04 08:54:58 -0500 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2020-05-05 17:31:47 +0300 |
commit | 95e6792c4fe353441fd1cad8bad8b459b1a37d65 (patch) | |
tree | 93c002bf9ac52e1b7b73d526976912a73766da75 /core/subsurface-qt/diveobjecthelper.cpp | |
parent | b3270222fd884c2b1c68519bdadf7fbc357a5d06 (diff) | |
download | subsurface-95e6792c4fe353441fd1cad8bad8b459b1a37d65.tar.gz |
Grantlee: Add salinity and water type to grantlee variables
These can be useful in a printed divelog, especially if the
log entry is also showing weight and exposure suit.
Signed-off-by: Monty Taylor <mordred@inaugust.com>
Diffstat (limited to 'core/subsurface-qt/diveobjecthelper.cpp')
-rw-r--r-- | core/subsurface-qt/diveobjecthelper.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/subsurface-qt/diveobjecthelper.cpp b/core/subsurface-qt/diveobjecthelper.cpp index bed504975..7c8651507 100644 --- a/core/subsurface-qt/diveobjecthelper.cpp +++ b/core/subsurface-qt/diveobjecthelper.cpp @@ -249,6 +249,19 @@ QStringList getFullCylinderList() return cylinders; } +QString formatDiveSalinity(const dive *d) +{ + int salinity = get_dive_salinity(d); + if (!salinity) + return QString(); + return get_salinity_string(salinity); +} + +QString formatDiveWaterType(const dive *d) +{ + return get_water_type_string(get_dive_salinity(d)); +} + // Qt's metatype system insists on generating a default constructed object, even if that makes no sense. DiveObjectHelper::DiveObjectHelper() { @@ -286,7 +299,9 @@ DiveObjectHelper::DiveObjectHelper(const struct dive *d) : getCylinder(formatGetCylinder(d)), startPressure(getStartPressure(d)), endPressure(getEndPressure(d)), - firstGas(getFirstGas(d)) + firstGas(getFirstGas(d)), + salinity(formatDiveSalinity(d)), + waterType(formatDiveWaterType(d)) { #if defined(DEBUG_DOH) void *array[4]; |