diff options
author | jan Iversen <jan@casacondor.com> | 2020-01-18 14:02:00 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-01-18 17:35:04 -0800 |
commit | c93b76eee663d5b000dcd9f0a3e7b4fa12b99b9b (patch) | |
tree | d0e95b7489d98227552313a00e9d641d49c1c67d /mobile-widgets/qmlinterface.h | |
parent | 9105a4c39b26d64a3fb316e2c38f119857dae813 (diff) | |
download | subsurface-c93b76eee663d5b000dcd9f0a3e7b4fa12b99b9b.tar.gz |
mobile-widgets: make cloud_verification_status type proof in QML.
Add CLOUD_STATUS enum to interface.
Add cloud_verifification_status variable to interface, and make
it strongly typed in QML.
using backend.cloud_verification_status = 1 will fail but
backend.cloud_verification_status = backend.CS_UNKNOWN is correct.
Added note to the original definitions of the enums that they have been
duplicated.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlinterface.h')
-rw-r--r-- | mobile-widgets/qmlinterface.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mobile-widgets/qmlinterface.h b/mobile-widgets/qmlinterface.h index 59981e0d1..a76781109 100644 --- a/mobile-widgets/qmlinterface.h +++ b/mobile-widgets/qmlinterface.h @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 #ifndef QMLINTERFACE_H #define QMLINTERFACE_H +#include "core/settings/qPrefCloudStorage.h" + #include <QObject> #include <QQmlContext> // This class is a pure interface class and may not contain any implementation code @@ -22,6 +24,7 @@ class QMLInterface : public QObject { Q_OBJECT // Q_PROPERTY used in QML + Q_PROPERTY(CLOUD_STATUS cloud_verification_status READ cloud_verification_status WRITE set_cloud_verification_status NOTIFY cloud_verification_statusChanged) public: static QMLInterface *instance(); @@ -88,6 +91,24 @@ public: }; Q_ENUM(DURATION); + enum CLOUD_STATUS { + CS_UNKNOWN, + CS_INCORRECT_USER_PASSWD, + CS_NEED_TO_VERIFY, + CS_VERIFIED, + CS_NOCLOUD + }; + Q_ENUM(CLOUD_STATUS); + +public: + CLOUD_STATUS cloud_verification_status() { return (CLOUD_STATUS)prefs.cloud_verification_status; } + +public slots: + void set_cloud_verification_status(CLOUD_STATUS value) { qPrefCloudStorage::set_cloud_verification_status(value); } + +signals: + void cloud_verification_statusChanged(CLOUD_STATUS); + private: QMLInterface() {} }; |