mobile-widgets: make show_developer persistent

Remove developer from qmlprefs and use qPref instead
Update qml

show_developer is saved on disk, and thus remembered between starts.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
jan Iversen 2018-09-12 08:55:55 +02:00 committed by Dirk Hohndel
parent f8e9fb72f1
commit c454f6954f
4 changed files with 3 additions and 18 deletions

View file

@ -363,10 +363,10 @@ Kirigami.ScrollablePage {
} }
SsrfSwitch { SsrfSwitch {
id: developerButton id: developerButton
checked: prefs.developer checked: PrefDisplay.show_developer
Layout.preferredWidth: gridWidth * 0.25 Layout.preferredWidth: gridWidth * 0.25
onClicked: { onClicked: {
prefs.developer = checked PrefDisplay.show_developer = checked
} }
} }
} }

View file

@ -361,7 +361,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
name: ":/icons/ic_adb.svg" name: ":/icons/ic_adb.svg"
} }
text: qsTr("Developer") text: qsTr("Developer")
visible: prefs.developer visible: PrefDisplay.show_developer
Kirigami.Action { Kirigami.Action {
text: qsTr("App log") text: qsTr("App log")
onTriggered: { onTriggered: {

View file

@ -11,7 +11,6 @@ QMLPrefs *QMLPrefs::m_instance = NULL;
QMLPrefs::QMLPrefs() : QMLPrefs::QMLPrefs() :
m_credentialStatus(qPrefCloudStorage::CS_UNKNOWN), m_credentialStatus(qPrefCloudStorage::CS_UNKNOWN),
m_developer(false),
m_distanceThreshold(1000), m_distanceThreshold(1000),
m_oldStatus(qPrefCloudStorage::CS_UNKNOWN), m_oldStatus(qPrefCloudStorage::CS_UNKNOWN),
m_showPin(false), m_showPin(false),
@ -87,12 +86,6 @@ void QMLPrefs::setCredentialStatus(const qPrefCloudStorage::cloud_status value)
} }
} }
void QMLPrefs::setDeveloper(bool value)
{
m_developer = value;
emit developerChanged();
}
int QMLPrefs::distanceThreshold() const int QMLPrefs::distanceThreshold() const
{ {
return m_distanceThreshold; return m_distanceThreshold;

View file

@ -25,10 +25,6 @@ class QMLPrefs : public QObject {
MEMBER m_credentialStatus MEMBER m_credentialStatus
WRITE setCredentialStatus WRITE setCredentialStatus
NOTIFY credentialStatusChanged) NOTIFY credentialStatusChanged)
Q_PROPERTY(bool developer
MEMBER m_developer
WRITE setDeveloper
NOTIFY developerChanged)
Q_PROPERTY(int distanceThreshold Q_PROPERTY(int distanceThreshold
MEMBER m_distanceThreshold MEMBER m_distanceThreshold
WRITE setDistanceThreshold WRITE setDistanceThreshold
@ -68,8 +64,6 @@ public:
qPrefCloudStorage::cloud_status credentialStatus() const; qPrefCloudStorage::cloud_status credentialStatus() const;
void setCredentialStatus(const qPrefCloudStorage::cloud_status value); void setCredentialStatus(const qPrefCloudStorage::cloud_status value);
void setDeveloper(bool value);
int distanceThreshold() const; int distanceThreshold() const;
void setDistanceThreshold(int distance); void setDistanceThreshold(int distance);
@ -94,7 +88,6 @@ private:
QString m_cloudPin; QString m_cloudPin;
QString m_cloudUserName; QString m_cloudUserName;
qPrefCloudStorage::cloud_status m_credentialStatus; qPrefCloudStorage::cloud_status m_credentialStatus;
bool m_developer;
int m_distanceThreshold; int m_distanceThreshold;
static QMLPrefs *m_instance; static QMLPrefs *m_instance;
qPrefCloudStorage::cloud_status m_oldStatus; qPrefCloudStorage::cloud_status m_oldStatus;
@ -107,7 +100,6 @@ signals:
void cloudUserNameChanged(); void cloudUserNameChanged();
void credentialStatusChanged(); void credentialStatusChanged();
void distanceThresholdChanged(); void distanceThresholdChanged();
void developerChanged();
void oldStatusChanged(); void oldStatusChanged();
void showPinChanged(); void showPinChanged();
void themeChanged(); void themeChanged();