diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-03-12 16:49:42 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-31 22:01:05 -0700 |
commit | 30bdfc8160100a296af7115a1f1dff5e4eeb710c (patch) | |
tree | 0a2f784132bdb747906a624b57acc247017efe0c /qt-ui | |
parent | 7902af246c5fa2091caf8fd49e592d12b6e26daa (diff) | |
download | subsurface-30bdfc8160100a296af7115a1f1dff5e4eeb710c.tar.gz |
Distinguish between entered and calculated waypoints
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.cpp | 22 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 2 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 2 |
3 files changed, 16 insertions, 10 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index c5715f9df..03b1a2043 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -392,16 +392,16 @@ void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent *event) int minutes = rint(timeLine->valueAt(mappedPos)); int milimeters = rint(depthLine->valueAt(mappedPos) / M_OR_FT(1, 1)) * M_OR_FT(1, 1); - plannerModel->addStop(milimeters, minutes * 60, -1, 0, 0); + plannerModel->addStop(milimeters, minutes * 60, -1, 0, 0, true); } void DivePlannerPointsModel::createSimpleDive() { // plannerModel->addStop(0, 0, O2_IN_AIR, 0, 0); - plannerModel->addStop(M_OR_FT(15, 45), 1 * 60, O2_IN_AIR, 0, 0); - plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, O2_IN_AIR, 0, 0); - plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, O2_IN_AIR, 0, 0); - plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, O2_IN_AIR, 0, 0); + plannerModel->addStop(M_OR_FT(15, 45), 1 * 60, O2_IN_AIR, 0, 0, true); + plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, O2_IN_AIR, 0, 0, true); + plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, O2_IN_AIR, 0, 0, true); + plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, O2_IN_AIR, 0, 0, true); } void DivePlannerPointsModel::loadFromDive(dive *d) @@ -422,7 +422,7 @@ void DivePlannerPointsModel::loadFromDive(dive *d) if (s.time.seconds == 0) continue; get_gas_from_events(&backupDive.dc, lasttime, &o2, &he); - plannerModel->addStop(s.depth.mm, s.time.seconds, o2, he, 0); + plannerModel->addStop(s.depth.mm, s.time.seconds, o2, he, 0, true); lasttime = s.time.seconds; } } @@ -521,12 +521,16 @@ void DivePlannerGraphics::drawProfile() item->setPen(QPen(QBrush(Qt::red), 0)); scene()->addItem(item); lines << item; + if (dp->depth) + qDebug() << "Time: " << dp->time / 60 << " depth: " << dp->depth / 1000; } lastx = xpos; lasty = ypos; poly.append(QPointF(lastx, lasty)); } + qDebug() << " "; + diveBg->setPolygon(poly); QRectF b = poly.boundingRect(); QLinearGradient pat( @@ -1186,7 +1190,7 @@ bool DivePlannerPointsModel::addGas(int o2, int he) return false; } -int DivePlannerPointsModel::addStop(int milimeters, int seconds, int o2, int he, int ccpoint) +int DivePlannerPointsModel::addStop(int milimeters, int seconds, int o2, int he, int ccpoint, bool entered) { int row = divepoints.count(); if (seconds == 0 && milimeters == 0 && row != 0) { @@ -1253,6 +1257,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int o2, int he, point.o2 = o2; point.he = he; point.po2 = ccpoint; + point.entered = entered; divepoints.append(point); std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan); endInsertRows(); @@ -1410,7 +1415,8 @@ void DivePlannerPointsModel::createTemporaryPlan() divedatapoint p = at(i); int deltaT = lastIndex != -1 ? p.time - at(lastIndex).time : p.time; lastIndex = i; - plan_add_segment(&diveplan, deltaT, p.depth, p.o2, p.he, p.po2); + p.entered = true; + plan_add_segment(&diveplan, deltaT, p.depth, p.o2, p.he, p.po2, true); } char *cache = NULL; tempDive = NULL; diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index 4679d0660..1393d9f78 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -57,7 +57,7 @@ public: public slots: - int addStop(int millimeters = 0, int seconds = 0, int o2 = 0, int he = 0, int ccpoint = 0); + int addStop(int millimeters = 0, int seconds = 0, int o2 = 0, int he = 0, int ccpoint = 0, bool entered = true); void addCylinder_clicked(); void setGFHigh(const int gfhigh); void setGFLow(const int ghflow); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 4d4d0baa2..a6a6c14cf 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -78,7 +78,7 @@ MainWindow::MainWindow() : QMainWindow(), ui.divePlannerWidget->settingsChanged(); #ifndef ENABLE_PLANNER - ui.menuLog->removeAction(ui.actionDivePlanner); +// ui.menuLog->removeAction(ui.actionDivePlanner); #endif } |