diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-08-22 19:40:42 +0200 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-09-14 13:20:59 +0200 |
commit | 718c07c1a864ae307306fc54d3a8ba38e30bf759 (patch) | |
tree | d4850c0243ff396be8232673473c48f610228f04 /desktop-widgets | |
parent | 6a9df3bba3021b95f354c0590c79a458dbeca45b (diff) | |
download | subsurface-718c07c1a864ae307306fc54d3a8ba38e30bf759.tar.gz |
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/templatelayout.cpp | 10 | ||||
-rw-r--r-- | desktop-widgets/templatelayout.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp index bdcdfbbe9..de540f266 100644 --- a/desktop-widgets/templatelayout.cpp +++ b/desktop-widgets/templatelayout.cpp @@ -100,7 +100,7 @@ TemplateLayout::TemplateLayout(print_options *printOptions, template_options *te } /* a HTML pre-processor stage. acts like a compatibility layer - * between some Grantlee variables and DiveObjectHelper Q_PROPERTIES: + * between some Grantlee variables and DiveObjectHelperGrantlee Q_PROPERTIES: * dive.weights -> dive.weightList * dive.weight# -> dive.weights.# * dive.cylinders -> dive.cylinderList @@ -134,13 +134,13 @@ QString TemplateLayout::generate() Grantlee::registerMetaType<template_options>(); Grantlee::registerMetaType<print_options>(); Grantlee::registerMetaType<CylinderObjectHelper>(); // TODO: Remove when grantlee supports Q_GADGET - Grantlee::registerMetaType<DiveObjectHelper>(); // TODO: Remove when grantlee supports Q_GADGET + Grantlee::registerMetaType<DiveObjectHelperGrantlee>(); // TODO: Remove when grantlee supports Q_GADGET QVariantList diveList; struct dive *dive; if (in_planner()) { - diveList.append(QVariant::fromValue(DiveObjectHelper(&displayed_dive))); + diveList.append(QVariant::fromValue(DiveObjectHelperGrantlee(&displayed_dive))); emit progressUpdated(100.0); } else { int i; @@ -148,7 +148,7 @@ QString TemplateLayout::generate() //TODO check for exporting selected dives only if (!dive->selected && printOptions->print_selected) continue; - diveList.append(QVariant::fromValue(DiveObjectHelper(dive))); + diveList.append(QVariant::fromValue(DiveObjectHelperGrantlee(dive))); progress++; emit progressUpdated(lrint(progress * 100.0 / totalWork)); } @@ -191,7 +191,7 @@ QString TemplateLayout::generateStatistics() Grantlee::registerMetaType<template_options>(); Grantlee::registerMetaType<print_options>(); Grantlee::registerMetaType<CylinderObjectHelper>(); // TODO: Remove when grantlee supports Q_GADGET - Grantlee::registerMetaType<DiveObjectHelper>(); // TODO: Remove when grantlee supports Q_GADGET + Grantlee::registerMetaType<DiveObjectHelperGrantlee>(); // TODO: Remove when grantlee supports Q_GADGET QVariantList years; diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h index 870cd702a..04f7af9a5 100644 --- a/desktop-widgets/templatelayout.h +++ b/desktop-widgets/templatelayout.h @@ -143,7 +143,7 @@ GRANTLEE_END_LOOKUP // TODO: This is currently needed because our grantlee version // doesn't support Q_GADGET based classes. A patch to fix this // exists. Remove in due course. -GRANTLEE_BEGIN_LOOKUP(DiveObjectHelper) +GRANTLEE_BEGIN_LOOKUP(DiveObjectHelperGrantlee) if (property == "number") { return object.number; } else if (property == "id") { |