From baa828e900b2dc1c647c62483a13737baadfa76c Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Wed, 12 Sep 2018 09:12:03 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/Settings.qml | 5 ++--- mobile-widgets/qmlmanager.cpp | 2 -- mobile-widgets/qmlprefs.cpp | 12 ------------ mobile-widgets/qmlprefs.h | 9 --------- 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(); -- cgit v1.2.3-70-g09d2