mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Simplify sumWeight function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
587456190f
commit
535a6b9b25
1 changed files with 3 additions and 10 deletions
|
@ -246,18 +246,11 @@ int DiveObjectHelper::rating() const
|
|||
|
||||
QString DiveObjectHelper::sumWeight() const
|
||||
{
|
||||
int sum = 0;
|
||||
QString sumWeight;
|
||||
weight_t sum = { 0 };
|
||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++){
|
||||
sum += m_dive->weightsystem[i].weight.grams;
|
||||
sum.grams += m_dive->weightsystem[i].weight.grams;
|
||||
}
|
||||
if (informational_prefs.unit_system == IMPERIAL){
|
||||
sumWeight = QString::number(grams_to_lbs(sum), 'f', 1) + " lbs";
|
||||
}
|
||||
else {
|
||||
sumWeight = QString::number(sum / 1000, 'f', 1) + " kg";
|
||||
}
|
||||
return sumWeight;
|
||||
return get_weight_string(sum, true);
|
||||
}
|
||||
|
||||
QString DiveObjectHelper::getCylinder() const
|
||||
|
|
Loading…
Add table
Reference in a new issue