From 6a51c14365067fc45365c2a970d76749d9502a9d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 14 Apr 2018 17:34:33 -0700 Subject: DiveObjectHelper: expose number of dives in a trip Signed-off-by: Dirk Hohndel --- core/subsurface-qt/DiveObjectHelper.cpp | 6 ++++++ core/subsurface-qt/DiveObjectHelper.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index 4c1c66e21..084da4fd3 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -360,6 +360,12 @@ QString DiveObjectHelper::tripMeta() const return ret; } +int DiveObjectHelper::tripNrDives() const +{ + struct dive_trip *dt = m_dive->divetrip; + return dt ? dt->nrdives : 0; +} + int DiveObjectHelper::maxcns() const { return m_dive->maxcns; diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h index d0a90a32b..4303650aa 100644 --- a/core/subsurface-qt/DiveObjectHelper.h +++ b/core/subsurface-qt/DiveObjectHelper.h @@ -42,6 +42,7 @@ class DiveObjectHelper : public QObject { Q_PROPERTY(QList cylinderObjects READ cylinderObjects CONSTANT) Q_PROPERTY(QString trip READ trip CONSTANT) Q_PROPERTY(QString tripMeta READ tripMeta CONSTANT) + Q_PROPERTY(int tripNrDives READ tripNrDives CONSTANT) Q_PROPERTY(int maxcns READ maxcns CONSTANT) Q_PROPERTY(int otu READ otu CONSTANT) Q_PROPERTY(QString sumWeight READ sumWeight CONSTANT) @@ -85,6 +86,7 @@ public: QList cylinderObjects() const; QString trip() const; QString tripMeta() const; + int tripNrDives() const; int maxcns() const; int otu() const; QString sumWeight() const; -- cgit v1.2.3-70-g09d2