profile: use a flag variable in plotDive()

Positional bool parameters to control the rendering of the plot
have been a pain. We are down to one parameter (instant),
but more will be readded, so let's use the opportunity to
control rendering with a flags parameter.

Sadly, C++ has no reasonable way of defining flags that I know
of. Either the identifiers leak (enum), or can't be trivially
ORed (enum class) or are weakly typed (int). Let's just use an
integer for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-10-22 14:30:56 +02:00 committed by Dirk Hohndel
parent d3a2c40f52
commit 6dfc2da8d0
2 changed files with 13 additions and 7 deletions

View file

@ -42,11 +42,17 @@ public:
INIT
};
struct RenderFlags {
static constexpr int None = 0;
static constexpr int Instant = 1 << 0;
static constexpr int DontRecalculatePlotInfo = 1 << 1;
};
// Pass null as plannerModel if no support for planning required
ProfileWidget2(DivePlannerPointsModel *plannerModel, double dpr, QWidget *parent = 0);
~ProfileWidget2();
void resetZoom();
void plotDive(const struct dive *d, int dc, bool instant = false);
void plotDive(const struct dive *d, int dc, int flags = RenderFlags::None);
void setProfileState(const struct dive *d, int dc);
void setPlanState(const struct dive *d, int dc);
void setEditState(const struct dive *d, int dc);