mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:33:23 +00:00
profile: remove last dc_number access from profile code
dc_number is a global variable indicating the currently displayed dive on desktop. It makes no sense on mobile, since multiple profiles can be active at the same time. Therefore, the profile code should not access this global, but use the dc number that is passed in. This removes the last access. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
96e825fb2e
commit
ada4632ff1
3 changed files with 5 additions and 8 deletions
|
@ -514,7 +514,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
animatedAxes.push_back(timeAxis);
|
||||
cylinderPressureAxis->setBounds(plotInfo.minpressure, plotInfo.maxpressure);
|
||||
|
||||
tankItem->setData(d, firstSecond, lastSecond);
|
||||
tankItem->setData(d, currentdc, firstSecond, lastSecond);
|
||||
|
||||
if (ppGraphsEnabled(currentdc, simplified)) {
|
||||
double max = prefs.pp_graphs.phe ? max_gas(plotInfo, &gas_pressures::he) : -1;
|
||||
|
|
|
@ -62,13 +62,13 @@ void TankItem::createBar(int startTime, int stopTime, struct gasmix gas)
|
|||
label->setZValue(101);
|
||||
}
|
||||
|
||||
void TankItem::setData(const struct dive *d, int plotStartTime, int plotEndTime)
|
||||
void TankItem::setData(const struct dive *d, const struct divecomputer *dc, int plotStartTime, int plotEndTime)
|
||||
{
|
||||
// remove the old rectangles
|
||||
qDeleteAll(rects);
|
||||
rects.clear();
|
||||
|
||||
if (!d)
|
||||
if (!d || !dc)
|
||||
return;
|
||||
|
||||
// We don't have enougth data to calculate things, quit.
|
||||
|
@ -79,10 +79,6 @@ void TankItem::setData(const struct dive *d, int plotStartTime, int plotEndTime)
|
|||
if (d->cylinders.nr <= 0)
|
||||
return;
|
||||
|
||||
// get the information directly from the displayed dive
|
||||
// (get_dive_dc() always returns a valid dive computer)
|
||||
const struct divecomputer *dc = get_dive_dc_const(d, dc_number);
|
||||
|
||||
// start with the first gasmix and at the start of the dive
|
||||
int cyl = explicit_first_cylinder(d, dc);
|
||||
struct gasmix gasmix = get_cylinder(d, cyl)->gasmix;
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
#include <QBrush>
|
||||
|
||||
struct dive;
|
||||
struct divecomputer;
|
||||
class DiveCartesianAxis;
|
||||
|
||||
class TankItem : public QGraphicsRectItem
|
||||
{
|
||||
public:
|
||||
explicit TankItem(const DiveCartesianAxis &axis, double dpr);
|
||||
void setData(const struct dive *d, int plotStartTime, int plotEndTime);
|
||||
void setData(const struct dive *d, const struct divecomputer *dc, int plotStartTime, int plotEndTime);
|
||||
double height() const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue