Grantlee: split out grantlee-only property from DiveObjectHelper

The cylindersObject list was only used by grantlee but not by
the mobile code. Since it is quite heavy, split it out and thus
don't generate it for every dive on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-08-22 19:40:42 +02:00 committed by bstoeger
parent 6a9df3bba3
commit 718c07c1a8
4 changed files with 32 additions and 10 deletions

View file

@ -238,7 +238,6 @@ DiveObjectHelper::DiveObjectHelper(const struct dive *d) :
singleWeight(d->weightsystems.nr <= 1),
suit(d->suit ? d->suit : QString()),
cylinders(formatCylinders(d)),
cylinderObjects(makeCylinderObjects(d)),
maxcns(d->maxcns),
otu(d->otu),
sumWeight(get_weight_string(weight_t { total_weight(d) }, true)),
@ -249,6 +248,16 @@ DiveObjectHelper::DiveObjectHelper(const struct dive *d) :
{
}
DiveObjectHelperGrantlee::DiveObjectHelperGrantlee()
{
}
DiveObjectHelperGrantlee::DiveObjectHelperGrantlee(const struct dive *d) :
DiveObjectHelper(d),
cylinderObjects(makeCylinderObjects(d))
{
}
QString DiveObjectHelper::date() const
{
QDateTime localTime = QDateTime::fromMSecsSinceEpoch(1000 * timestamp, Qt::UTC);