[PATCH] QML UI: If a dive has multiple cylinders show "Multiple" in the details page

Joakim Bygdell j.bygdell at gmail.com
Mon Jan 25 12:28:10 PST 2016


Since we are short on space on the mobile version, lets just show "Multiple" if
a dive has multiple cylinders.

Signed-off-by: Joakim Bygdell <j.bygdell at gmail.com>
---
 qt-mobile/qmlmanager.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index a4cfd5f..8767cef 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -714,8 +714,14 @@ QString QMLManager::getCylinder(QString diveId)
 	int dive_id = diveId.toInt();
 	struct dive *d = get_dive_by_uniq_id(dive_id);
 	QString cylinder;
-	if (d)
-		cylinder = d->cylinder[0].type.description;
+	if (d){
+		if (d->cylinder[1].type.description != NULL){
+			cylinder = "Multiple";
+		}
+		else {
+			cylinder = d->cylinder[0].type.description;
+		}
+	}
 	return cylinder;
 }
 
-- 
2.4.9 (Apple Git-60)



More information about the subsurface mailing list