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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-10-19 22:12:50 -04:00
parent 09c7115e21
commit 613a3112d2
4 changed files with 134 additions and 60 deletions

View file

@ -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();