good new polishments for the new profile.
hiding / enabling PP graph now is smoother, animated and fun. ;p
From 7e42c62b2b485add9cb3b76c62ae7e652e3644f4 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tcanabr...@kde.org>
Date: Wed, 12 Feb 2014 14:41:59 -0200
Subject: [PATCH 5/5] Make the Mean Depth line follow the size of the Axis.

When we move, shrink or expand the Depth Axis, the
meandepth should also change it's position. this
patch adds that.

Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org>
---
 qt-ui/profile/diveprofileitem.cpp | 13 +++++++++++++
 qt-ui/profile/diveprofileitem.h   |  4 ++++
 qt-ui/profile/profilewidget2.cpp  |  1 +
 3 files changed, 18 insertions(+)

diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index f8a37ae..899388d 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -534,6 +534,19 @@ void MeanDepthLine::setMeanDepth(int value)
 {
 	leftText->setText(get_depth_string(value, false, false));
 	rightText->setText(get_depth_string(value, false, false));
+	meanDepth = value;
+}
+
+void MeanDepthLine::setAxis(DiveCartesianAxis* a)
+{
+	connect(a, SIGNAL(sizeChanged()), this, SLOT(axisLineChanged()));
+}
+
+void MeanDepthLine::axisLineChanged()
+{
+	DiveCartesianAxis *axis = qobject_cast<DiveCartesianAxis*>(sender());
+	animateMoveTo(x(),axis->posAtValue(meanDepth));
+	qDebug() << "chamou....";
 }
 
 void PartialPressureGasItem::modelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h
index 640b0d4..b519581 100644
--- a/qt-ui/profile/diveprofileitem.h
+++ b/qt-ui/profile/diveprofileitem.h
@@ -135,10 +135,14 @@ public:
 	MeanDepthLine();
 	void setMeanDepth(int value);
 	void setLine(qreal x1, qreal y1, qreal x2, qreal y2);
+	void setAxis(DiveCartesianAxis *a);
+public slots:
+	void axisLineChanged();
 private:
 	int meanDepth;
 	DiveTextItem *leftText;
 	DiveTextItem *rightText;
+	DiveCartesianAxis *axis;
 };
 
 class PartialPressureGasItem : public AbstractProfilePolygonItem{
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index ccbc4f6..cfe8e7f 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -145,6 +145,7 @@ void ProfileWidget2::setupItemOnScene()
 	meanDepth->setX(3);
 	meanDepth->setPen(QPen(QBrush(Qt::red), 0, Qt::SolidLine));
 	meanDepth->setZValue(1);
+	meanDepth->setAxis(profileYAxis);
 
 	cartesianPlane->setBottomAxis(timeAxis);
 	cartesianPlane->setLeftAxis(profileYAxis);
-- 
1.8.5.4

From a860b2553bc84a9017e30ee3d89920caded0eb3a Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tcanabr...@kde.org>
Date: Wed, 12 Feb 2014 14:24:19 -0200
Subject: [PATCH 4/5] Hide the extra axis labels on release mode, show on debug
 mode.

The extra axis labels on the Temperature and Cylinder Pressure
graphs are uneeded on release mode as they create a lot of visual
clutter, but it's userful to have on debug mode since we can then
better understand what went wrong.

Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org>
---
 qt-ui/profile/divecartesianaxis.cpp | 18 +++++++++++++++++-
 qt-ui/profile/divecartesianaxis.h   |  3 +++
 qt-ui/profile/profilewidget2.cpp    |  8 ++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index 3fdafa3..6eb7321 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -67,7 +67,8 @@ DiveCartesianAxis::DiveCartesianAxis() : QObject(),
 	min(0),
 	max(0),
 	interval(1),
-	tick_size(0)
+	tick_size(0),
+	textVisibility(true)
 {
 	setPen(gridPen());
 }
@@ -87,6 +88,17 @@ QColor DiveCartesianAxis::colorForValue(double value)
 	return QColor(Qt::black);
 }
 
+void DiveCartesianAxis::setTextVisible(bool arg1)
+{
+	if(textVisibility == arg1){
+		return;
+	}
+	textVisibility = arg1;
+	Q_FOREACH(DiveTextItem *item, labels){
+		item->setVisible(textVisibility);
+	}
+}
+
 void DiveCartesianAxis::updateTicks()
 {
 	if (!scene())
@@ -163,6 +175,10 @@ void DiveCartesianAxis::updateTicks()
 			label->animateMoveTo(m.x1() - tick_size, childPos);
 		}
 	}
