diff options
-rw-r--r-- | core/settings/qPrefCloudStorage.h | 1 | ||||
-rw-r--r-- | mobile-widgets/qmlinterface.cpp | 2 | ||||
-rw-r--r-- | mobile-widgets/qmlinterface.h | 21 |
3 files changed, 24 insertions, 0 deletions
diff --git a/core/settings/qPrefCloudStorage.h b/core/settings/qPrefCloudStorage.h index d7d2b4ee4..b0d24227a 100644 --- a/core/settings/qPrefCloudStorage.h +++ b/core/settings/qPrefCloudStorage.h @@ -31,6 +31,7 @@ public: static void sync() { loadSync(true); } public: + // NOTE: these enums are duplicated in mobile-widgets/qmlinterface.h enum cloud_status { CS_UNKNOWN, CS_INCORRECT_USER_PASSWD, diff --git a/mobile-widgets/qmlinterface.cpp b/mobile-widgets/qmlinterface.cpp index 78aba6a5c..2f470bba4 100644 --- a/mobile-widgets/qmlinterface.cpp +++ b/mobile-widgets/qmlinterface.cpp @@ -18,4 +18,6 @@ void QMLInterface::setup(QQmlContext *ct) qmlRegisterUncreatableType<QMLInterface>("org.subsurfacedivelog.mobile",1,0,"Enums","Enum is not a type"); // relink signals to QML + connect(qPrefCloudStorage::instance(), &qPrefCloudStorage::cloud_verification_statusChanged, + [=] (int value) { emit instance()->cloud_verification_statusChanged(CLOUD_STATUS(value)); }); } 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() {} }; |