summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-24 21:14:33 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-25 23:24:22 +0100
commit66184d58e8bda6e0e962a6a419458a7fcde18dd0 (patch)
treecdc0b1ae1a641f8febec21690e9461acbf357afb
parent583d8d653a4d6becf1c695e6f924cfc81ef7fb39 (diff)
downloadsubsurface-66184d58e8bda6e0e962a6a419458a7fcde18dd0.tar.gz
core: add ability to get underlying dive to DiveObjectHelper
This feels a bit like cheating, but if we need to be able to make modifications to the underlying dive and only have the helper object (for example inside of a view model), doing everything through the helper object can turn into a real performance issue. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp5
-rw-r--r--core/subsurface-qt/DiveObjectHelper.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index dfc1739e8..5174b1a7e 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -81,6 +81,11 @@ int DiveObjectHelper::id() const
return m_dive->id;
}
+struct dive *DiveObjectHelper::getDive() const
+{
+ return m_dive;
+}
+
QString DiveObjectHelper::date() const
{
QDateTime localTime = QDateTime::fromMSecsSinceEpoch(1000*m_dive->when, Qt::UTC);
diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h
index 0abdf8e5a..1070b855e 100644
--- a/core/subsurface-qt/DiveObjectHelper.h
+++ b/core/subsurface-qt/DiveObjectHelper.h
@@ -56,6 +56,7 @@ public:
~DiveObjectHelper();
int number() const;
int id() const;
+ struct dive *getDive() const;
int rating() const;
int visibility() const;
QString date() const;