aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-05-29 23:32:38 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-29 15:12:49 -0700
commit7d42b53bba235894668ed1f2da3f5d17cd97b9c5 (patch)
treeed34dfe32c17e8ac99ff6f4e1058ef30eccd6128 /qt-ui
parentd054e8c457c2113b39a7d8fe21215c99a86d1d9d (diff)
downloadsubsurface-7d42b53bba235894668ed1f2da3f5d17cd97b9c5.tar.gz
Show the calculated deco stops in the planner table
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp22
-rw-r--r--qt-ui/diveplanner.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 8c3d45c63..c243c1528 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -769,6 +769,27 @@ void DivePlannerPointsModel::clear()
CylindersModel::instance()->clear();
}
+void DivePlannerPointsModel::addDecoToModel()
+{
+ struct divedatapoint *dp;
+
+ bool oldRecalc = plannerModel->setRecalc(false);
+ plannerModel->removeDeco();
+
+ unsigned int lastdepth = 0;
+ for (dp = diveplan.dp; dp != NULL; dp = dp->next) {
+ if (dp->time == 0) // magic entry for available tank
+ continue;
+ if (!dp->entered) {
+ if (dp->depth) {
+ if (dp->depth == lastdepth || dp->o2 != dp->next->o2 || dp->he != dp->next->he)
+ plannerModel->addStop(dp->depth, dp->time, dp->next->o2, dp->next->he, 0, false);
+ lastdepth = dp->depth;
+ }
+ }
+ }
+ plannerModel->setRecalc(oldRecalc);
+}
void DivePlannerPointsModel::createTemporaryPlan()
{
@@ -809,6 +830,7 @@ void DivePlannerPointsModel::createTemporaryPlan()
#endif
if (plannerModel->recalcQ()) {
plan(&diveplan, &cache, &tempDive, stagingDive, isPlanner());
+ addDecoToModel();
if (mode == ADD || mode == PLAN) {
// copy the samples and events, but don't overwrite the cylinders
copy_samples(tempDive, current_dive);
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index a281b7634..7cc4265bd 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -99,6 +99,7 @@ private:
QVector<sample> backupSamples; // For editing added dives.
struct dive *stagingDive;
QVector<QPair<int, int> > oldGases;
+ void addDecoToModel();
};
class DiveHandler : public QObject, public QGraphicsEllipseItem {