diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-02-14 16:26:37 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-14 16:26:37 -0800 |
commit | 06ad45c48f942738c0647ccc4f01d79e6a287e2e (patch) | |
tree | 03e45b37f488368e34a3466a6516841fe3f02436 /subsurface-core/subsurface-qt | |
parent | 58f014728c5a8590dfbcd1d777bfd3e17240da5d (diff) | |
download | subsurface-06ad45c48f942738c0647ccc4f01d79e6a287e2e.tar.gz |
Add dive property to easily test if there isn't an actual dive
Right now this just tests for zero duration, but maybe this should also
return true for positive duration and max depth of 0.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt')
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 5 | ||||
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.h | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index b05138980..376380b8c 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -103,6 +103,11 @@ QString DiveObjectHelper::duration() const return get_dive_duration_string(m_dive->duration.seconds, QObject::tr("h:"), QObject::tr("min")); } +bool DiveObjectHelper::noDive() const +{ + return m_dive->duration.seconds == 0 && m_dive->dc.duration.seconds == 0; +} + QString DiveObjectHelper::depth() const { return get_depth_string(m_dive->dc.maxdepth.mm, true, true); diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index a4a425ac0..0584f8836 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -16,6 +16,7 @@ class DiveObjectHelper : public QObject { Q_PROPERTY(QString location READ location CONSTANT) Q_PROPERTY(QString gps READ gps CONSTANT) Q_PROPERTY(QString duration READ duration CONSTANT) + Q_PROPERTY(bool noDive READ noDive CONSTANT) Q_PROPERTY(QString depth READ depth CONSTANT) Q_PROPERTY(QString divemaster READ divemaster CONSTANT) Q_PROPERTY(QString buddy READ buddy CONSTANT) @@ -34,10 +35,10 @@ class DiveObjectHelper : public QObject { Q_PROPERTY(QString maxcns READ maxcns CONSTANT) 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) - Q_PROPERTY(QString firstGas READ firstGas CONSTANT) + Q_PROPERTY(QString getCylinder READ getCylinder CONSTANT) + Q_PROPERTY(QString startPressure READ startPressure CONSTANT) + Q_PROPERTY(QString endPressure READ endPressure CONSTANT) + Q_PROPERTY(QString firstGas READ firstGas CONSTANT) public: DiveObjectHelper(struct dive *dive = NULL); ~DiveObjectHelper(); @@ -50,6 +51,7 @@ public: QString location() const; QString gps() const; QString duration() const; + bool noDive() const; QString depth() const; QString divemaster() const; QString buddy() const; |