From 3e239c7e3e8eac0911f8b3ccc67db032e8e56297 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 30 Dec 2014 21:25:23 -0200 Subject: Add the instantMeanDepth on Scene But nothing is hoocked yet. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 12 ++++++++++++ qt-ui/profile/profilewidget2.h | 1 + 2 files changed, 13 insertions(+) diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index ba71a9fba..12b04f4bc 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -102,6 +102,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent), mouseFollowerHorizontal(new DiveLineItem()), rulerItem(new RulerItem2()), tankItem(new TankItem()), + instantMeanDepth(new InstantMeanDepthLine()), isGrayscale(false), printMode(false), shouldCalculateMaxTime(true), @@ -170,6 +171,7 @@ ProfileWidget2::~ProfileWidget2() delete mouseFollowerHorizontal; delete rulerItem; delete tankItem; + delete instantMeanDepth; } #define SUBSURFACE_OBJ_DATA 1 @@ -208,6 +210,7 @@ void ProfileWidget2::addItemsToScene() scene()->addItem(tankItem); scene()->addItem(mouseFollowerHorizontal); scene()->addItem(mouseFollowerVertical); + scene()->addItem(instantMeanDepth); QPen pen(QColor(Qt::red).lighter()); pen.setWidth(0); mouseFollowerHorizontal->setPen(pen); @@ -273,6 +276,12 @@ void ProfileWidget2::setupItemOnScene() meanDepth->setZValue(1); meanDepth->setAxis(profileYAxis); + instantMeanDepth->setLine(0, 0, 96, 0); + instantMeanDepth->setX(3); + instantMeanDepth->setPen(QPen(QBrush(Qt::red), 0, Qt::SolidLine)); + instantMeanDepth->setZValue(1); + instantMeanDepth->setAxis(profileYAxis); + diveComputerText->setAlignment(Qt::AlignRight | Qt::AlignTop); diveComputerText->setBrush(getColor(TIME_TEXT, isGrayscale)); @@ -597,6 +606,9 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) meanDepth->setLine(0, 0, timeAxis->posAtValue(currentdc->duration.seconds), 0); Animations::moveTo(meanDepth,3, profileYAxis->posAtValue(plotInfo.meandepth)); + instantMeanDepth->setVisible(prefs.show_average_depth); + instantMeanDepth->setModel(dataModel); + dataModel->emitDataChanged(); // The event items are a bit special since we don't know how many events are going to // exist on a dive, so I cant create cache items for that. that's why they are here diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h index 5a612d983..f35d07186 100644 --- a/qt-ui/profile/profilewidget2.h +++ b/qt-ui/profile/profilewidget2.h @@ -179,6 +179,7 @@ private: DiveLineItem *mouseFollowerHorizontal; RulerItem2 *rulerItem; TankItem *tankItem; + InstantMeanDepthLine *instantMeanDepth; bool isGrayscale; bool printMode; -- cgit v1.2.3-70-g09d2