mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
DiveHelperObject: add the weightList and cylinderList properties
"weights" and "cylinders" are QStringList Q_PROPERTIES, and Grantlee should be able to render them, but it doesn't. To be able to print the whole list of weights and cylinders we introduce two new QString properties "weightList" and "cylinderList". The variable replacement in the previous patch deals with the conversation of the user side HTML, e.g.: USER -> INTERNAL "{{ dive.weights }} -> {{ dive.weightList }}" "{{ dive.cylinders }} -> {{ dive.cylinderList }}" Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0aa8ef918d
commit
1d06c383a2
2 changed files with 28 additions and 0 deletions
|
@ -201,6 +201,18 @@ QString DiveObjectHelper::sac() const
|
|||
return QString::number(value, 'f', decimal).append(unit);
|
||||
}
|
||||
|
||||
QString DiveObjectHelper::weightList() const
|
||||
{
|
||||
QString weights;
|
||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
|
||||
QString w = getFormattedWeight(m_dive, i);
|
||||
if (w == EMPTY_DIVE_STRING)
|
||||
continue;
|
||||
weights += w + "; ";
|
||||
}
|
||||
return weights;
|
||||
}
|
||||
|
||||
QStringList DiveObjectHelper::weights() const
|
||||
{
|
||||
QStringList weights;
|
||||
|
@ -226,6 +238,18 @@ QString DiveObjectHelper::suit() const
|
|||
return m_dive->suit ? m_dive->suit : EMPTY_DIVE_STRING;
|
||||
}
|
||||
|
||||
QString DiveObjectHelper::cylinderList() const
|
||||
{
|
||||
QString cylinders;
|
||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
||||
QString cyl = getFormattedCylinder(m_dive, i);
|
||||
if (cyl == EMPTY_DIVE_STRING)
|
||||
continue;
|
||||
cylinders += cyl + "; ";
|
||||
}
|
||||
return cylinders;
|
||||
}
|
||||
|
||||
QStringList DiveObjectHelper::cylinders() const
|
||||
{
|
||||
QStringList cylinders;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue