summaryrefslogtreecommitdiffstats
path: root/subsurface-core/subsurface-qt
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2016-02-24 14:42:56 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-25 00:58:09 +0100
commit288aff9dbb58b6e18cf12f4d04502d60f18e74a9 (patch)
treeeb26c6f42eb88f29c027a19834511766d21a37ec /subsurface-core/subsurface-qt
parent7ebc31c1ec15ef6b34c27b9c0f892a5a90b0eef3 (diff)
downloadsubsurface-288aff9dbb58b6e18cf12f4d04502d60f18e74a9.tar.gz
Don't use "get_volume_string()" for cylinder size string
We had two totally different usage cases for "get_volume_string()": one that did the obvious "show this volume as a string", and one that tried to show a cylinder size. The function used a magic third argument (the working pressure of the cylinder) to distinguish between the two cases, but it still got it wrong. A metric cylinder doesn't necessarily have a working pressure at all, and the size is a wet size in liters. We'd pass in zero as the working pressure, and if the volume units were set to cubic feet, the logic in "get_volume_string()" would happily convert the metric wet size into the wet size in cubic feet. But that's completely wrong. An imperial cylinder size simply isn't a wet size. If you don't have a working pressure, you cannot convert the cylinder size to cubic feet. End of story. So instead of having "get_volume_string()" have magical behavior depending on working pressure, and getting it wrong anyway, just make get_volume_string do a pure volume conversion, and create a whole new function for showing the size of a cylinder. Now, if the cylinder doesn't have a working pressure, we just show the metric size, even if the user had asked for cubic feet. [Dirk Hohndel: added call to translation functions for the units] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt')
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
index 376380b8c..bea9556b2 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
@@ -26,7 +26,7 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx)
if (!desc && idx > 0)
return QString(EMPTY_DIVE_STRING);
QString fmt = desc ? QString(desc) : QObject::tr("unknown");
- fmt += ", " + get_volume_string(cyl->type.size, true, 0);
+ fmt += ", " + get_volume_string(cyl->type.size, true);
fmt += ", " + get_pressure_string(cyl->type.workingpressure, true);
fmt += ", " + get_pressure_string(cyl->start, false) + " - " + get_pressure_string(cyl->end, true);
fmt += ", " + get_gas_string(cyl->gasmix);