summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-18 14:38:21 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-18 14:38:21 -0800
commit3bbc4ecd0bce0995d0d616b068a9e3adc21b3da3 (patch)
treedb33eb6420912785c4105f6b8f9acb0d673d21d4 /qt-ui
parent733108b47385c68e163baebc10ff29c145d3685f (diff)
downloadsubsurface-3bbc4ecd0bce0995d0d616b068a9e3adc21b3da3.tar.gz
Add mean depth to new profile
With massive hand-holding by Tomaz. Writing for the new profile code is slightly different. You don't draw anything, you just tell the widget where things are supposed to end up and how they are supposed to look. Really nice. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/profilewidget2.cpp12
-rw-r--r--qt-ui/profile/profilewidget2.h6
2 files changed, 13 insertions, 5 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 09f41bdc9..bb14cf28b 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -36,7 +36,8 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
cylinderPressureAxis(new DiveCartesianAxis()),
temperatureItem(NULL),
gasPressureItem(NULL),
- cartesianPlane(new DiveCartesianPlane())
+ cartesianPlane(new DiveCartesianPlane()),
+ meanDepth(new DiveLineItem())
{
setScene(new QGraphicsScene());
scene()->setSceneRect(0, 0, 100, 100);
@@ -83,6 +84,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
depthController->setRect(0, 0, 10, 5);
timeController->setRect(0, 0, 10, 5);
timeController->setX(sceneRect().width() - timeController->boundingRect().width()); // Position it on the right spot.
+ meanDepth->setLine(0,0,96,0);
+ meanDepth->setX(3);
+ meanDepth->setPen(QPen(QBrush(Qt::red), 0, Qt::SolidLine));
cartesianPlane->setBottomAxis(timeAxis);
cartesianPlane->setLeftAxis(profileYAxis);
@@ -90,7 +94,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
// insert in the same way it's declared on the Enum. This is needed so we don't use an map.
QList<QGraphicsItem*> stateItems; stateItems << background << profileYAxis << gasYAxis <<
- timeAxis << depthController << timeController << temperatureAxis << cylinderPressureAxis;
+ timeAxis << depthController << timeController <<
+ temperatureAxis << cylinderPressureAxis <<
+ meanDepth;
Q_FOREACH(QGraphicsItem *item, stateItems) {
scene()->addItem(item);
}
@@ -294,7 +300,7 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
cylinderPressureAxis->setMinimum(pInfo.minpressure);
cylinderPressureAxis->setMaximum(pInfo.maxpressure);
cylinderPressureAxis->updateTicks();
-
+ meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth));
dataModel->setDive(current_dive, pInfo);
if (diveProfileItem) {
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 5f988651d..7f6d77319 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -14,6 +14,7 @@
// * It needs to be dynamic, things should *flow* on it, not just appear / disappear.
// */
#include "graphicsview-common.h"
+#include "divelineitem.h"
class TemperatureAxis;
class DiveEventItem;
@@ -33,7 +34,7 @@ struct DiveGasPressureItem;
class ProfileWidget2 : public QGraphicsView {
Q_OBJECT
- void fixBackgroundPos();
+ void fixBackgroundPos();
public:
enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
enum Items{BACKGROUND, PROFILE_Y_AXIS, GAS_Y_AXIS, TIME_AXIS, DEPTH_CONTROLLER, TIME_CONTROLLER, COLUMNS};
@@ -78,7 +79,8 @@ private:
DiveTemperatureItem *temperatureItem;
DiveCartesianAxis *cylinderPressureAxis;
DiveGasPressureItem *gasPressureItem;
+ DiveLineItem *meanDepth;
QList<DiveEventItem*> eventItems;
};
-#endif \ No newline at end of file
+#endif