profile: fix garbled profiles after visiting the planner

See mentioned GitHub issue for the full issue, and images.

The reason for this weird behavior is the existence of 2 flags in
the profile code: shouldCalculateMaxTime and shouldCalculateMaxDepth.
When exactly following the use case and test data as attached to
the GitHub issue (a very short dive, shorter than most of the
dives in the logbook), the shouldCalculateMaxTime flag never got
back to its true status, causing the the time scale not to adapt
to other dives when just clicking (or selecting) them from the dive
list.

The problem is fixed here by also setting the shouldCalculateMaxTime
flag on manipulating wayppoints in the dive plan.

Fixes: #1039

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2018-01-12 16:57:11 +01:00 committed by Dirk Hohndel
parent 082def8162
commit b4d37e8eeb

View file

@ -878,21 +878,21 @@ void ProfileWidget2::mousePressEvent(QMouseEvent *event)
return; return;
QGraphicsView::mousePressEvent(event); QGraphicsView::mousePressEvent(event);
if (currentState == PLAN || currentState == ADD || currentState == EDIT) if (currentState == PLAN || currentState == ADD || currentState == EDIT)
shouldCalculateMaxTime = false; shouldCalculateMaxDepth = shouldCalculateMaxTime = false;
} }
void ProfileWidget2::divePlannerHandlerClicked() void ProfileWidget2::divePlannerHandlerClicked()
{ {
if (zoomLevel) if (zoomLevel)
return; return;
shouldCalculateMaxDepth = false; shouldCalculateMaxDepth = shouldCalculateMaxTime = false;
} }
void ProfileWidget2::divePlannerHandlerReleased() void ProfileWidget2::divePlannerHandlerReleased()
{ {
if (zoomLevel) if (zoomLevel)
return; return;
shouldCalculateMaxDepth = true; shouldCalculateMaxDepth = shouldCalculateMaxTime = true;
replot(); replot();
} }