+
+	Q_FOREACH(DiveTextItem *item, labels){
+		item->setVisible(textVisibility);
+	}
 }
 
 void DiveCartesianAxis::animateChangeLine(const QLineF& newLine)
diff --git a/qt-ui/profile/divecartesianaxis.h b/qt-ui/profile/divecartesianaxis.h
index 2327a32..d9b9e0b 100644
--- a/qt-ui/profile/divecartesianaxis.h
+++ b/qt-ui/profile/divecartesianaxis.h
@@ -35,9 +35,11 @@ public:
 	void setColor(const QColor& color);
 	void setTextColor(const QColor& color);
 	void animateChangeLine(const QLineF& newLine);
+	void setTextVisible(bool arg1);
 	int unitSystem;
 public slots:
 	virtual void updateTicks();
+
 signals:
 	void sizeChanged();
 	void maxChanged();
@@ -51,6 +53,7 @@ protected:
 	double interval;
 	double tick_size;
 	QColor textColor;
+	bool textVisibility;
 };
 
 class DepthAxis : public DiveCartesianAxis {
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 71fa651..ccbc4f6 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -176,6 +176,14 @@ void ProfileWidget2::setupItemOnScene()
 	CREATE_PP_GAS( po2GasItem, PO2, PO2, PO2_ALERT, "po2threshold", "po2graph");
 #undef CREATE_PP_GAS
 
+#ifdef QT_NO_DEBUG // Some debug helpers.
+	temperatureAxis->setTextVisible(false);
+	cylinderPressureAxis->setTextVisible(false);
+#else
+	temperatureAxis->setTextVisible(true);
+	cylinderPressureAxis->setTextVisible(true);
+#endif
+
 }
 
 void ProfileWidget2::setupItemSizes()
-- 
1.8.5.4

From 04580df4bb1b5c0e8e91e4b91f17fb8d2cc72643 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tcanabr...@kde.org>
Date: Wed, 12 Feb 2014 14:12:56 -0200
Subject: [PATCH 3/5] Added the Cylinder Pressure shrinkage on show/hide
 partial pressure.

Same as the last commit, but for Cylinder Pressure. Another bug
was spotted, where the Mean Depth line does not move to the correct
location after a axis-size-changed - fixing that on next commit.

Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org>
---
 qt-ui/profile/profilewidget2.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index e44895e..71fa651 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -225,6 +225,8 @@ void ProfileWidget2::setupItemSizes()
 	itemPos.cylinder.pos.off.setY(20);
 	itemPos.cylinder.expanded.setP1(QPointF(0,0));
 	itemPos.cylinder.expanded.setP2(QPointF(0,20));
+	itemPos.cylinder.shrinked.setP1(QPointF(0,0));
+	itemPos.cylinder.shrinked.setP2(QPointF(0,10));
 
 		// Temperature axis config
 	itemPos.temperature.pos.on.setX(3);
@@ -368,9 +370,11 @@ void ProfileWidget2::settingsChanged()
 	if(s.value("phegraph").toBool()|| s.value("po2graph").toBool()|| s.value("pn2graph").toBool()){
 		profileYAxis->animateChangeLine(itemPos.depth.shrinked);
 		temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
+		cylinderPressureAxis->animateChangeLine(itemPos.cylinder.shrinked);
 	}else{
 		profileYAxis->animateChangeLine(itemPos.depth.expanded);
 		temperatureAxis->animateChangeLine(itemPos.temperature.expanded);
+		cylinderPressureAxis->animateChangeLine(itemPos.cylinder.expanded);
 	}
 }
 
@@ -497,9 +501,11 @@ void ProfileWidget2::setProfileState()
 	if(s.value("phegraph").toBool()|| s.value("po2graph").toBool()|| s.value("pn2graph").toBool()){
 		profileYAxis->setLine(itemPos.depth.shrinked);
 		temperatureAxis->setLine(itemPos.temperature.shrinked);
+		cylinderPressureAxis->setLine(itemPos.cylinder.shrinked);
 	}else{
 		profileYAxis->setLine(itemPos.depth.expanded);
 		temperatureAxis->setLine(itemPos.temperature.expanded);
+		cylinderPressureAxis->setLine(itemPos.cylinder.expanded);
 	}
 
 	gasYAxis->setPos(itemPos.partialPressure.pos.on);
@@ -509,7 +515,7 @@ void ProfileWidget2::setProfileState()
 	timeAxis->setLine(itemPos.time.expanded);
 
 	cylinderPressureAxis->setPos(itemPos.cylinder.pos.on);
-	cylinderPressureAxis->setLine(itemPos.cylinder.expanded);
+
 
 	temperatureAxis->setPos(itemPos.temperature.pos.on);
 
