summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-14 09:10:06 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-14 09:10:06 -0800
commit76d07635270bb3068b7d9a559b481d3c094f0d7b (patch)
treecd507fe34e03b8c5cc2c10e9d991a50f44635d9e /qt-mobile/qmlmanager.cpp
parent24404a401d5a21134b153000fffc74bd429a0631 (diff)
downloadsubsurface-76d07635270bb3068b7d9a559b481d3c094f0d7b.tar.gz
Location service: make distance and time threshold configurable
Right now the distance is always in meters, the mobile app doesn't deal with units at all, anyway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r--qt-mobile/qmlmanager.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index 8dcc24395..fe8c5ed0a 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -26,6 +26,8 @@ QMLManager::QMLManager() :
setCloudPassword(prefs.cloud_storage_password);
setSaveCloudPassword(prefs.save_password_local);
setSsrfGpsWebUserid(prefs.userid);
+ setDistanceThreshold(prefs.distance_threshold);
+ setTimeThreshold(prefs.time_threshold / 60);
if (!same_string(prefs.cloud_storage_email, "") && !same_string(prefs.cloud_storage_password, ""))
loadDives();
}
@@ -38,6 +40,12 @@ void QMLManager::savePreferences()
{
QSettings s;
s.setValue("subsurface_webservice_uid", ssrfGpsWebUserid());
+ s.beginGroup("LocationService");
+ s.setValue("time_threshold", timeThreshold() * 60);
+ prefs.time_threshold = timeThreshold() * 60;
+ s.setValue("distance_threshold", distanceThreshold());
+ prefs.distance_threshold = distanceThreshold();
+ s.endGroup();
s.beginGroup("CloudStorage");
s.setValue("email", cloudUserName());
s.setValue("save_password_local", saveCloudPassword());
@@ -240,3 +248,25 @@ void QMLManager::setSsrfGpsWebUserid(const QString &userid)
m_ssrfGpsWebUserid = userid;
emit ssrfGpsWebUseridChanged();
}
+
+int QMLManager::distanceThreshold() const
+{
+ return m_distanceThreshold;
+}
+
+void QMLManager::setDistanceThreshold(int distance)
+{
+ m_distanceThreshold = distance;
+ emit distanceThresholdChanged();
+}
+
+int QMLManager::timeThreshold() const
+{
+ return m_timeThreshold;
+}
+
+void QMLManager::setTimeThreshold(int time)
+{
+ m_timeThreshold = time;
+ emit timeThresholdChanged();
+}