summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-15 03:20:23 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-15 03:20:23 -0700
commit133e1043937e20de592e14de5666bd2a00efb82b (patch)
tree25869914938fc8d7f3ea4b279b42994f98b2c476 /qt-ui
parent4eec911d3aa8060c495d35488ff0dcbf2eaa24b3 (diff)
downloadsubsurface-133e1043937e20de592e14de5666bd2a00efb82b.tar.gz
Planner: when adding new waypoint at the end, use previous gas
In commit b0da8c270736 ("When adding a waypoint, use the gasmix of the _next_ waypoint.") we default to air when adding a waypoint at the end of the plan by double-clicking. That seems silly since we could instead continue using the last gas. I wasn't able to reproduce the "gas list disappears" problem in bug #623, but I did get a silly air segment added which was equally wrong. Maybe I'm lucky and this fixes the problem that Henrik sees as well... See #623 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 1d0b27869..b099cbe40 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -829,6 +829,8 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, gasmix *gas_in,
if (usePrevious) {
if (row < divepoints.count()) {
gas = divepoints.at(row).gasmix;
+ } else if (row > 0) {
+ gas = divepoints.at(row - 1).gasmix;
} else {
if (!addGas(air))
qDebug("addGas failed"); // FIXME add error propagation