From bdac8283728bfd8a95393363e0b316ea9aa85527 Mon Sep 17 00:00:00 2001
From: Joakim Bygdell <j.bygdell@gmail.com>
Date: Sat, 17 Jan 2015 19:54:10 +0100
Subject: [PATCH] Move the heart rate graph. Move the heart rate graph down to
 the sam space as the tissue saturation graph so that it does not overlap with
 temperature or partial pressures.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
---
 qt-ui/profile/profilewidget2.cpp | 60 +++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 516b14c..a390ae6 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -55,7 +55,7 @@ static struct _ItemPos {
 	_Axis temperature;
 	_Axis temperatureAll;
 	_Axis heartBeat;
-	_Axis heartBeatAll;
+	_Axis heartBeatWithTankBar;
 } itemPos;
 
 ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
@@ -396,13 +396,11 @@ void ProfileWidget2::setupItemSizes()
 
 	// Heartbeat axis config
 	itemPos.heartBeat.pos.on.setX(3);
-	itemPos.heartBeat.pos.on.setY(65);
+	itemPos.heartBeat.pos.on.setY(82);
 	itemPos.heartBeat.expanded.setP1(QPointF(0, 0));
 	itemPos.heartBeat.expanded.setP2(QPointF(0, 10));
-	itemPos.heartBeatAll = itemPos.heartBeat;
-	itemPos.heartBeatAll.pos.on.setX(3);
-	itemPos.heartBeatAll.pos.on.setY(55);
-	itemPos.heartBeatAll.expanded.setP2(QPointF(0, 7));
+	itemPos.heartBeatWithTankBar = itemPos.heartBeat;
+	itemPos.heartBeatWithTankBar.expanded.setP2(QPointF(0, 7));
 
 	// Percentage axis config
 	itemPos.percentage.pos.on.setX(3);
@@ -635,7 +633,7 @@ void ProfileWidget2::settingsChanged()
 	// if we are showing calculated ceilings then we have to replot()
 	// because the GF could have changed; otherwise we try to avoid replot()
 	bool needReplot = prefs.calcceiling;
-	if (prefs.percentagegraph && PP_GRAPHS_ENABLED) {
+	if ((prefs.percentagegraph||prefs.hrgraph) && PP_GRAPHS_ENABLED) {
 		profileYAxis->animateChangeLine(itemPos.depth.shrinked);
 		temperatureAxis->setPos(itemPos.temperatureAll.pos.on);
 		temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
@@ -644,37 +642,36 @@ void ProfileWidget2::settingsChanged()
 		if (prefs.tankbar) {
 			percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
 			percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
-		} else {
+			heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
+		}else {
 			percentageAxis->setPos(itemPos.percentage.pos.on);
-			percentageAxis->setLine(itemPos.percentage.expanded);
+			percentageAxis->animateChangeLine(itemPos.percentage.expanded);
+			heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
 		}
 		gasYAxis->setPos(itemPos.partialPressureTissue.pos.on);
 		gasYAxis->animateChangeLine(itemPos.partialPressureTissue.expanded);
-		if (prefs.hrgraph) {
-			heartBeatAxis->setPos(itemPos.heartBeatAll.pos.on);
-			heartBeatAxis->setLine(itemPos.heartBeatAll.expanded);
-		}
+
 	} else if (PP_GRAPHS_ENABLED || prefs.hrgraph || prefs.percentagegraph) {
 		profileYAxis->animateChangeLine(itemPos.depth.intermediate);
 		temperatureAxis->setPos(itemPos.temperature.pos.on);
 		temperatureAxis->animateChangeLine(itemPos.temperature.intermediate);
 		cylinderPressureAxis->animateChangeLine(itemPos.cylinder.intermediate);
-		gasYAxis->setPos(itemPos.partialPressure.pos.on);
-		gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
-		percentageAxis->setPos(itemPos.percentage.pos.on);
-		percentageAxis->setLine(itemPos.percentage.expanded);
-		heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
-		heartBeatAxis->setLine(itemPos.heartBeat.expanded);
 		if (prefs.tankbar) {
 			percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
 			percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
 			gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
 			gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded);
+			heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
 		} else {
 			gasYAxis->setPos(itemPos.partialPressure.pos.on);
 			gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
 			percentageAxis->setPos(itemPos.percentage.pos.on);
 			percentageAxis->setLine(itemPos.percentage.expanded);
+			heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
 		}
 	} else {
 		profileYAxis->animateChangeLine(itemPos.depth.expanded);
@@ -907,7 +904,7 @@ void ProfileWidget2::setProfileState()
 	cylinderPressureAxis->setVisible(true);
 
 	profileYAxis->setPos(itemPos.depth.pos.on);
-	if (prefs.percentagegraph && PP_GRAPHS_ENABLED) {
+	if ((prefs.percentagegraph||prefs.hrgraph) && PP_GRAPHS_ENABLED) {
 		profileYAxis->animateChangeLine(itemPos.depth.shrinked);
 		temperatureAxis->setPos(itemPos.temperatureAll.pos.on);
 		temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
@@ -916,37 +913,36 @@ void ProfileWidget2::setProfileState()
 		if (prefs.tankbar) {
 			percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
 			percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
-		} else {
+			heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
+		}else {
 			percentageAxis->setPos(itemPos.percentage.pos.on);
-			percentageAxis->setLine(itemPos.percentage.expanded);
+			percentageAxis->animateChangeLine(itemPos.percentage.expanded);
+			heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
 		}
 		gasYAxis->setPos(itemPos.partialPressureTissue.pos.on);
 		gasYAxis->animateChangeLine(itemPos.partialPressureTissue.expanded);
-		if (prefs.hrgraph) {
-			heartBeatAxis->setPos(itemPos.heartBeatAll.pos.on);
-			heartBeatAxis->setLine(itemPos.heartBeatAll.expanded);
-		}
+
 	} else if (PP_GRAPHS_ENABLED || prefs.hrgraph || prefs.percentagegraph) {
 		profileYAxis->animateChangeLine(itemPos.depth.intermediate);
 		temperatureAxis->setPos(itemPos.temperature.pos.on);
 		temperatureAxis->animateChangeLine(itemPos.temperature.intermediate);
 		cylinderPressureAxis->animateChangeLine(itemPos.cylinder.intermediate);
-		gasYAxis->setPos(itemPos.partialPressure.pos.on);
-		gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
-		percentageAxis->setPos(itemPos.percentage.pos.on);
-		percentageAxis->setLine(itemPos.percentage.expanded);
-		heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
-		heartBeatAxis->setLine(itemPos.heartBeat.expanded);
 		if (prefs.tankbar) {
 			percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
 			percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
 			gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
 			gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded);
+			heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
 		} else {
 			gasYAxis->setPos(itemPos.partialPressure.pos.on);
 			gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
 			percentageAxis->setPos(itemPos.percentage.pos.on);
 			percentageAxis->setLine(itemPos.percentage.expanded);
+			heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
+			heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
 		}
 	} else {
 		profileYAxis->animateChangeLine(itemPos.depth.expanded);
-- 
1.9.3 (Apple Git-50)

