summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r--qt-mobile/qmlmanager.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index d2b5c4702..a4cfd5fd4 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -718,3 +718,23 @@ QString QMLManager::getCylinder(QString diveId)
cylinder = d->cylinder[0].type.description;
return cylinder;
}
+
+QString QMLManager::getWeights(QString diveId)
+{
+ int dive_id = diveId.toInt();
+ struct dive *d = get_dive_by_uniq_id(dive_id);
+ int weight = 0;
+ QString weights;
+ if (d){
+ for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
+ weight += d->weightsystem[i].weight.grams;
+
+ if (informational_prefs.unit_system == IMPERIAL){
+ weights = QString::number(grams_to_lbs(weight)) + " lbs";
+ }
+ else {
+ weights = QString::number(weight/1000) + " kg";
+ }
+ }
+ return weights;
+}