diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-03-10 13:37:54 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-11 08:03:25 -0800 |
commit | eae4bd82a5e3009ef555771cb77e9289d2a0f585 (patch) | |
tree | 7cd071b080b673ba46f83bcd2deca8a2ac21945e /qt-models | |
parent | 295b1b78d888b528f7a5a23411b1a82d4b39eed1 (diff) | |
download | subsurface-eae4bd82a5e3009ef555771cb77e9289d2a0f585.tar.gz |
Change type of divedatepoint.depth to depth_t
... for consistency, while we are at it.
There are still some internal depth variables which are ints
somebody might take a go at those.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/diveplannermodel.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 0327a6f6f..c858fd6f1 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -159,8 +159,8 @@ bool DivePlannerPointsModel::updateMaxDepth() displayed_dive.maxdepth.mm = 0; for (int i = 0; i < rowCount(); i++) { divedatapoint p = at(i); - if (p.depth > displayed_dive.maxdepth.mm) - displayed_dive.maxdepth.mm = p.depth; + if (p.depth.mm > displayed_dive.maxdepth.mm) + displayed_dive.maxdepth.mm = p.depth.mm; } return (displayed_dive.maxdepth.mm != prevMaxDepth); } @@ -241,7 +241,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const case CCSETPOINT: return (double)p.setpoint / 1000; case DEPTH: - return (int) rint(get_depth_units(p.depth, NULL, NULL)); + return (int) rint(get_depth_units(p.depth.mm, NULL, NULL)); case RUNTIME: return p.time / 60; case DURATION: @@ -288,7 +288,7 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v switch (index.column()) { case DEPTH: if (value.toInt() >= 0) { - p.depth = units_to_depth(value.toInt()).mm; + p.depth = units_to_depth(value.toInt()); if (updateMaxDepth()) CylindersModel::instance()->updateBestMixes(); } @@ -556,7 +556,7 @@ void DivePlannerPointsModel::setDropStoneMode(bool value) beginInsertRows(QModelIndex(), 0, 0); /* Copy the first current point */ divedatapoint p = divepoints.at(0); - p.time = p.depth / prefs.descrate; + p.time = p.depth.mm / prefs.descrate; divepoints.push_front(p); endInsertRows(); } @@ -623,7 +623,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_ if (seconds == 0 && milimeters == 0 && row != 0) { /* this is only possible if the user clicked on the 'plus' sign on the DivePoints Table */ const divedatapoint t = divepoints.at(lastEnteredPoint()); - milimeters = t.depth; + milimeters = t.depth.mm; seconds = t.time + 600; // 10 minutes. cylinderid = t.cylinderid; ccpoint = t.setpoint; @@ -662,7 +662,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_ // add the new stop beginInsertRows(QModelIndex(), row, row); divedatapoint point; - point.depth = milimeters; + point.depth.mm = milimeters; point.time = seconds; point.cylinderid = cylinderid; point.setpoint = ccpoint; @@ -807,11 +807,11 @@ void DivePlannerPointsModel::createTemporaryPlan() lastIndex = i; if (i == 0 && mode == PLAN && prefs.drop_stone_mode) { /* Okay, we add a first segment where we go down to depth */ - plan_add_segment(&diveplan, p.depth / prefs.descrate, p.depth, p.cylinderid, p.setpoint, true); - deltaT -= p.depth / prefs.descrate; + plan_add_segment(&diveplan, p.depth.mm / prefs.descrate, p.depth.mm, p.cylinderid, p.setpoint, true); + deltaT -= p.depth.mm / prefs.descrate; } if (p.entered) - plan_add_segment(&diveplan, deltaT, p.depth, p.cylinderid, p.setpoint, true); + plan_add_segment(&diveplan, deltaT, p.depth.mm, p.cylinderid, p.setpoint, true); } // what does the cache do??? |