-- 
1.8.5.4

From 945de59eeb018f5594a2bcc5f11b34740f8af651 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tcanabr...@kde.org>
Date: Wed, 12 Feb 2014 14:08:01 -0200
Subject: [PATCH 2/5] Shrink Temperature axis when partial pressures are shown.

This patch adds shrinkage of the Temperature axis when partial
pressures are shown. This adds a unwanted side effect however,
the axis started showing it's values - and we didn't do that on
the gtk version or on the old profile. While this is good for
debugging, it's not wanted for the software if it's on release
mode. I'll fix that in due time.

Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org>
---
 qt-ui/profile/profilewidget2.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index b0c9856..e44895e 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -233,6 +233,8 @@ void ProfileWidget2::setupItemSizes()
 	itemPos.temperature.pos.off.setY(40);
 	itemPos.temperature.expanded.setP1(QPointF(0,0));
 	itemPos.temperature.expanded.setP2(QPointF(0,20));
+	itemPos.temperature.shrinked.setP1(QPointF(0,0));
+	itemPos.temperature.shrinked.setP2(QPointF(0,10));
 
 	itemPos.dcLabel.on.setX(3);
 	itemPos.dcLabel.on.setY(97);
@@ -365,8 +367,10 @@ void ProfileWidget2::settingsChanged()
 	s.beginGroup("TecDetails");
 	if(s.value("phegraph").toBool()|| s.value("po2graph").toBool()|| s.value("pn2graph").toBool()){
 		profileYAxis->animateChangeLine(itemPos.depth.shrinked);
+		temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
 	}else{
 		profileYAxis->animateChangeLine(itemPos.depth.expanded);
+		temperatureAxis->animateChangeLine(itemPos.temperature.expanded);
 	}
 }
 
@@ -492,8 +496,10 @@ void ProfileWidget2::setProfileState()
 	s.beginGroup("TecDetails");
 	if(s.value("phegraph").toBool()|| s.value("po2graph").toBool()|| s.value("pn2graph").toBool()){
 		profileYAxis->setLine(itemPos.depth.shrinked);
+		temperatureAxis->setLine(itemPos.temperature.shrinked);
 	}else{
 		profileYAxis->setLine(itemPos.depth.expanded);
+		temperatureAxis->setLine(itemPos.temperature.expanded);
 	}
 
 	gasYAxis->setPos(itemPos.partialPressure.pos.on);
@@ -506,7 +512,6 @@ void ProfileWidget2::setProfileState()
 	cylinderPressureAxis->setLine(itemPos.cylinder.expanded);
 
 	temperatureAxis->setPos(itemPos.temperature.pos.on);
-	temperatureAxis->setLine(itemPos.temperature.expanded);
 
 	cartesianPlane->setVisible(true);
 	meanDepth->setVisible(true);
-- 
1.8.5.4

From c0f62bdc1553585b2d406640cc2fbad6708c1a7e Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tcanabr...@kde.org>
Date: Wed, 12 Feb 2014 13:50:35 -0200
Subject: [PATCH 1/5] Animate Transition between Show / Hide Partial Pressure
 Gas Grap

When the user checked the option to show or hide the partial
presure gas, the size of the Profile Graph was kept the same,
usually I do those changes on the objects themselves, on the
settingsChanged method, but since the Calculation of the
size of the profile was done on the ProfileView class for
consistency with the other objects, I had to change it there
too.

Signed-off-by: Tomaz Canabrava <tcanabr...@kde.org>
---
 qt-ui/profile/profilewidget2.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 33f7be4..b0c9856 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -22,6 +22,7 @@
 #include <QTableView>
 #endif
 #include "mainwindow.h"
+#include <preferences.h>
 
 /* This is the global 'Item position' variable.
  * it should tell you where to position things up
@@ -82,6 +83,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
 	addItemsToScene();
 	scene()->installEventFilter(this);
 	setEmptyState();
+	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
 
 #ifndef QT_NO_DEBUG
 	QTableView *diveDepthTableView = new QTableView();
@@ -359,6 +361,13 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
 
 void ProfileWidget2::settingsChanged()
 {
+	QSettings s;
+	s.beginGroup("TecDetails");
+	if(s.value("phegraph").toBool()|| s.value("po2graph").toBool()|| s.value("pn2graph").toBool()){
+		profileYAxis->animateChangeLine(itemPos.depth.shrinked);
+	}else{
+		profileYAxis->animateChangeLine(itemPos.depth.expanded);
+	}
 }
 
 void ProfileWidget2::resizeEvent(QResizeEvent* event)
-- 
1.8.5.4

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to