mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
O2/He percentages aren't integral
We do gas mixes in permille, not in percent. Some people really like using the value they got from the analyzer, which is generally something like 29.4% or whatever. So don't truncate percentages to integers. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d126977e16
commit
02f2768148
1 changed files with 10 additions and 10 deletions
|
@ -85,8 +85,8 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
|
||||||
// sizes take working pressure into account...
|
// sizes take working pressure into account...
|
||||||
if (cyl->type.size.mliter) {
|
if (cyl->type.size.mliter) {
|
||||||
if (prefs.units.volume == prefs.units.CUFT) {
|
if (prefs.units.volume == prefs.units.CUFT) {
|
||||||
int cuft = 0.5 + ml_to_cuft(gas_volume(cyl, cyl->type.workingpressure));
|
double cuft = ml_to_cuft(gas_volume(cyl, cyl->type.workingpressure));
|
||||||
ret = QString("%1cuft").arg(cuft);
|
ret = QString("%1cuft").arg(cuft, 0, 'f', 1);
|
||||||
} else {
|
} else {
|
||||||
ret = QString("%1l").arg(cyl->type.size.mliter / 1000.0, 0, 'f', 1);
|
ret = QString("%1l").arg(cyl->type.size.mliter / 1000.0, 0, 'f', 1);
|
||||||
}
|
}
|
||||||
|
@ -102,13 +102,13 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
|
||||||
break;
|
break;
|
||||||
case END:
|
case END:
|
||||||
if (cyl->end.mbar)
|
if (cyl->end.mbar)
|
||||||
ret = get_pressure_string(cyl->end, TRUE );
|
ret = get_pressure_string(cyl->end, TRUE);
|
||||||
break;
|
break;
|
||||||
case O2:
|
case O2:
|
||||||
ret = QString("%1%").arg((cyl->gasmix.o2.permille + 5) / 10);
|
ret = QString("%1%").arg(cyl->gasmix.o2.permille / 10.0, 0, 'f', 1);
|
||||||
break;
|
break;
|
||||||
case HE:
|
case HE:
|
||||||
ret = QString("%1%").arg((cyl->gasmix.he.permille + 5) / 10);
|
ret = QString("%1%").arg(cyl->gasmix.he.permille / 10.0, 0, 'f', 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -227,14 +227,14 @@ bool CylindersModel::setData(const QModelIndex& index, const QVariant& value, in
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case O2:
|
case O2:
|
||||||
if (CHANGED(toInt, "%", "%")) {
|
if (CHANGED(toDouble, "%", "%")) {
|
||||||
cyl->gasmix.o2.permille = value.toInt() * 10;
|
cyl->gasmix.o2.permille = value.toDouble() * 10 + 0.5;
|
||||||
mark_divelist_changed(TRUE);
|
mark_divelist_changed(TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HE:
|
case HE:
|
||||||
if (CHANGED(toInt, "%", "%")) {
|
if (CHANGED(toDouble, "%", "%")) {
|
||||||
cyl->gasmix.he.permille = value.toInt() * 10;
|
cyl->gasmix.he.permille = value.toDouble() * 10 + 0.5;
|
||||||
mark_divelist_changed(TRUE);
|
mark_divelist_changed(TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -408,7 +408,7 @@ bool WeightModel::setData(const QModelIndex& index, const QVariant& value, int r
|
||||||
if (prefs.units.weight == prefs.units.LBS)
|
if (prefs.units.weight == prefs.units.LBS)
|
||||||
ws->weight.grams = lbs_to_grams(value.toDouble());
|
ws->weight.grams = lbs_to_grams(value.toDouble());
|
||||||
else
|
else
|
||||||
ws->weight.grams = value.toDouble() * 1000.0;
|
ws->weight.grams = value.toDouble() * 1000.0 + 0.5;
|
||||||
// now update the ws_info
|
// now update the ws_info
|
||||||
WSInfoModel *wsim = WSInfoModel::instance();
|
WSInfoModel *wsim = WSInfoModel::instance();
|
||||||
QModelIndexList matches = wsim->match(wsim->index(0,0), Qt::DisplayRole, ws->description);
|
QModelIndexList matches = wsim->match(wsim->index(0,0), Qt::DisplayRole, ws->description);
|
||||||
|
|
Loading…
Add table
Reference in a new issue