From 44848d5457b904a77e35fa0b93268a581b933b23 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Sun, 8 Dec 2013 14:52:34 +0100 Subject: 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 Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 9 ++++++--- qt-ui/diveplanner.h | 3 ++- 2 files changed, 8 insertions(+), 4 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(); } diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index b5c78a93c..0241bc6e3 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -221,7 +221,8 @@ private: ExpanderGraphics *depthHandler; ExpanderGraphics *timeHandler; - int minMinutes; // this holds the minimum duration of the dive. + int minMinutes; // this holds the minimum requested window time + int minDepth; // this holds the minimum requested window depth int dpMaxTime; // this is the time of the dive calculated by the deco. friend class DiveHandler; -- cgit v1.2.3-70-g09d2