mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix dive planner sidebar depth units
The dive planner always showed the depth in our internal units, ie millimeter, in the sidebar that showed the plan points. That made little sense in metric mode, and none at all in imperial. The _graph_ showed things in meter and feet. So make the DivePlannerPointsModel always convert things to and from the user units. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d031b54d16
commit
58b668c714
3 changed files with 11 additions and 2 deletions
|
@ -937,7 +937,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex& index, int role) const
|
|||
divedatapoint p = divepoints.at(index.row());
|
||||
switch(index.column()) {
|
||||
case CCSETPOINT: return p.po2;
|
||||
case DEPTH: return p.depth;
|
||||
case DEPTH: return rint(get_depth_units(p.depth, NULL, NULL));
|
||||
case DURATION: return p.time / 60;
|
||||
case GAS: return strForAir(p);
|
||||
}
|
||||
|
@ -956,7 +956,7 @@ bool DivePlannerPointsModel::setData(const QModelIndex& index, const QVariant& v
|
|||
if(role == Qt::EditRole) {
|
||||
divedatapoint& p = divepoints[index.row()];
|
||||
switch(index.column()) {
|
||||
case DEPTH: p.depth = value.toInt(); break;
|
||||
case DEPTH: p.depth = units_to_depth(value.toInt()); break;
|
||||
case DURATION: p.time = value.toInt() * 60; break;
|
||||
case CCSETPOINT:{
|
||||
int po2 = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue