lots of fixes. :)
From fd72f139f4ff2c1d433bb78e4c74fd1fd89a5b75 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 29 May 2014 23:42:15 -0300
Subject: [PATCH 1/6] Fix CMake

save-html was not there yet.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef58bbf..e19032c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,6 +92,7 @@ SET(SUBSURFACE_CORE_LIB_SRCS
 	worldmap-save.c
 	save-git.c
 	save-xml.c
+	save-html.c
 	sha1.c
 	statistics.c
 	strtod.c
-- 
1.9.3

From 022a28135dcad19192a65a752588235dc91fff9f Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 29 May 2014 23:42:55 -0300
Subject: [PATCH 2/6] Hide DiveHandlers and GasTexts when on profile mode too.

When switching from PLAN or ADD mode to PROFILE, we
kept the dive handlers visible, not anymore.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/profile/profilewidget2.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index df45628..3a5d176 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -756,6 +756,11 @@ void ProfileWidget2::setProfileState()
 		}
 	}
 	rulerItem->setVisible(prefs.rulergraph);
+	#define HIDE_ALL(TYPE, CONTAINER) \
+	Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
+	HIDE_ALL(DiveHandler, handles);
+	HIDE_ALL(QGraphicsSimpleTextItem, gases);
+	#undef HIDE_ALL
 }
 
 void ProfileWidget2::setAddState()
-- 
1.9.3

From f1a84b17882d40905408cf18ebe975f81cc22dd4 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 29 May 2014 23:47:03 -0300
Subject: [PATCH 3/6] Hide the DiveHandlers that are not entered by mouse.

We need to create them, even if we don't display ( only because it
was a pain to correctly track them from the model ) - so, hide them
if it's not entered by mouse, but a deco one.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/profile/profilewidget2.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 3a5d176..a196b34 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -1083,12 +1083,14 @@ void ProfileWidget2::repositionDiveHandlers()
 		if (datapoint.time == 0) // those are the magic entries for tanks
 			continue;
 		DiveHandler *h = handles.at(i);
+		h->setVisible(datapoint.entered);
 		h->setPos(timeAxis->posAtValue(datapoint.time), profileYAxis->posAtValue(datapoint.depth));
 		QPointF p1 = (last == i) ? QPointF(timeAxis->posAtValue(0), profileYAxis->posAtValue(0)) : handles[last]->pos();
 		QPointF p2 = handles[i]->pos();
 		QLineF line(p1, p2);
 		QPointF pos = line.pointAt(0.5);
 		gases[i]->setPos(pos);
+		gases[i]->setVisible(datapoint.entered);
 		gases[i]->setText(dpGasToStr(plannerModel->at(i)));
 		last = i;
 	}
-- 
1.9.3

From ada18de8007982479886ee692b920728c1ec86c0 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 29 May 2014 23:49:43 -0300
Subject: [PATCH 4/6] Do not remove a Deco Stop by clicking on the trash

This patch forbids deletion of the Deco Stop from the
QTableView that holds the model.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/diveplanner.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index c243c15..9570975 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -656,6 +656,10 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
 	if (index.column() != REMOVE)
 		return;
 
+	divedatapoint dp = at(index.row());
+	if (!dp.entered)
+		return;
+
 	beginRemoveRows(QModelIndex(), index.row(), index.row());
 	divepoints.remove(index.row());
 	endRemoveRows();
-- 
1.9.3

From 812dd430412f732dff6fc88aff1d1f4ffbf2a2b9 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 29 May 2014 23:51:25 -0300
Subject: [PATCH 5/6] Do not show 'trash' icon for deco stops.

Besides not deleting them, we shouldn't offer the icon for it.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/diveplanner.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 9570975..7091d4f 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -350,8 +350,8 @@ int DivePlannerPointsModel::columnCount(const QModelIndex &parent) const
 
 QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const
 {
+	divedatapoint p = divepoints.at(index.row());
 	if (role == Qt::DisplayRole) {
-		divedatapoint p = divepoints.at(index.row());
 		switch (index.column()) {
 		case CCSETPOINT:
 			return (double)p.po2 / 1000;
@@ -370,7 +370,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const
 	} else if (role == Qt::DecorationRole) {
 		switch (index.column()) {
 		case REMOVE:
-			return QIcon(":trash");
+			return p.entered ? QIcon(":trash") : QVariant();
 		}
 	} else if (role == Qt::FontRole) {
 		if (divepoints.at(index.row()).entered) {
-- 
1.9.3

From 9404202a96ce7683523c1e529cde7bcb319480aa Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 29 May 2014 23:53:01 -0300
Subject: [PATCH 6/6] Do not offer an editor when double-clicking REMOVE on the
 planner.

The  planner would offer an text-editor if the user double
clicked it's remove column. forbidding that.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/diveplanner.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 7091d4f..bb00299 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -445,7 +445,7 @@ QVariant DivePlannerPointsModel::headerData(int section, Qt::Orientation orienta
 
 Qt::ItemFlags DivePlannerPointsModel::flags(const QModelIndex &index) const
 {
-	if (index.column() != DURATION)
+	if (index.column() != DURATION && index.column() != REMOVE)
 		return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
 	else
 		return QAbstractItemModel::flags(index);
-- 
1.9.3

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to