mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add total weight column to divelist
This adds the total weight carried on the dive in different weight systems to the divelist. The column is by default not shown, which can be changed in the preferences. The column is sortable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
39f606350b
commit
19621bf481
5 changed files with 74 additions and 3 deletions
22
dive.c
22
dive.c
|
@ -120,6 +120,28 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
|
|||
return d;
|
||||
}
|
||||
|
||||
double get_weight_units(unsigned int grams, int *frac, const char **units)
|
||||
{
|
||||
int decimals;
|
||||
double value;
|
||||
const char* unit;
|
||||
|
||||
if (output_units.weight == LBS) {
|
||||
value = grams_to_lbs(grams);
|
||||
unit = "lbs";
|
||||
decimals = 0;
|
||||
} else {
|
||||
value = grams / 1000.0;
|
||||
unit = "kg";
|
||||
decimals = 1;
|
||||
}
|
||||
if (frac)
|
||||
*frac = decimals;
|
||||
if (units)
|
||||
*units = unit;
|
||||
return value;
|
||||
}
|
||||
|
||||
struct dive *alloc_dive(void)
|
||||
{
|
||||
const int initial_samples = 5;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue