Since we only show the first cylinder we can also only edit the first cylinder.

Signed-off-by: Joakim Bygdell <[email protected]>
---
 subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 23 ++++++++++++++++++++++
 subsurface-core/subsurface-qt/DiveObjectHelper.h   |  4 ++++
 2 files changed, 27 insertions(+)

diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp 
b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
index 2f058f4..40a67fb 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
@@ -33,6 +33,17 @@ static QString getFormattedCylinder(struct dive *dive, 
unsigned int idx)
        return fmt;
 }
 
+static QString getPressures(struct dive *dive, bool returnPressures)
+{
+       cylinder_t *cyl = &dive->cylinder[0];
+       QString fmt;
+       if (returnPressures == 0)
+               fmt = get_pressure_string(cyl->start, true);
+       if (returnPressures == 1)
+               fmt = get_pressure_string(cyl->end, true);
+       return fmt;
+}
+
 DiveObjectHelper::DiveObjectHelper(struct dive *d) :
        m_dive(d)
 {
@@ -269,3 +280,15 @@ QString DiveObjectHelper::getCylinder() const
        }
        return getCylinder;
 }
+
+QString DiveObjectHelper::startPressure() const
+{
+       QString startPressure = getPressures(m_dive, 0);
+       return startPressure;
+}
+
+QString DiveObjectHelper::endPressure() const
+{
+       QString endPressure = getPressures(m_dive, 1);
+       return endPressure;
+}
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h 
b/subsurface-core/subsurface-qt/DiveObjectHelper.h
index f9ed6a5..5d8abfd 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.h
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h
@@ -35,6 +35,8 @@ class DiveObjectHelper : public QObject {
        Q_PROPERTY(QString otu READ otu CONSTANT)
        Q_PROPERTY(QString sumWeight READ sumWeight CONSTANT)
     Q_PROPERTY(QString getCylinder READ getCylinder CONSTANT)
+    Q_PROPERTY(QString startPressure READ startPressure CONSTANT)
+    Q_PROPERTY(QString endPressure READ endPressure CONSTANT)
 public:
        DiveObjectHelper(struct dive *dive = NULL);
        ~DiveObjectHelper();
@@ -68,6 +70,8 @@ public:
        QString otu() const;
        QString sumWeight() const;
        QString getCylinder() const;
+       QString startPressure() const;
+       QString endPressure() const;
 
 private:
        struct dive *m_dive;
-- 
2.4.9 (Apple Git-60)

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

Reply via email to