From 3bdaf00546c483f581bfabc8377683d9f3ed7f49 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Wed, 10 Feb 2016 22:53:58 +0200 Subject: Support function to print version string Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- qt-mobile/qmlmanager.cpp | 9 +++++++++ qt-mobile/qmlmanager.h | 1 + 2 files changed, 10 insertions(+) (limited to 'qt-mobile') diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index ad9aefd75..ff1c748a1 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -794,3 +794,12 @@ QString QMLManager::getDate(const QString& diveId) datestring = get_dive_date_string(d->when); return datestring; } + +QString QMLManager::getVersion() const +{ + QRegExp versionRe(".*:([\\.,\\d]+).*"); + if (!versionRe.exactMatch(getUserAgent())) + return QString(); + + return versionRe.cap(1); +} diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h index 019d0b740..6cd468260 100644 --- a/qt-mobile/qmlmanager.h +++ b/qt-mobile/qmlmanager.h @@ -91,6 +91,7 @@ public slots: QString getNumber(const QString& diveId); QString getDate(const QString& diveId); QString getCurrentPosition(); + QString getVersion() const; void deleteGpsFix(quint64 when); void refreshDiveList(); -- cgit v1.2.3-70-g09d2