From 613a3112d27e2d40c3a4eeb7fb061f4739279157 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 19 Oct 2019 22:12:50 -0400 Subject: Mobile: get dive details directly from the model By getting a DiveObjectHelper and then dereferencing that we ended up creating hundres and hundreds of these objects, only to immediately destroy them after using a tiny part of the data. Instead make those data available directly from the model, without having to create a DiveObjectHelper forst. Signed-off-by: Dirk Hohndel --- qt-models/divelistmodel.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'qt-models/divelistmodel.h') diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index 90cc51966..2f8985235 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -29,6 +29,15 @@ private: void updateFilterState(); }; +QString formatSac(const dive *d); +QString formatNotes(const dive *d); +QString format_gps_decimal(const dive *d); +QStringList formatGetCylinder(const dive *d); +QStringList getStartPressure(const dive *d); +QStringList getEndPressure(const dive *d); +QStringList getFirstGas(const dive *d); + + class DiveListModel : public QAbstractListModel { Q_OBJECT @@ -42,7 +51,28 @@ public: IdRole, NumberRole, LocationRole, + DepthRole, + DurationRole, DepthDurationRole, + RatingRole, + VizRole, + SuitRole, + AirTempRole, + WaterTempRole, + SacRole, + SumWeightRole, + DiveMasterRole, + BuddyRole, + NotesRole, + GpsDecimalRole, + GpsRole, + NoDiveRole, + DiveSiteRole, + CylinderRole, + SingleWeightRole, + StartPressureRole, + EndPressureRole, + FirstGasRole, }; static DiveListModel *instance(); -- cgit v1.2.3-70-g09d2