summaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt/DiveObjectHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/subsurface-qt/DiveObjectHelper.cpp')
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index 69bd7999f..768d4a860 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -55,10 +55,18 @@ static QString getPressures(struct dive *dive, enum returnPressureSelector ret)
DiveObjectHelper::DiveObjectHelper(struct dive *d) :
m_dive(d)
{
+ m_cyls.clear();
+ for (int i = 0; i < MAX_CYLINDERS; i++) {
+ //Don't add blank cylinders, only those that have been defined.
+ if (m_dive->cylinder[i].type.description)
+ m_cyls.append(new CylinderObjectHelper(&m_dive->cylinder[i]));
+ }
}
DiveObjectHelper::~DiveObjectHelper()
{
+while (!m_cyls.isEmpty())
+ delete m_cyls.takeFirst();
}
int DiveObjectHelper::number() const
@@ -275,6 +283,11 @@ QString DiveObjectHelper::cylinder(int idx) const
return getFormattedCylinder(m_dive, idx);
}
+QList<CylinderObjectHelper*> DiveObjectHelper::cylinderObjects() const
+{
+ return m_cyls;
+}
+
QString DiveObjectHelper::trip() const
{
return m_dive->divetrip ? m_dive->divetrip->location : EMPTY_DIVE_STRING;