[PATCH 5/6] qthelper: also support "maxcns" and "otu" in Grantlee HTML

Lubomir I. Ivanov neolit123 at gmail.com
Mon Nov 16 14:29:21 PST 2015


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

Fixes #962

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---

These patch series add the following variables as requested
by the user here:
http://trac.subsurface-divelog.org/ticket/962#comment:2

dive.suit
dive.cylinders, dive.cylinder0-7
dive.weights, dive.weight0-5
dive.maxcns, dive.otu

"Gas consumed per gas used" is something that i don't
understand and we are leaving it out for now.
---
 desktop-widgets/templatelayout.h |  2 ++
 subsurface-core/qthelper.cpp     | 20 ++++++++++++++++++++
 subsurface-core/qthelper.h       |  8 ++++++++
 3 files changed, 30 insertions(+)

diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h
index d832853..1ef9b58 100644
--- a/desktop-widgets/templatelayout.h
+++ b/desktop-widgets/templatelayout.h
@@ -93,6 +93,8 @@ else _RETURN_DIVE_PROPERTY_IDX(weight, 2);
 else _RETURN_DIVE_PROPERTY_IDX(weight, 3);
 else _RETURN_DIVE_PROPERTY_IDX(weight, 4);
 else _RETURN_DIVE_PROPERTY_IDX(weight, 5);
+else _RETURN_DIVE_PROPERTY(maxcns);
+else _RETURN_DIVE_PROPERTY(otu);
 GRANTLEE_END_LOOKUP
 
 #undef _RETURN_DIVE_PROPERTY
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp
index 049ebf6..c3ea37c 100644
--- a/subsurface-core/qthelper.cpp
+++ b/subsurface-core/qthelper.cpp
@@ -178,6 +178,16 @@ QString Dive::trip() const
 	return m_trip;
 }
 
+QString Dive::maxcns() const
+{
+	return m_maxcns;
+}
+
+QString Dive::otu() const
+{
+	return m_otu;
+}
+
 int Dive::rating() const
 {
 	return m_rating;
@@ -351,6 +361,16 @@ void Dive::put_trip()
 	}
 }
 
+void Dive::put_maxcns()
+{
+	m_maxcns = QString::number(dive->maxcns);
+}
+
+void Dive::put_otu()
+{
+	m_otu = QString::number(dive->otu);
+}
+
 QString weight_string(int weight_in_grams)
 {
 	QString str;
diff --git a/subsurface-core/qthelper.h b/subsurface-core/qthelper.h
index 86be073..4345afa 100644
--- a/subsurface-core/qthelper.h
+++ b/subsurface-core/qthelper.h
@@ -32,6 +32,8 @@ private:
 	QString m_suit;
 	QStringList m_cylinders;
 	QString m_trip;
+	QString m_maxcns;
+	QString m_otu;
 	struct dive *dive;
 	void put_date_time();
 	void put_timestamp();
@@ -49,6 +51,8 @@ private:
 	void put_suit();
 	void put_cylinder();
 	void put_trip();
+	void put_maxcns();
+	void put_otu();
 
 public:
 	Dive(struct dive *dive)
@@ -73,6 +77,8 @@ public:
 		put_suit();
 		put_cylinder();
 		put_trip();
+		put_maxcns();
+		put_otu();
 	}
 	Dive();
 	~Dive();
@@ -99,6 +105,8 @@ public:
 	QString cylinders() const;
 	QString cylinder(int idx) const;
 	QString trip() const;
+	QString maxcns() const;
+	QString otu() const;
 };
 
 // global pointers for our translation
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list