mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Support imperial measurements in dive planner / add dive
This was not as hard as I assumed it would be. I may still change the horizontal dimension to be the more logical seconds instead of minutes, but for now this achieves the main goal. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ff58fd7dca
commit
6ce5704435
3 changed files with 61 additions and 48 deletions
15
qt-gui.cpp
15
qt-gui.cpp
|
@ -195,17 +195,22 @@ void set_dc_nickname(struct dive *dive)
|
|||
}
|
||||
}
|
||||
|
||||
QString get_depth_string(depth_t depth, bool showunit)
|
||||
QString get_depth_string(int mm, bool showunit, bool showdecimal)
|
||||
{
|
||||
if (prefs.units.length == units::METERS) {
|
||||
double meters = depth.mm / 1000.0;
|
||||
return QString("%1%2").arg(meters, 0, 'f', meters >= 20.0 ? 0 : 1 ).arg(showunit ? _("m") : "");
|
||||
double meters = mm / 1000.0;
|
||||
return QString("%1%2").arg(meters, 0, 'f', (showdecimal && meters < 20.0) ? 1 : 0 ).arg(showunit ? _("m") : "");
|
||||
} else {
|
||||
double feet = mm_to_feet(depth.mm);
|
||||
return QString("%1%2").arg(feet, 0, 'f', 1). arg(showunit ? _("ft") : "");
|
||||
double feet = mm_to_feet(mm);
|
||||
return QString("%1%2").arg(feet, 0, 'f', showdecimal ? 1 : 0). arg(showunit ? _("ft") : "");
|
||||
}
|
||||
}
|
||||
|
||||
QString get_depth_string(depth_t depth, bool showunit, bool showdecimal)
|
||||
{
|
||||
return get_depth_string(depth.mm, showunit, showdecimal);
|
||||
}
|
||||
|
||||
QString get_depth_unit()
|
||||
{
|
||||
if (prefs.units.length == units::METERS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue