subsurface/qt-models
Linus Torvalds 288aff9dbb 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>
2016-02-25 00:58:09 +01:00
..
cleanertablemodel.cpp
cleanertablemodel.h
CMakeLists.txt Untangle Library Linkage 2016-01-08 08:04:04 -08:00
completionmodels.cpp
completionmodels.h
cylindermodel.cpp Don't use "get_volume_string()" for cylinder size string 2016-02-25 00:58:09 +01:00
cylindermodel.h
divecomputerextradatamodel.cpp
divecomputerextradatamodel.h
divecomputermodel.cpp
divecomputermodel.h
divelistmodel.cpp QML UI: pick new highest dive number when manually adding dive 2016-01-29 11:26:16 -08:00
divelistmodel.h Add helper to remove dive from model 2016-01-29 07:50:38 -08:00
divelocationmodel.cpp
divelocationmodel.h
divepicturemodel.cpp
divepicturemodel.h
diveplannermodel.cpp Unselect source dive when saving a copy in replan 2015-12-17 07:38:26 -08:00
diveplannermodel.h
diveplotdatamodel.cpp Do not run the deco calculations in the mobile app 2016-02-05 20:45:18 -08:00
diveplotdatamodel.h Do not run the deco calculations in the mobile app 2016-02-05 20:45:18 -08:00
divesitepicturesmodel.cpp
divesitepicturesmodel.h
divetripmodel.cpp
divetripmodel.h
filtermodels.cpp
filtermodels.h
gpslistmodel.cpp Reimplement the internal repesentation of GPS fixes 2016-01-10 20:44:21 -08:00
gpslistmodel.h Gps list: include the time_t timestamp in the model 2016-01-08 23:13:30 -08:00
models.cpp
models.h
ssrfsortfilterproxymodel.cpp
ssrfsortfilterproxymodel.h
tankinfomodel.cpp
tankinfomodel.h
treemodel.cpp
treemodel.h
weightmodel.cpp
weightmodel.h
weigthsysteminfomodel.cpp
weigthsysteminfomodel.h
yearlystatisticsmodel.cpp Show only as many stats as there are DC types 2016-01-24 21:29:13 -08:00
yearlystatisticsmodel.h