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
|
QString DiveObjectHelper::sumWeight() const
|
||||||
{
|
{
|
||||||
int sum = 0;
|
weight_t sum = { 0 };
|
||||||
QString sumWeight;
|
|
||||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++){
|
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){
|
return get_weight_string(sum, true);
|
||||||
sumWeight = QString::number(grams_to_lbs(sum), 'f', 1) + " lbs";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sumWeight = QString::number(sum / 1000, 'f', 1) + " kg";
|
|
||||||
}
|
|
||||||
return sumWeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DiveObjectHelper::getCylinder() const
|
QString DiveObjectHelper::getCylinder() const
|
||||||
|
|
Loading…
Add table
Reference in a new issue