diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-10 14:12:38 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-20 10:01:50 -0800 |
commit | 5ddb5ada271aa4e2b440eec454dc48c51797c9a4 (patch) | |
tree | eed124150b3cb8ef1c286af11e807a043ea168a8 /profile-widget/profilewidget2.cpp | |
parent | 764aa6c5128b452e36dac9cd5101f65f891f43ec (diff) | |
download | subsurface-5ddb5ada271aa4e2b440eec454dc48c51797c9a4.tar.gz |
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>
Diffstat (limited to 'profile-widget/profilewidget2.cpp')
-rw-r--r-- | profile-widget/profilewidget2.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 049df247b..e8a447084 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -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); |