From 2f216b7f9c83d5d0de132527a0bd36b1e4ff7b3f Mon Sep 17 00:00:00 2001
From: Cristine Guadelupe <cristineguadelupe@me.com>
Date: Tue, 13 Jan 2015 02:03:49 -0200
Subject: [PATCH] Remove instantMeanDepthLine

Take instantMeanDepthLine out of the code because Dirk hates "things that move".

Signed-off-by: Cristine Guadelupe <cristineguadelupe@me.com>
---
 qt-ui/profile/diveprofileitem.cpp | 20 --------------------
 qt-ui/profile/diveprofileitem.h   | 11 -----------
 qt-ui/profile/profilewidget2.cpp  | 17 -----------------
 qt-ui/profile/profilewidget2.h    |  4 ----
 4 files changed, 52 deletions(-)

diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 60a030b..7531b2a 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -977,23 +977,3 @@ void PartialPressureGasItem::setColors(const QColor &normal, const QColor &alert
 	normalColor = normal;
 	alertColor = alert;
 }
-
-InstantMeanDepthLine::InstantMeanDepthLine() : hAxis(NULL), vAxis(NULL)
-{
-}
-
-void InstantMeanDepthLine::mouseMoved(int time, int depth)
-{
-	if (model == NULL || scene() == NULL || vAxis == NULL || hAxis == NULL)
-		return;
-
-	int count = model->data().nr;
-	for (int i = 0; i < count; i++) {
-		struct plot_data pI = model->data().entry[i];
-		if (pI.sec == time && pI.sec != 0) {
-			setMeanDepth(pI.running_sum / time);
-			setLine(0, 0, hAxis->posAtValue(time), 0);
-			setPos(pos().x(), vAxis->posAtValue(pI.running_sum / time));
-		}
-	}
-}
diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h
index b0693cd..096c1a3 100644
--- a/qt-ui/profile/diveprofileitem.h
+++ b/qt-ui/profile/diveprofileitem.h
@@ -223,17 +223,6 @@ protected:
 	DivePlotDataModel *model;
 };
 
-class InstantMeanDepthLine : public MeanDepthLine {
-	Q_OBJECT
-public:
-	DiveCartesianAxis *hAxis;
-	DiveCartesianAxis *vAxis;
-	InstantMeanDepthLine();
-public
-slots:
-	void mouseMoved(int time, int depth);
-};
-
 class PartialPressureGasItem : public AbstractProfilePolygonItem {
 	Q_OBJECT
 public:
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index f24e17d..87339e2 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -103,7 +103,6 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
 	mouseFollowerHorizontal(new DiveLineItem()),
 	rulerItem(new RulerItem2()),
 	tankItem(new TankItem()),
-	instantMeanDepth(new InstantMeanDepthLine()),
 	isGrayscale(false),
 	printMode(false),
 	shouldCalculateMaxTime(true),
@@ -118,7 +117,6 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
 	addItemsToScene();
 	scene()->installEventFilter(this);
 	connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
-	connect(this, SIGNAL(mouseMoved(int, int)), instantMeanDepth, SLOT(mouseMoved(int, int)));
 	QAction *action = NULL;
 #define ADD_ACTION(SHORTCUT, Slot)                                  \
 	action = new QAction(this);                                 \
@@ -173,7 +171,6 @@ ProfileWidget2::~ProfileWidget2()
 	delete mouseFollowerHorizontal;
 	delete rulerItem;
 	delete tankItem;
-	delete instantMeanDepth;
 }
 
 #define SUBSURFACE_OBJ_DATA 1
@@ -213,7 +210,6 @@ 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);
@@ -274,12 +270,6 @@ void ProfileWidget2::setupItemOnScene()
 	cylinderPressureAxis->setTickInterval(30000);
 
 
-	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));
 
@@ -605,11 +595,6 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
 	rulerItem->setPlotInfo(plotInfo);
 	tankItem->setData(dataModel, &plotInfo, &displayed_dive);
 
-	instantMeanDepth->vAxis = profileYAxis;
-	instantMeanDepth->hAxis = timeAxis;
-	instantMeanDepth->setVisible(prefs.show_average_depth && !printMode);
-	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
@@ -847,8 +832,6 @@ void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
 	if (timeAxis->maximum() >= hValue && timeAxis->minimum() <= hValue) {
 		mouseFollowerVertical->setPos(pos.x(), profileYAxis->line().y1());
 	}
-	if (timeAxis->maximum() >= hValue && timeAxis->minimum() <= hValue && profileYAxis->maximum() >= vValue && profileYAxis->minimum() <= vValue)
-		emit mouseMoved(hValue, vValue);
 }
 
 bool ProfileWidget2::eventFilter(QObject *object, QEvent *event)
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index ffeecb3..675fa88 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -85,9 +85,6 @@ public:
 	void clearHandlers();
 	State currentState;
 
-signals:
-	void mouseMoved(int time, int depth);
-
 public
 slots: // Necessary to call from QAction's signals.
 	void settingsChanged();
@@ -185,7 +182,6 @@ private:
 	DiveLineItem *mouseFollowerHorizontal;
 	RulerItem2 *rulerItem;
 	TankItem *tankItem;
-	InstantMeanDepthLine *instantMeanDepth;
 	bool isGrayscale;
 	bool printMode;
 
-- 
2.2.1

