diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-06-27 20:54:17 +0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-27 20:54:17 +0800 |
commit | 3fa3f55163cefa7f94c8f59d98d6e71ac672892e (patch) | |
tree | a579a9441de4188ec6c77db02d4eb25a4e303adf /qt-ui/diveplanner.cpp | |
parent | 8eb2dc3d65f2364379e82deac8f91d3a8f380015 (diff) | |
download | subsurface-3fa3f55163cefa7f94c8f59d98d6e71ac672892e.tar.gz |
Remove incorrect logic for first line in planner
This greatly simplifies the code.
Similar to (but not based on) code submitted by Robert Helling.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 182a75226..667bda5bd 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -146,32 +146,13 @@ void DivePlannerGraphics::createDecoStops() h->setPos(timeLine->posAtValue(h->sec / 60), depthLine->posAtValue(h->mm) / 1000); } - // Create all 'user entered' lines, and put it on the canvas. - double xpos = timeLine->posAtValue(0); - double ypos = depthLine->posAtValue(0); - QGraphicsLineItem *first = new QGraphicsLineItem(xpos,ypos, handles.first()->x(), handles.first()->y()); - handles.first()->from = first; - scene()->addItem(first); - lines.push_back(first); - -// -// for(int i = 0; i < handles.count()-1; i++){ -// DiveHandler *first = handles.at(i); -// DiveHandler *second = handles.at(i+1); -// QGraphicsLineItem *line = new QGraphicsLineItem(first->x(),first->y(), second->x(), second->y()); -// first->from = line; -// second->to = line; -// scene()->addItem(line); -// lines.push_back(line); -// } - - // Create all 'deco' GraphicsLineItems and put it on the canvas. - double lastx = handles.first()->x(); - double lasty = handles.first()->y(); + // (re-) create the profile with different colors for segments that were + // entered vs. segments that were calculated + double lastx = timeLine->posAtValue(0); + double lasty = depthLine->posAtValue(0); for (dp = diveplan.dp; dp != NULL; dp = dp->next) { double xpos = timeLine->posAtValue(dp->time / 60.0); double ypos = depthLine->posAtValue(dp->depth / 1000.0); - qDebug("Not entered: time/depth %f/%f", dp->time / 60.0, dp->depth / 1000.0); QGraphicsLineItem *item = new QGraphicsLineItem(lastx, lasty, xpos, ypos); item->setPen(QPen(QBrush(dp->entered ? Qt::black : Qt::red),0)); lastx = xpos; |