summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-02 18:44:05 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-10 15:57:39 -0800
commit975c123a30de95eafd9b3c2ce2a625a1d05a79dc (patch)
tree55134e97aefe351ab76c08b427e9b6fd7eb5b20e /qt-models
parent233e686b92e172d4d29357b5e02d440144595130 (diff)
downloadsubsurface-975c123a30de95eafd9b3c2ce2a625a1d05a79dc.tar.gz
profile: remove redundant code in DiveCalculatedCeiling
The DiveCalculatedCeiling profile-item has a recalc() function, which calls "dataModel->calculateDecompression()". This is a questionable reversal of control-flow: The profile-item should paint the model-data not change it. The code was supposed to be called under two conditions: 1) The value of the calcceiling3m preferences flag changed. This code was buggy for two reasons: Firstly, the cached value was always initialized to false, which means that sometimes the first call was missed. Secondly, the settingsChanged() functions was only called when closing the preferences window, not when changing the flag in the profile widgets. 2) The datetime of the dive changed. The whole control-flow is pretty absurd (due to "bit rot"): - The replan-dive command sends a date-time changed signal. - The main tab changes the date-time and informs the profile. - The profile sends a signal to the item. - The item instructs the model to recalculate the decompression. - The model causes the profile to be redrawn. In any case, the whole thing is moot, because the decompression is recalculated for *every* profile plot in create_plot_info_new(). Let's remove the code from the DiveCalculatedCeiling profile-item and the calculateDecompression() function, which is now not used anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplotdatamodel.cpp10
-rw-r--r--qt-models/diveplotdatamodel.h3
2 files changed, 0 insertions, 13 deletions
diff --git a/qt-models/diveplotdatamodel.cpp b/qt-models/diveplotdatamodel.cpp
index c964d4ba2..538771331 100644
--- a/qt-models/diveplotdatamodel.cpp
+++ b/qt-models/diveplotdatamodel.cpp
@@ -218,13 +218,3 @@ void DivePlotDataModel::emitDataChanged()
{
emit dataChanged(QModelIndex(), QModelIndex());
}
-
-#ifndef SUBSURFACE_MOBILE
-void DivePlotDataModel::calculateDecompression()
-{
- struct divecomputer *dc = select_dc(&displayed_dive);
- init_decompression(&plot_deco_state, &displayed_dive);
- calculate_deco_information(&plot_deco_state, &(DivePlannerPointsModel::instance()->final_deco_state), &displayed_dive, dc, &pInfo, false);
- dataChanged(index(0, CEILING), index(pInfo.nr - 1, TISSUE_16));
-}
-#endif
diff --git a/qt-models/diveplotdatamodel.h b/qt-models/diveplotdatamodel.h
index cb0d0e3c0..d034a62b3 100644
--- a/qt-models/diveplotdatamodel.h
+++ b/qt-models/diveplotdatamodel.h
@@ -86,9 +86,6 @@ public:
double pn2Max();
double po2Max();
void emitDataChanged();
-#ifndef SUBSURFACE_MOBILE
- void calculateDecompression();
-#endif
private:
struct plot_info pInfo;