mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 01:23:24 +00:00
Fix inaccurate weight and temperature display in dive list
A nonexisting temperature (mkelvin==0) was displayed as -273°C. Weight was always displayed with an extra 500 grams/0.5 lbs. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f9598f062c
commit
5868b37e6b
1 changed files with 5 additions and 2 deletions
|
@ -540,6 +540,9 @@ QString DiveItem::displayTemperature() const
|
|||
{
|
||||
QString str;
|
||||
|
||||
if (!dive->watertemp.mkelvin)
|
||||
return str;
|
||||
|
||||
if (get_units()->temperature == units::CELSIUS)
|
||||
str = QString::number(mkelvin_to_C(dive->watertemp.mkelvin), 'f', 1);
|
||||
else
|
||||
|
@ -567,9 +570,9 @@ QString DiveItem::displayWeight() const
|
|||
if (get_units()->weight == units::KG) {
|
||||
int gr = weight() % 1000;
|
||||
int kg = weight() / 1000;
|
||||
str = QString("%1.%2").arg(kg).arg((unsigned)(gr + 500) / 100);
|
||||
str = QString("%1.%2").arg(kg).arg((unsigned)(gr) / 100);
|
||||
} else {
|
||||
str = QString("%1").arg((unsigned)(grams_to_lbs(weight()) + 0.5));
|
||||
str = QString("%1").arg((unsigned)(grams_to_lbs(weight())));
|
||||
}
|
||||
|
||||
return str;
|
||||
|
|
Loading…
Add table
Reference in a new issue