From 5ddb5ada271aa4e2b440eec454dc48c51797c9a4 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 10 Jan 2021 14:12:38 +0100 Subject: [PATCH] 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 --- profile-widget/profilewidget2.cpp | 12 ++++-------- 1 file 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);