mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix deco_mode confusion
We have two prefernces determining the deco_mode (BUEHLMANN vs VPMB vs RECREATIONAL): One for the planner (deco_mode) and one for displaying dives (display_deco_mode). The former is set in the planner settings while the latter is set in the preferences. This patch clears up a confusion which of the two to use by introducing a helper function that selects the correct variable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
4e375f56a8
commit
bb4bf639c3
8 changed files with 36 additions and 24 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <QSettings>
|
||||
#include <QGraphicsView>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include "core/qthelper.h"
|
||||
|
||||
void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon, const QPixmap& pixmap)
|
||||
{
|
||||
|
@ -267,7 +268,7 @@ void ToolTipItem::refresh(const QPointF &pos)
|
|||
Q_ASSERT(view);
|
||||
|
||||
painter.setPen(QColor(0, 0, 0, 255));
|
||||
if ((view->currentState == ProfileWidget2::PLAN && prefs.deco_mode == BUEHLMANN) || prefs.display_deco_mode == BUEHLMANN)
|
||||
if (decoMode() == BUEHLMANN)
|
||||
painter.drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2);
|
||||
painter.drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2,
|
||||
16, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "desktop-widgets/diveplanner.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
#include "desktop-widgets/divepicturewidget.h"
|
||||
#include "core/qthelper.h"
|
||||
#endif
|
||||
|
||||
#include <libdivecomputer/parser.h>
|
||||
|
@ -558,7 +559,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
|||
// this copies the dive and makes copies of all the relevant additional data
|
||||
copy_dive(d, &displayed_dive);
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
if ((currentState == PLAN && prefs.deco_mode == VPMB) || prefs.display_deco_mode == VPMB)
|
||||
if (decoMode() == VPMB)
|
||||
decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.vpmb_conservatism));
|
||||
else
|
||||
decoModelParameters->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh));
|
||||
|
@ -570,7 +571,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
|||
plannerModel->deleteTemporaryPlan();
|
||||
return;
|
||||
}
|
||||
if ((currentState == PLAN && prefs.deco_mode == VPMB) || prefs.display_deco_mode == VPMB)
|
||||
if (decoMode() == VPMB)
|
||||
decoModelParameters->setText(QString("VPM-B +%1").arg(diveplan.vpmb_conservatism));
|
||||
else
|
||||
decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue