diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-08-05 08:06:17 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-05 08:06:17 -0700 |
commit | 3e00bac552ac6db12e1498e3177fc2ed8ea0badc (patch) | |
tree | 540482bb30d432f3b430b7d36299456759d6422e /qt-ui/diveplanner.cpp | |
parent | 7d89f5d7ee1df0da3e2cf46c01a645e4ad36c1b0 (diff) | |
download | subsurface-3e00bac552ac6db12e1498e3177fc2ed8ea0badc.tar.gz |
Don't recalculate plan automatically with low GFHigh
While it's nice to have immediate response to gradient factor changes,
there is an oddity that very low GFHigh values can cause infinite
decompression if the last stop is at 6m.
Robert fixed this and now errors out of deco after 48 hours, but if the
user simply wants to edit their GFHigh from (for example) 75 to 70 and
deletes the '5', we really don't want to trigger a recalculation for
GFHigh of 7...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index a250b08ad..09320cafe 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -412,6 +412,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.decoStopSAC, SIGNAL(valueChanged(int)), this, SLOT(decoSacChanged(int))); 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.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool))); ui.bottomSAC->setValue(prefs.bottomsac / 1000.0); @@ -667,7 +669,10 @@ int DivePlannerPointsModel::rowCount(const QModelIndex &parent) const return divepoints.count(); } -DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTableModel(parent), mode(NOTHING) +DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTableModel(parent), + mode(NOTHING), + tempGFHigh(100), + tempGFLow(100) { memset(&diveplan, 0, sizeof(diveplan)); } @@ -699,14 +704,33 @@ void DivePlannerPointsModel::setDecoSac(int sac) void DivePlannerPointsModel::setGFHigh(const int gfhigh) { - diveplan.gfhigh = gfhigh; - plannerModel->emitDataChanged(); + 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; + plannerModel->emitDataChanged(); + } } void DivePlannerPointsModel::setGFLow(const int ghflow) { - diveplan.gflow = ghflow; - plannerModel->emitDataChanged(); + tempGFLow = ghflow; + triggerGFLow(); +} + +void DivePlannerPointsModel::triggerGFLow() +{ + if (diveplan.gflow != tempGFLow) { + diveplan.gflow = tempGFLow; + plannerModel->emitDataChanged(); + } } void DivePlannerPointsModel::setSurfacePressure(int pressure) |