<div dir="ltr"><div><div>hey,<br></div>just a tiny nitpick on the code,<br></div>And this would be used in what part of the code?<br><br><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 30, 2016 at 7:25 PM, Tim Wootton <span dir="ltr"><<a href="mailto:tim@tee-jay.org.uk" target="_blank">tim@tee-jay.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">to allow grantlee to access individual fields of the cylinder_t struct<br>
rather than a string representation of the whole cylinder info<br>
<br>
Signed-off-by: Tim Wootton <<a href="mailto:tim@tee-jay.org.uk">tim@tee-jay.org.uk</a>><br>
---<br>
 core/CMakeLists.txt                     |  1 +<br>
 core/subsurface-qt/DiveObjectHelper.cpp | 13 +++++++++++++<br>
 core/subsurface-qt/DiveObjectHelper.h   |  4 ++++<br>
 3 files changed, 18 insertions(+)<br>
<br>
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt<br>
index d9b1d34..5c22e23 100644<br>
--- a/core/CMakeLists.txt<br>
+++ b/core/CMakeLists.txt<br>
@@ -86,6 +86,7 @@ set(SUBSURFACE_CORE_LIB_SRCS<br>
<br>
        #Subsurface Qt have the Subsurface structs QObjectified for easy access via QML.<br>
        subsurface-qt/DiveObjectHelper.cpp<br>
+       subsurface-qt/CylinderObjectHelper.cpp<br>
        subsurface-qt/SettingsObjectWrapper.cpp<br>
        ${SERIAL_FTDI}<br>
        ${PLATFORM_SRC}<br>
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp<br>
index c246a12..7da5202 100644<br>
--- a/core/subsurface-qt/DiveObjectHelper.cpp<br>
+++ b/core/subsurface-qt/DiveObjectHelper.cpp<br>
@@ -55,10 +55,18 @@ static QString getPressures(struct dive *dive, enum returnPressureSelector ret)<br>
 DiveObjectHelper::DiveObjectHelper(struct dive *d) :<br>
        m_dive(d)<br>
 {<br>
+       m_cyls.clear();<br>
+       for (int i = 0; i < MAX_CYLINDERS; i++) {<br>
+               //Don't add blank cylinders, only those that have been defined.<br>
+               if (m_dive->cylinder[i].type.description)<br>
+                       m_cyls.append(new CylinderObjectHelper(&m_dive->cylinder[i]));<br>
+       }<br>
 }<br>
<br>
 DiveObjectHelper::~DiveObjectHelper()<br>
 {<br></blockquote><div>           qDeleteAll(m_cyls);<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 }<br>
<br>
 int DiveObjectHelper::number() const<br>
@@ -271,6 +279,11 @@ QString DiveObjectHelper::cylinder(int idx) const<br>
        return getFormattedCylinder(m_dive, idx);<br>
 }<br>
<br>
+QList<CylinderObjectHelper*> DiveObjectHelper::cylinderObjects() const<br>
+{<br>
+       return m_cyls;<br>
+}<br>
+<br>
 QString DiveObjectHelper::trip() const<br>
 {<br>
        return m_dive->divetrip ? m_dive->divetrip->location : EMPTY_DIVE_STRING;<br>
diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h<br>
index ab42a59..c685690 100644<br>
--- a/core/subsurface-qt/DiveObjectHelper.h<br>
+++ b/core/subsurface-qt/DiveObjectHelper.h<br>
@@ -2,6 +2,7 @@<br>
 #define DIVE_QOBJECT_H<br>
<br>
 #include "../dive.h"<br>
+#include "CylinderObjectHelper.h"<br>
 #include <QObject><br>
 #include <QString><br>
 #include <QStringList><br>
@@ -34,6 +35,7 @@ class DiveObjectHelper : public QObject {<br>
        Q_PROPERTY(QString suit READ suit CONSTANT)<br>
        Q_PROPERTY(QString cylinderList READ cylinderList CONSTANT)<br>
        Q_PROPERTY(QStringList cylinders READ cylinders CONSTANT)<br>
+       Q_PROPERTY(QList<CylinderObjectHelper*> cylinderObjects READ cylinderObjects CONSTANT)<br>
        Q_PROPERTY(QString trip READ trip CONSTANT)<br>
        Q_PROPERTY(QString tripMeta READ tripMeta CONSTANT)<br>
        Q_PROPERTY(int maxcns READ maxcns CONSTANT)<br>
@@ -77,6 +79,7 @@ public:<br>
        QString cylinderList() const;<br>
        QStringList cylinders() const;<br>
        QString cylinder(int idx) const;<br>
+       QList<CylinderObjectHelper*> cylinderObjects() const;<br>
        QString trip() const;<br>
        QString tripMeta() const;<br>
        int maxcns() const;<br>
@@ -92,6 +95,7 @@ public:<br>
<br>
 private:<br>
        struct dive *m_dive;<br>
+       QList<CylinderObjectHelper*> m_cyls;<br>
 };<br>
        Q_DECLARE_METATYPE(DiveObjectHelper *)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.1.4<br>
<br>
_______________________________________________<br>
subsurface mailing list<br>
<a href="mailto:subsurface@subsurface-divelog.org">subsurface@subsurface-divelog.org</a><br>
<a href="http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface" rel="noreferrer" target="_blank">http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface</a><br>
</font></span></blockquote></div><br></div></div></div>