Fix Weight stored in KGs

Recent commit 8eee2ddb got some of the logic
the wrong way round for converting weight to KGs
before saving (and when switching between metric
and imperial units).

We always store weight in KGs.
This commit is contained in:
Mark Liversedge
2012-12-01 23:27:57 +00:00
parent ea895f169b
commit 1403dff4e7

View File

@@ -831,12 +831,12 @@ RiderPage::unitChanged(int currentIndex)
if (currentIndex == 0) {
QString weighttext = QString(tr("Weight (%1)")).arg(tr("kg"));
weightlabel->setText(weighttext);
weight->setValue(weight->value() * LB_PER_KG);
weight->setValue(weight->value() / LB_PER_KG);
}
else {
QString weighttext = QString(tr("Weight (%1)")).arg(tr("lb"));
weightlabel->setText(weighttext);
weight->setValue(weight->value() / LB_PER_KG);
weight->setValue(weight->value() * LB_PER_KG);
}
}
@@ -845,7 +845,7 @@ RiderPage::saveClicked()
{
appsettings->setCValue(mainWindow->cyclist, GC_NICKNAME, nickname->text());
appsettings->setCValue(mainWindow->cyclist, GC_DOB, dob->date());
appsettings->setCValue(mainWindow->cyclist, GC_WEIGHT, weight->value() * (unitCombo->currentIndex() ? 1.0 : KG_PER_LB));
appsettings->setCValue(mainWindow->cyclist, GC_WEIGHT, weight->value() * (unitCombo->currentIndex() ? KG_PER_LB : 1.0));
if (unitCombo->currentIndex()==0)
appsettings->setCValue(mainWindow->cyclist, GC_UNIT, GC_UNIT_METRIC);