profile: don't interpret NULL as current_dive in plotDive()

ProfileWidget2::plotDive() had this weird interface, where passing
in NULL as dive would mean "show current_dive". However, most callers
would already pass in current_dive. Therefore, unify and always pass
in current_dive if the caller wants to draw the current dive.

This allows us to interpret NULL as "show empty profile". Thus,
passing in current_dive when there is no current_dive simply shows
an empty profile. This makes the calling code in
MainWindow::selectionChanged() simpler.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-04-13 13:45:52 +02:00 committed by Dirk Hohndel
parent c1963fd5dd
commit 17556cc66c
4 changed files with 8 additions and 13 deletions

View file

@ -76,7 +76,7 @@ public:
~ProfileWidget2();
void resetZoom();
void scale(qreal sx, qreal sy);
void plotDive(const struct dive *d = 0, bool force = false, bool clearPictures = false, bool instant = false);
void plotDive(const struct dive *d, bool force = false, bool clearPictures = false, bool instant = false);
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *vAxis, int vData, int hData, int zValue);
void setPrintMode(bool mode, bool grayscale = false);
bool getPrintMode();