aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-09-12 09:12:03 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-12 20:17:39 -0700
commitbaa828e900b2dc1c647c62483a13737baadfa76c (patch)
treeb622cd0aa0f974427b60658d006d565cc0559f80
parentc454f6954f0fc5fdd490c50ff13f556660de5ed8 (diff)
downloadsubsurface-baa828e900b2dc1c647c62483a13737baadfa76c.tar.gz
mobile-widgets: move distanceThreshold handling to qPref
Remove distanceThreshold from qmlprefs and use qPref instead update qml no user experience change Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/Settings.qml5
-rw-r--r--mobile-widgets/qmlmanager.cpp2
-rw-r--r--mobile-widgets/qmlprefs.cpp12
-rw-r--r--mobile-widgets/qmlprefs.h9
4 files changed, 2 insertions, 26 deletions
diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml
index 484a69a67..22ff97056 100644
--- a/mobile-widgets/qml/Settings.qml
+++ b/mobile-widgets/qml/Settings.qml
@@ -278,11 +278,10 @@ Kirigami.ScrollablePage {
Controls.TextField {
id: distanceThreshold
- text: prefs.distanceThreshold
+ text: PrefLocationService.distance_threshold
Layout.preferredWidth: gridWidth * 0.25
onEditingFinished: {
- prefs.distanceThreshold = distanceThreshold.text
- manager.savePreferences()
+ PrefLocationService.distance_threshold = distanceThreshold.text
}
}
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 2a3c426ed..36108d848 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -406,7 +406,6 @@ void QMLManager::finishSetup()
appendTextToLog(tr("no cloud credentials"));
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
}
- QMLPrefs::instance()->setDistanceThreshold(qPrefLocationService::distance_threshold());
QMLPrefs::instance()->setTimeThreshold(qPrefLocationService::time_threshold() / 60);
}
@@ -427,7 +426,6 @@ QMLManager *QMLManager::instance()
void QMLManager::savePreferences()
{
qPrefLocationService::set_time_threshold(QMLPrefs::instance()->timeThreshold() * 60);
- qPrefLocationService::set_distance_threshold(QMLPrefs::instance()->distanceThreshold());
}
#define CLOUDURL QString(prefs.cloud_base_url)
diff --git a/mobile-widgets/qmlprefs.cpp b/mobile-widgets/qmlprefs.cpp
index 4e8cc8726..5220c9c2a 100644
--- a/mobile-widgets/qmlprefs.cpp
+++ b/mobile-widgets/qmlprefs.cpp
@@ -11,7 +11,6 @@ QMLPrefs *QMLPrefs::m_instance = NULL;
QMLPrefs::QMLPrefs() :
m_credentialStatus(qPrefCloudStorage::CS_UNKNOWN),
- m_distanceThreshold(1000),
m_oldStatus(qPrefCloudStorage::CS_UNKNOWN),
m_showPin(false),
m_timeThreshold(60)
@@ -86,17 +85,6 @@ void QMLPrefs::setCredentialStatus(const qPrefCloudStorage::cloud_status value)
}
}
-int QMLPrefs::distanceThreshold() const
-{
- return m_distanceThreshold;
-}
-
-void QMLPrefs::setDistanceThreshold(int distance)
-{
- m_distanceThreshold = distance;
- emit distanceThresholdChanged();
-}
-
qPrefCloudStorage::cloud_status QMLPrefs::oldStatus() const
{
return m_oldStatus;
diff --git a/mobile-widgets/qmlprefs.h b/mobile-widgets/qmlprefs.h
index f1cd41fb4..4127d9b79 100644
--- a/mobile-widgets/qmlprefs.h
+++ b/mobile-widgets/qmlprefs.h
@@ -25,10 +25,6 @@ class QMLPrefs : public QObject {
MEMBER m_credentialStatus
WRITE setCredentialStatus
NOTIFY credentialStatusChanged)
- Q_PROPERTY(int distanceThreshold
- MEMBER m_distanceThreshold
- WRITE setDistanceThreshold
- NOTIFY distanceThresholdChanged)
Q_PROPERTY(bool showPin
MEMBER m_showPin
WRITE setShowPin
@@ -64,9 +60,6 @@ public:
qPrefCloudStorage::cloud_status credentialStatus() const;
void setCredentialStatus(const qPrefCloudStorage::cloud_status value);
- int distanceThreshold() const;
- void setDistanceThreshold(int distance);
-
qPrefCloudStorage::cloud_status oldStatus() const;
void setOldStatus(const qPrefCloudStorage::cloud_status value);
@@ -88,7 +81,6 @@ private:
QString m_cloudPin;
QString m_cloudUserName;
qPrefCloudStorage::cloud_status m_credentialStatus;
- int m_distanceThreshold;
static QMLPrefs *m_instance;
qPrefCloudStorage::cloud_status m_oldStatus;
bool m_showPin;
@@ -99,7 +91,6 @@ signals:
void cloudPinChanged();
void cloudUserNameChanged();
void credentialStatusChanged();
- void distanceThresholdChanged();
void oldStatusChanged();
void showPinChanged();
void themeChanged();