profile: don't "fake" dc in profile widget

There was code to create a fake dc in the profile widget in
the case that there are no samples. To my understanding, this
is obsolete, as such fake data is now generated automatically
when adding dives.

If for some reason there really are no samples, quit early
and go into the empty state.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-10 14:12:38 +01:00 committed by Dirk Hohndel
parent 764aa6c512
commit 5ddb5ada27

View file

@ -563,6 +563,10 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
#endif
}
struct divecomputer *currentdc = select_dc(&displayed_dive);
if (!currentdc || !currentdc->samples)
return setEmptyState();
// special handling when switching from empty state
animSpeed = instant || currentState == EMPTY ? 0 : qPrefDisplay::animation_speed();
@ -577,14 +581,6 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
if (currentState == EMPTY)
setProfileState();
// next get the dive computer structure - if there are no samples
// let's create a fake profile that's somewhat reasonable for the
// data that we have
struct divecomputer *currentdc = select_dc(&displayed_dive);
Q_ASSERT(currentdc);
if (!currentdc || !currentdc->samples)
fake_dc(currentdc);
bool setpointflag = (currentdc->divemode == CCR) && prefs.pp_graphs.po2 && current_dive;
bool sensorflag = setpointflag && prefs.show_ccr_sensors;
o2SetpointGasItem->setVisible(setpointflag && prefs.show_ccr_setpoint);