aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-08-03 22:24:56 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-03 13:44:39 -0700
commita3fe1c560f38a848c8b5e17bd55cc760cbac4e1e (patch)
treeefb9899d01c99e2edd5059bddab301180133345b /qt-ui/diveplanner.cpp
parent0c3fa77354d1870c394913fc43b72a95a1ff8edf (diff)
downloadsubsurface-a3fe1c560f38a848c8b5e17bd55cc760cbac4e1e.tar.gz
Update altitude properly when changing unit systems
We need to change the displayed numeric value of the altitutde and not just the unit suffix when changing unit systems. Fixes #681 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 1841f8529..a250b08ad 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -323,6 +323,9 @@ void DivePlannerWidget::settingsChanged()
} else {
ui.atmHeight->setSuffix(("m"));
}
+ ui.atmHeight->blockSignals(true);
+ ui.atmHeight->setValue((int) get_depth_units((int) (log(1013.0 / plannerModel->getSurfacePressure()) * 7800000), NULL,NULL));
+ ui.atmHeight->blockSignals(false);
}
void DivePlannerPointsModel::addCylinder_clicked()
@@ -334,7 +337,7 @@ void DivePlannerWidget::atmPressureChanged(const int pressure)
{
plannerModel->setSurfacePressure(pressure);
ui.atmHeight->blockSignals(true);
- ui.atmHeight->setValue((int) get_depth_units((int)(log(1013.0 / pressure) * 7800000), NULL,NULL));
+ ui.atmHeight->setValue((int) get_depth_units((int) (log(1013.0 / pressure) * 7800000), NULL,NULL));
ui.atmHeight->blockSignals(false);
}
@@ -712,6 +715,11 @@ void DivePlannerPointsModel::setSurfacePressure(int pressure)
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
}
+int DivePlannerPointsModel::getSurfacePressure()
+{
+ return diveplan.surface_pressure;
+}
+
void DivePlannerPointsModel::setLastStop6m(bool value)
{
set_last_stop(value);