mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: pass dive to RulerItem
Instead of accessing the global displayed_dive variable in RulerItem, pass the dive. This is a step in making the profile reentrant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
54e8fe5d9e
commit
88c6ce988d
5 changed files with 11 additions and 9 deletions
|
|
@ -691,7 +691,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
|
|||
cylinderPressureAxis->setMinimum(plotInfo.minpressure);
|
||||
cylinderPressureAxis->setMaximum(plotInfo.maxpressure);
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
rulerItem->setPlotInfo(plotInfo);
|
||||
rulerItem->setPlotInfo(&displayed_dive, plotInfo);
|
||||
#endif
|
||||
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ void RulerItem2::recalculate()
|
|||
}
|
||||
QLineF line(startPoint, endPoint);
|
||||
setLine(line);
|
||||
compare_samples(&pInfo, source->idx, dest->idx, buffer, 500, 1);
|
||||
compare_samples(dive, &pInfo, source->idx, dest->idx, buffer, 500, 1);
|
||||
text = QString(buffer);
|
||||
|
||||
// draw text
|
||||
|
|
@ -148,8 +148,9 @@ RulerNodeItem2 *RulerItem2::destNode() const
|
|||
return dest;
|
||||
}
|
||||
|
||||
void RulerItem2::setPlotInfo(const plot_info &info)
|
||||
void RulerItem2::setPlotInfo(const struct dive *d, const plot_info &info)
|
||||
{
|
||||
dive = d;
|
||||
pInfo = info;
|
||||
dest->setPlotInfo(info);
|
||||
source->setPlotInfo(info);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public:
|
|||
explicit RulerItem2();
|
||||
void recalculate();
|
||||
|
||||
void setPlotInfo(const struct plot_info &pInfo);
|
||||
void setPlotInfo(const struct dive *d, const struct plot_info &pInfo);
|
||||
RulerNodeItem2 *sourceNode() const;
|
||||
RulerNodeItem2 *destNode() const;
|
||||
void setAxis(DiveCartesianAxis *time, DiveCartesianAxis *depth);
|
||||
|
|
@ -47,6 +47,7 @@ slots:
|
|||
void settingsChanged(bool toggled);
|
||||
|
||||
private:
|
||||
const struct dive *dive;
|
||||
struct plot_info pInfo;
|
||||
QPointF startPoint, endPoint;
|
||||
RulerNodeItem2 *source, *dest;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue