summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-12-08 14:52:34 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-08 16:20:40 +0100
commit44848d5457b904a77e35fa0b93268a581b933b23 (patch)
tree99cac9fba92a7a3fe388e0b752b2a596f77f0ae8 /qt-ui/diveplanner.cpp
parenta145c2e61a1be0332aff3fd59331f51f36a35ebc (diff)
downloadsubsurface-44848d5457b904a77e35fa0b93268a581b933b23.tar.gz
Keep track of user requested minimum depth
When got auto-rescaling of the depth scale, always reset the depth scale to what the profile would suggest. This introduces a concept of user requested minimum witch we will update and not scale down to lower than. Reported-by: Henrik Brautaset Aronsen <henrik@synth.no> Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index ad4f60055..2abf68f94 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -158,6 +158,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
scene()->addItem(depthHandler);
minMinutes = TIME_INITIAL_MAX;
+ minDepth = M_OR_FT(40,120);
QAction *action = NULL;
#define ADD_ACTION( SHORTCUT, Slot ) \
@@ -360,7 +361,8 @@ void DivePlannerGraphics::increaseDepth()
{
if (depthLine->maximum() + M_OR_FT(10,30) > MAX_DEPTH)
return;
- depthLine->setMaximum( depthLine->maximum() + M_OR_FT(10,30));
+ minDepth += M_OR_FT(10,30);
+ depthLine->setMaximum( minDepth );
depthLine->updateTicks();
drawProfile();
}
@@ -387,7 +389,8 @@ void DivePlannerGraphics::decreaseDepth()
return;
}
}
- depthLine->setMaximum(depthLine->maximum() - M_OR_FT(10,30));
+ minDepth -= M_OR_FT(10,30);
+ depthLine->setMaximum( minDepth );
depthLine->updateTicks();
drawProfile();
}
@@ -502,7 +505,7 @@ void DivePlannerGraphics::drawProfile()
timeLine->updateTicks();
}
if (!activeDraggedHandler && (depthLine->maximum() < max_depth + M_OR_FT(10,30) || max_depth + M_OR_FT(10,30) < depthLine->maximum())) {
- double newMax = fmax(max_depth + M_OR_FT(10,30), M_OR_FT(40,120));
+ double newMax = fmax(max_depth + M_OR_FT(10,30), minDepth);
depthLine->setMaximum(newMax);
depthLine->updateTicks();
}