planner: pass in_planner argument to decoMode()

To remove reliance on global state, pass an "in_planner" argument
to decoMode(). Thus, calls to in_planner() can be removed.

This is a more-or-less automated change. Ultimately it would
probably be better to pass the current deco-mode to the affected
functions instead of calling decoMode() with an in_planner
parameter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-02-12 18:19:24 +01:00 committed by Dirk Hohndel
parent 03a7e65cf0
commit 642d9c80b3
12 changed files with 51 additions and 51 deletions

View file

@ -543,7 +543,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
// this copies the dive and makes copies of all the relevant additional data
copy_dive(d, &displayed_dive);
if (decoMode() == VPMB)
if (decoMode(false) == VPMB)
decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.vpmb_conservatism));
else
decoModelParameters->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh));
@ -556,7 +556,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
plannerModel->deleteTemporaryPlan();
return;
}
if (decoMode() == VPMB)
if (decoMode(currentState == PLAN) == VPMB)
decoModelParameters->setText(QString("VPM-B +%1").arg(diveplan.vpmb_conservatism));
else
decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh));
@ -800,7 +800,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
else
plotPicturesInternal(d, instant);
toolTipItem->refresh(&displayed_dive, mapToScene(mapFromGlobal(QCursor::pos())));
toolTipItem->refresh(&displayed_dive, mapToScene(mapFromGlobal(QCursor::pos())), currentState == PLAN);
#endif
// OK, how long did this take us? Anything above the second is way too long,
@ -1027,7 +1027,7 @@ void ProfileWidget2::scrollViewTo(const QPoint &pos)
void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
{
QPointF pos = mapToScene(event->pos());
toolTipItem->refresh(&displayed_dive, mapToScene(mapFromGlobal(QCursor::pos())));
toolTipItem->refresh(&displayed_dive, mapToScene(mapFromGlobal(QCursor::pos())), currentState == PLAN);
if (zoomLevel == 0) {
QGraphicsView::mouseMoveEvent(event);