diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-06-10 19:35:22 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-10 21:00:30 -0700 |
commit | 72d0030509c4a335c263bed0151cf5366cf807ac (patch) | |
tree | 41382e410e5eeec80003d00559cffa5c254a638a /qt-ui | |
parent | 939246acda95807bca2ed5ce536a0aae2ea8586c (diff) | |
download | subsurface-72d0030509c4a335c263bed0151cf5366cf807ac.tar.gz |
Added a slot to set the full time of the dive plan
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profilegraphics.cpp | 24 | ||||
-rw-r--r-- | qt-ui/profilegraphics.h | 1 |
2 files changed, 16 insertions, 9 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 852a83fe6..11249d831 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -335,13 +335,6 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) // The Time ruler should be right after the DiveComputer: timeMarkers->setPos(0, diveComputer->y()); - if(mode == PLAN){ - timeEditor = new GraphicsTextEditor(); - timeEditor->setPlainText(" Set Duration: 10 minutes"); - timeEditor->setPos(profile_grid_area.width() + timeMarkers->boundingRect().width(), timeMarkers->y()); - timeEditor->document(); - scene()->addItem(timeEditor); - } if (PP_GRAPHS_ENABLED) { plot_pp_gas_profile(); plot_pp_text(); @@ -371,6 +364,15 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) fitInView(sceneRect()); } toolTip->readPos(); + + if(mode == PLAN){ + timeEditor = new GraphicsTextEditor(); + timeEditor->setPlainText( dive->duration.seconds ? QString::number(dive->duration.seconds/60) : tr("Set Duration: 10 minutes")); + timeEditor->setPos(profile_grid_area.width() - timeEditor->boundingRect().width(), timeMarkers->y()); + timeEditor->document(); + connect(timeEditor, SIGNAL(editingFinished(QString)), this, SLOT(edit_dive_time(QString))); + scene()->addItem(timeEditor); + } } void ProfileGraphicsView::plot_depth_scale() @@ -1218,6 +1220,12 @@ void ProfileGraphicsView::plot_temperature_profile() } } +void ProfileGraphicsView::edit_dive_time(const QString& time) +{ + // this should set the full time of the dive. + refresh(); +} + void ToolTipItem::addToolTip(const QString& toolTip, const QIcon& icon) { QGraphicsPixmapItem *iconItem = 0; @@ -1490,12 +1498,10 @@ EventItem::EventItem(QGraphicsItem* parent): QGraphicsPolygonItem(parent) QGraphicsEllipseItem *ball = new QGraphicsEllipseItem(-1, 12, 2,2, this); ball->setBrush(QBrush(Qt::black)); - } GraphicsTextEditor::GraphicsTextEditor(QGraphicsItem* parent): QGraphicsTextItem(parent) { - } void GraphicsTextEditor::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index c0326ccfa..1722e2cc3 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -100,6 +100,7 @@ protected: public Q_SLOTS: void refresh(); + void edit_dive_time(const QString& time); private: void plot_depth_profile(); |