summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-10-19 07:07:07 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-19 07:07:07 -0700
commit5f44fdd9cf6fba073837cbc1d89c6ed3ea28dd76 (patch)
treeccf7ecf769b5b3240fa313233eff78c0f52c7881 /qt-ui/diveplanner.cpp
parent839bcaaf70b763590509031208b6786288910bc3 (diff)
downloadsubsurface-5f44fdd9cf6fba073837cbc1d89c6ed3ea28dd76.tar.gz
Make planner work again for CCR dives
The latest CCR patches had rendered the planner not usable for CCR dives. This patch corrects this (and reenables the CCR set point column for segments). The problem was that a new member setpoint of struct divepoint had been introduced, but there was already po2 which had the same meaning. This patch merges the two and renames them setpoint to prevent future confusion. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index f0ef56506..2e382051e 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -589,7 +589,7 @@ bool DivePlannerPointsModel::recalcQ()
int DivePlannerPointsModel::columnCount(const QModelIndex &parent) const
{
- return COLUMNS - 1; // don't show CCSETPOINT until we can plan CC dives
+ return COLUMNS; // to disable CCSETPOINT subtract one
}
QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const
@@ -598,7 +598,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole || role == Qt::EditRole) {
switch (index.column()) {
case CCSETPOINT:
- return (double)p.po2 / 1000;
+ return (double)p.setpoint / 1000;
case DEPTH:
return (int) rint(get_depth_units(p.depth, NULL, NULL));
case RUNTIME:
@@ -656,7 +656,7 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
int po2 = 0;
QByteArray gasv = value.toByteArray();
if (validate_po2(gasv.data(), &po2))
- p.po2 = po2;
+ p.setpoint = po2;
} break;
case GAS:
QByteArray gasv = value.toByteArray();
@@ -911,7 +911,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, gasmix *gas_in,
milimeters = t.depth;
seconds = t.time + 600; // 10 minutes.
gas = t.gasmix;
- ccpoint = t.po2;
+ ccpoint = t.setpoint;
} else if (seconds == 0 && milimeters == 0 && row == 0) {
milimeters = M_OR_FT(5, 15); // 5m / 15ft
seconds = 600; // 10 min
@@ -959,7 +959,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, gasmix *gas_in,
point.depth = milimeters;
point.time = seconds;
point.gasmix = gas;
- point.po2 = ccpoint;
+ point.setpoint = ccpoint;
point.entered = entered;
point.next = NULL;
divepoints.append(point);
@@ -1119,11 +1119,11 @@ void DivePlannerPointsModel::createTemporaryPlan()
lastIndex = i;
if (i == 0 && prefs.drop_stone_mode) {
/* Okay, we add a fist segment where we go down to depth */
- plan_add_segment(&diveplan, p.depth / prefs.descrate, p.depth, p.gasmix, p.po2, false);
+ plan_add_segment(&diveplan, p.depth / prefs.descrate, p.depth, p.gasmix, p.setpoint, true);
deltaT -= p.depth / prefs.descrate;
}
if (p.entered)
- plan_add_segment(&diveplan, deltaT, p.depth, p.gasmix, p.po2, true);
+ plan_add_segment(&diveplan, deltaT, p.depth, p.gasmix, p.setpoint, true);
}
// what does the cache do???
@@ -1134,8 +1134,8 @@ void DivePlannerPointsModel::createTemporaryPlan()
if (cyl->depth.mm) {
dp = create_dp(0, cyl->depth.mm, cyl->gasmix, 0);
if (diveplan.dp) {
- dp->next = diveplan.dp->next;
- diveplan.dp->next = dp;
+ dp->next = diveplan.dp;
+ diveplan.dp = dp;
} else {
dp->next = NULL;
diveplan.dp = dp;