diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-12-19 20:55:17 +0100 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2017-12-24 00:01:39 +0100 |
commit | d703ba99c1093cfd39f800725ef3989fb4c121de (patch) | |
tree | 76e4ee955d67904dc63d0586d5bfbd11858ec549 | |
parent | 3ad398e3a7543de7cd3402ef2a18d8dcd6fe5311 (diff) | |
download | subsurface-d703ba99c1093cfd39f800725ef3989fb4c121de.tar.gz |
Simplify update of gflow and gfhigh values in the code
The more complex handling is no longer needed because:
- Keyboard tracking for gfhigh/low UI fields was switched off here:
030c094854aeab4aaade523d7126728d9ce98a5b
- GFhigh was limited to 40 here:
53fffe0ce3696de33ce4657e20d295e4a43e0fd9
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 2 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 31 | ||||
-rw-r--r-- | qt-models/diveplannermodel.h | 4 |
3 files changed, 7 insertions, 30 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 8f41b52cc..24b428059 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -430,8 +430,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool))); connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int))); connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int))); - connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh())); - connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow())); connect(ui.vpmb_conservatism, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int))); connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool))); connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool))); diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 167b8f740..5e8f330c7 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -404,9 +404,7 @@ int DivePlannerPointsModel::rowCount(const QModelIndex &parent) const DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTableModel(parent), mode(NOTHING), - recalc(false), - tempGFHigh(100), - tempGFLow(100) + recalc(false) { memset(&diveplan, 0, sizeof(diveplan)); startTime.setTimeSpec(Qt::UTC); @@ -455,25 +453,18 @@ void DivePlannerPointsModel::setProblemSolvingTime(int minutes) void DivePlannerPointsModel::setGFHigh(const int gfhigh) { - tempGFHigh = gfhigh; - // GFHigh <= 34 can cause infinite deco at 6m - don't trigger a recalculation - // for smaller GFHigh unless the user explicitly leaves the field - if (tempGFHigh > 34) - triggerGFHigh(); -} - -void DivePlannerPointsModel::triggerGFHigh() -{ - if (diveplan.gfhigh != tempGFHigh) { - diveplan.gfhigh = tempGFHigh; + if (diveplan.gfhigh != gfhigh) { + diveplan.gfhigh = gfhigh; emitDataChanged(); } } void DivePlannerPointsModel::setGFLow(const int gflow) { - tempGFLow = gflow; - triggerGFLow(); + if (diveplan.gflow != gflow) { + diveplan.gflow = gflow; + emitDataChanged(); + } } void DivePlannerPointsModel::setRebreatherMode(int mode) @@ -485,14 +476,6 @@ void DivePlannerPointsModel::setRebreatherMode(int mode) emitDataChanged(); } -void DivePlannerPointsModel::triggerGFLow() -{ - if (diveplan.gflow != tempGFLow) { - diveplan.gflow = tempGFLow; - emitDataChanged(); - } -} - void DivePlannerPointsModel::setVpmbConservatism(int level) { if (diveplan.vpmb_conservatism != level) { diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h index ba352c422..7a1cdca83 100644 --- a/qt-models/diveplannermodel.h +++ b/qt-models/diveplannermodel.h @@ -63,9 +63,7 @@ slots: int addStop(int millimeters = 0, int seconds = 0, int cylinderid_in = -1, int ccpoint = 0, bool entered = true); void addCylinder_clicked(); void setGFHigh(const int gfhigh); - void triggerGFHigh(); void setGFLow(const int gflow); - void triggerGFLow(); void setVpmbConservatism(int level); void setSurfacePressure(int pressure); void setSalinity(int salinity); @@ -123,8 +121,6 @@ private: bool recalc; QVector<divedatapoint> divepoints; QDateTime startTime; - int tempGFHigh; - int tempGFLow; int instanceCounter = 0; struct deco_state ds_after_previous_dives; }; |