summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-02 21:31:12 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2019-02-07 16:06:43 +0100
commitc2b2d690f63d5dc92471a331ba4f61a0eb7cafdb (patch)
treef37cf11fb5964c03c22e72c9578a20cd2c299746
parent8a8063c1cd7b8e5eae861a8d7eeb89e7e3251e03 (diff)
downloadsubsurface-c2b2d690f63d5dc92471a331ba4f61a0eb7cafdb.tar.gz
Profile: plot pictures of correct dive
The pictures of the current dive were plotted on the profile. In principle OK, as this is what the user is shown. Only on export this results in all profiles having the same pictures. Therefore, pass a dive argument to the picture-plotting function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--profile-widget/profilewidget2.cpp14
-rw-r--r--profile-widget/profilewidget2.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 85109875f..c8dd6df57 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -827,7 +827,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
if (doClearPictures)
clearPictures();
else
- plotPicturesInternal(plotPicturesSynchronously);
+ plotPicturesInternal(d, plotPicturesSynchronously);
toolTipItem->refresh(mapToScene(mapFromGlobal(QCursor::pos())));
#endif
@@ -2228,21 +2228,21 @@ void ProfileWidget2::updateThumbnailXPos(PictureEntry &e)
// This function resets the picture thumbnails of the current dive.
void ProfileWidget2::plotPictures()
{
- plotPicturesInternal(false);
+ plotPicturesInternal(current_dive, false);
}
-void ProfileWidget2::plotPicturesInternal(bool synchronous)
+void ProfileWidget2::plotPicturesInternal(struct dive *d, bool synchronous)
{
pictures.clear();
if (currentState == ADD || currentState == PLAN)
return;
- // Fetch all pictures of the current dive, but consider only those that are within the dive time.
+ // Fetch all pictures of the dive, but consider only those that are within the dive time.
// For each picture, create a PictureEntry object in the pictures-vector.
// emplace_back() constructs an object at the end of the vector. The parameters are passed directly to the constructor.
- // Note that FOR_EACH_PICTURE handles current_dive being null gracefully.
- FOR_EACH_PICTURE(current_dive) {
- if (picture->offset.seconds > 0 && picture->offset.seconds <= current_dive->duration.seconds)
+ // Note that FOR_EACH_PICTURE handles d being null gracefully.
+ FOR_EACH_PICTURE(d) {
+ if (picture->offset.seconds > 0 && picture->offset.seconds <= d->duration.seconds)
pictures.emplace_back(picture->offset, QString(picture->filename), scene(), synchronous);
}
if (pictures.empty())
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index 300e46e39..dc02ef55c 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -173,7 +173,7 @@ private: /*methods*/
void createPPGas(PartialPressureGasItem *item, int verticalColumn, color_index_t color, color_index_t colorAlert,
const double *thresholdSettingsMin, const double *thresholdSettingsMax);
void clearPictures();
- void plotPicturesInternal(bool synchronous);
+ void plotPicturesInternal(struct dive *d, bool synchronous);
private:
DivePlotDataModel *dataModel;
int zoomLevel;