mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
DiveObjectHelper: Turn DiveObjectHelper into Q_GADGET based object
DiveObjectHelper is a tiny wrapper around dive * to allow access to dive data from QML and grantlee. It doesn't have to be a full-fledged QObject with support for signals, etc. Therefore, turn it into a Q_GADGET based object. This allows us passing the object around as object, not as pointer to DiveObjectHelper. This makes memory-management distinctly easier. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a79c45e401
commit
be763452ad
5 changed files with 101 additions and 20 deletions
|
@ -139,4 +139,83 @@ if (property == "description") {
|
|||
return object.gasMix;
|
||||
}
|
||||
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)
|
||||
if (property == "number") {
|
||||
return object.number();
|
||||
} else if (property == "id") {
|
||||
return object.id();
|
||||
} else if (property == "rating") {
|
||||
return object.rating();
|
||||
} else if (property == "visibility") {
|
||||
return object.visibility();
|
||||
} else if (property == "date") {
|
||||
return object.date();
|
||||
} else if (property == "time") {
|
||||
return object.time();
|
||||
} else if (property == "timestamp") {
|
||||
return QVariant::fromValue(object.timestamp());
|
||||
} else if (property == "location") {
|
||||
return object.location();
|
||||
} else if (property == "gps") {
|
||||
return object.gps();
|
||||
} else if (property == "gps_decimal") {
|
||||
return object.gps_decimal();
|
||||
} else if (property == "dive_site") {
|
||||
return object.dive_site();
|
||||
} else if (property == "duration") {
|
||||
return object.duration();
|
||||
} else if (property == "noDive") {
|
||||
return object.noDive();
|
||||
} else if (property == "depth") {
|
||||
return object.depth();
|
||||
} else if (property == "divemaster") {
|
||||
return object.divemaster();
|
||||
} else if (property == "buddy") {
|
||||
return object.buddy();
|
||||
} else if (property == "airTemp") {
|
||||
return object.airTemp();
|
||||
} else if (property == "waterTemp") {
|
||||
return object.waterTemp();
|
||||
} else if (property == "notes") {
|
||||
return object.notes();
|
||||
} else if (property == "tags") {
|
||||
return object.tags();
|
||||
} else if (property == "gas") {
|
||||
return object.gas();
|
||||
} else if (property == "sac") {
|
||||
return object.sac();
|
||||
} else if (property == "weightList") {
|
||||
return object.weightList();
|
||||
} else if (property == "weights") {
|
||||
return object.weights();
|
||||
} else if (property == "singleWeight") {
|
||||
return object.singleWeight();
|
||||
} else if (property == "suit") {
|
||||
return object.suit();
|
||||
} else if (property == "cylinderList") {
|
||||
return object.cylinderList();
|
||||
} else if (property == "cylinders") {
|
||||
return object.cylinders();
|
||||
} else if (property == "cylinderObjects") {
|
||||
return QVariant::fromValue(object.cylinderObjects());
|
||||
} else if (property == "maxcns") {
|
||||
return object.maxcns();
|
||||
} else if (property == "otu") {
|
||||
return object.otu();
|
||||
} else if (property == "sumWeight") {
|
||||
return object.sumWeight();
|
||||
} else if (property == "getCylinder") {
|
||||
return object.getCylinder();
|
||||
} else if (property == "startPressure") {
|
||||
return object.startPressure();
|
||||
} else if (property == "endPressure") {
|
||||
return object.endPressure();
|
||||
} else if (property == "firstGas") {
|
||||
return object.firstGas();
|
||||
}
|
||||
GRANTLEE_END_LOOKUP
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue