aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-16 18:39:13 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-17 06:18:25 +0700
commit58aeb6ce4014899e040a3ef8f4483f18fb44b432 (patch)
tree9e81e0fded3a1038ffa089e7b1bd49429d529df6 /qt-ui/profile/profilewidget2.cpp
parent254beef5d4c0ead123556ffbc5e37dd2cc81366e (diff)
downloadsubsurface-58aeb6ce4014899e040a3ef8f4483f18fb44b432.tar.gz
Added the Temperature Graph.
Added the Temperature Graph with its related classes. A Temperature Axis is also created so the item is plotted on the right place. Currently the Temperature Axis is just like the depth axis - top is zero, wich means that the graph is inverted. Also, the Temperature axis is being displayed as this helps debugging. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r--qt-ui/profile/profilewidget2.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index a3db75d4c..2276c1aa8 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -13,7 +13,7 @@
#include <QPropertyAnimation>
#include <QMenu>
#include <QContextMenuEvent>
-
+#include <QDebug>
#ifndef QT_NO_DEBUG
#include <QTableView>
@@ -27,6 +27,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
stateMachine(new QStateMachine(this)),
background (new DivePixmapItem()),
profileYAxis(new DepthAxis()),
+ temperatureAxis(new TemperatureAxis()),
gasYAxis(new DiveCartesianAxis()),
timeAxis(new TimeAxis()),
depthController(new DiveRectItem()),
@@ -60,6 +61,13 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
profileYAxis->setX(2);
profileYAxis->setTickSize(1);
gasYAxis->setLine(0, 0, 0, 20);
+
+ temperatureAxis->setOrientation(Qt::Vertical);
+ temperatureAxis->setLine(0, 60, 0, 90);
+ temperatureAxis->setX(3);
+ temperatureAxis->setTickSize(2);
+ temperatureAxis->setTickInterval(300);
+
timeAxis->setLine(0,0,96,0);
timeAxis->setX(3);
timeAxis->setTickSize(1);
@@ -73,7 +81,7 @@ 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;
+ timeAxis << depthController << timeController << temperatureAxis;
Q_FOREACH(QGraphicsItem *item, stateItems) {
scene()->addItem(item);
}
@@ -268,6 +276,9 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
// each item, I'll mostly like to fix this in the future, but I'll keep at this for now.
profileYAxis->setMaximum(qMax<long>(pInfo.maxdepth + M_OR_FT(10,30), maxdepth * 2 / 3));
profileYAxis->updateTicks();
+ temperatureAxis->setMinimum(pInfo.mintemp);
+ temperatureAxis->setMaximum(pInfo.maxtemp);
+ temperatureAxis->updateTicks();
timeAxis->setMaximum(maxtime);
timeAxis->updateTicks();
dataModel->setDive(current_dive, pInfo);
@@ -299,6 +310,20 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
eventItems.push_back(item);
event = event->next;
}
+
+ if(temperatureItem){
+ scene()->removeItem(temperatureItem);
+ delete temperatureItem;
+ }
+ temperatureItem = new DiveTemperatureItem();
+ temperatureItem->setHorizontalAxis(timeAxis);
+ temperatureItem->setVerticalAxis(temperatureAxis);
+ temperatureItem->setModel(dataModel);
+ temperatureItem->setVerticalDataColumn(DivePlotDataModel::TEMPERATURE);
+ temperatureItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
+ scene()->addItem(temperatureItem);
+
+
emit startProfileState();
}