mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Unify credential states
Having two different enums around with more or less the same definition has lead to unclear code. After removing two not needed states on the mobile end, the remaining step to one enum for the credential state becomes almost is simple rename operation. Unfortunately, I do not know a way to embed a plain C enum from pref.h into the QMLManager object. So after this, there are still 2 enums around, but now identical. This commit is not changing any functionality. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
7e2803d6dd
commit
9a2d503d3b
5 changed files with 50 additions and 47 deletions
|
@ -174,7 +174,8 @@ enum cloud_status {
|
||||||
CS_UNKNOWN,
|
CS_UNKNOWN,
|
||||||
CS_INCORRECT_USER_PASSWD,
|
CS_INCORRECT_USER_PASSWD,
|
||||||
CS_NEED_TO_VERIFY,
|
CS_NEED_TO_VERIFY,
|
||||||
CS_VERIFIED
|
CS_VERIFIED,
|
||||||
|
CS_NOCLOUD
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct preferences prefs, default_prefs, git_prefs;
|
extern struct preferences prefs, default_prefs, git_prefs;
|
||||||
|
|
|
@ -24,7 +24,7 @@ Kirigami.ScrollablePage {
|
||||||
supportsRefreshing: true
|
supportsRefreshing: true
|
||||||
onRefreshingChanged: {
|
onRefreshingChanged: {
|
||||||
if (refreshing) {
|
if (refreshing) {
|
||||||
if (manager.credentialStatus === QMLManager.VALID) {
|
if (manager.credentialStatus === QMLManager.CS_VERIFIED) {
|
||||||
console.log("User pulled down dive list - syncing with cloud storage")
|
console.log("User pulled down dive list - syncing with cloud storage")
|
||||||
detailsWindow.endEditMode()
|
detailsWindow.endEditMode()
|
||||||
manager.saveChangesCloud(true)
|
manager.saveChangesCloud(true)
|
||||||
|
@ -266,7 +266,7 @@ Kirigami.ScrollablePage {
|
||||||
StartPage {
|
StartPage {
|
||||||
id: startPage
|
id: startPage
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: credentialStatus === QMLManager.NOCLOUD || (credentialStatus === QMLManager.VALID) ? 0 : 1
|
opacity: credentialStatus === QMLManager.CS_NOCLOUD || (credentialStatus === QMLManager.CS_VERIFIED) ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
||||||
function setupActions() {
|
function setupActions() {
|
||||||
|
@ -274,7 +274,7 @@ Kirigami.ScrollablePage {
|
||||||
page.actions.main = page.saveAction
|
page.actions.main = page.saveAction
|
||||||
page.actions.right = page.offlineAction
|
page.actions.right = page.offlineAction
|
||||||
page.title = qsTr("Cloud credentials")
|
page.title = qsTr("Cloud credentials")
|
||||||
} else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.NOCLOUD) {
|
} else if(manager.credentialStatus === QMLManager.CS_VERIFIED || manager.credentialStatus === QMLManager.CS_NOCLOUD) {
|
||||||
page.actions.main = page.downloadFromDCAction
|
page.actions.main = page.downloadFromDCAction
|
||||||
page.actions.right = page.addDiveAction
|
page.actions.right = page.addDiveAction
|
||||||
page.title = qsTr("Dive list")
|
page.title = qsTr("Dive list")
|
||||||
|
@ -289,6 +289,7 @@ Kirigami.ScrollablePage {
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
setupActions();
|
setupActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
setupActions();
|
setupActions();
|
||||||
}
|
}
|
||||||
|
@ -355,12 +356,12 @@ Kirigami.ScrollablePage {
|
||||||
iconName: "qrc:/qml/nocloud.svg"
|
iconName: "qrc:/qml/nocloud.svg"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
manager.syncToCloud = false
|
manager.syncToCloud = false
|
||||||
manager.credentialStatus = QMLManager.NOCLOUD
|
manager.credentialStatus = QMLManager.CS_NOCLOUD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onBackRequested: {
|
onBackRequested: {
|
||||||
if (startPage.visible && diveListView.count > 0 && manager.credentialStatus !== QMLManager.INVALID) {
|
if (startPage.visible && diveListView.count > 0 && manager.credentialStatus !== QMLManager.CS_INCORRECT_USER_PASSWD) {
|
||||||
manager.credentialStatus = oldStatus
|
manager.credentialStatus = oldStatus
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,10 @@ Kirigami.ApplicationWindow {
|
||||||
text: qsTr("Dive list")
|
text: qsTr("Dive list")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
manager.appendTextToLog("requested dive list with credential status " + manager.credentialStatus)
|
manager.appendTextToLog("requested dive list with credential status " + manager.credentialStatus)
|
||||||
if (manager.credentialStatus == QMLManager.UNKNOWN) {
|
if (manager.credentialStatus == QMLManager.CS_UNKNOWN) {
|
||||||
// the user has asked to change credentials - if the credentials before that
|
// the user has asked to change credentials - if the credentials before that
|
||||||
// were valid, go back to dive list
|
// were valid, go back to dive list
|
||||||
if (oldStatus == QMLManager.VALID) {
|
if (oldStatus == QMLManager.CS_VERIFIED) {
|
||||||
manager.credentialStatus = oldStatus
|
manager.credentialStatus = oldStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ Kirigami.ApplicationWindow {
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
iconName: "icons/ic_add.svg"
|
iconName: "icons/ic_add.svg"
|
||||||
text: qsTr("Add dive manually")
|
text: qsTr("Add dive manually")
|
||||||
enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.NOCLOUD
|
enabled: manager.credentialStatus === QMLManager.CS_VERIFIED || manager.credentialStatus === QMLManager.CS_NOCLOUD
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
returnTopPage() // otherwise odd things happen with the page stack
|
returnTopPage() // otherwise odd things happen with the page stack
|
||||||
startAddDive()
|
startAddDive()
|
||||||
|
@ -159,13 +159,13 @@ Kirigami.ApplicationWindow {
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
iconName: "icons/cloud_sync.svg"
|
iconName: "icons/cloud_sync.svg"
|
||||||
text: qsTr("Manual sync with cloud")
|
text: qsTr("Manual sync with cloud")
|
||||||
enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.NOCLOUD
|
enabled: manager.credentialStatus === QMLManager.CS_VERIFIED || manager.credentialStatus === QMLManager.CS_NOCLOUD
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (manager.credentialStatus === QMLManager.NOCLOUD) {
|
if (manager.credentialStatus === QMLManager.CS_NOCLOUD) {
|
||||||
returnTopPage()
|
returnTopPage()
|
||||||
oldStatus = manager.credentialStatus
|
oldStatus = manager.credentialStatus
|
||||||
manager.startPageText = "Enter valid cloud storage credentials"
|
manager.startPageText = "Enter valid cloud storage credentials"
|
||||||
manager.credentialStatus = QMLManager.UNKNOWN
|
manager.credentialStatus = QMLManager.CS_UNKNOWN
|
||||||
globalDrawer.close()
|
globalDrawer.close()
|
||||||
} else {
|
} else {
|
||||||
globalDrawer.close()
|
globalDrawer.close()
|
||||||
|
@ -178,7 +178,7 @@ Kirigami.ApplicationWindow {
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
iconName: syncToCloud ? "icons/ic_cloud_off.svg" : "icons/ic_cloud_done.svg"
|
iconName: syncToCloud ? "icons/ic_cloud_off.svg" : "icons/ic_cloud_done.svg"
|
||||||
text: syncToCloud ? qsTr("Offline mode") : qsTr("Enable auto cloud sync")
|
text: syncToCloud ? qsTr("Offline mode") : qsTr("Enable auto cloud sync")
|
||||||
enabled: manager.credentialStatus !== QMLManager.NOCLOUD
|
enabled: manager.credentialStatus !== QMLManager.CS_NOCLOUD
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
syncToCloud = !syncToCloud
|
syncToCloud = !syncToCloud
|
||||||
if (!syncToCloud) {
|
if (!syncToCloud) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
|
||||||
deletedTrip(0),
|
deletedTrip(0),
|
||||||
m_updateSelectedDive(-1),
|
m_updateSelectedDive(-1),
|
||||||
m_selectedDiveTimestamp(0),
|
m_selectedDiveTimestamp(0),
|
||||||
m_credentialStatus(UNKNOWN),
|
m_credentialStatus(CS_UNKNOWN),
|
||||||
alreadySaving(false),
|
alreadySaving(false),
|
||||||
m_device_data(new DCDeviceData(this)),
|
m_device_data(new DCDeviceData(this)),
|
||||||
m_libdcLog(false)
|
m_libdcLog(false)
|
||||||
|
@ -174,8 +174,8 @@ void QMLManager::openLocalThenRemote(QString url)
|
||||||
setNotificationText(tr("Opening local data file failed"));
|
setNotificationText(tr("Opening local data file failed"));
|
||||||
} else {
|
} else {
|
||||||
// if we can load from the cache, we know that we have a valid cloud account
|
// if we can load from the cache, we know that we have a valid cloud account
|
||||||
if (credentialStatus() == UNKNOWN)
|
if (credentialStatus() == CS_UNKNOWN)
|
||||||
setCredentialStatus(VALID);
|
setCredentialStatus(CS_VERIFIED);
|
||||||
prefs.unit_system = git_prefs.unit_system;
|
prefs.unit_system = git_prefs.unit_system;
|
||||||
if (git_prefs.unit_system == IMPERIAL)
|
if (git_prefs.unit_system == IMPERIAL)
|
||||||
git_prefs.units = IMPERIAL_units;
|
git_prefs.units = IMPERIAL_units;
|
||||||
|
@ -193,8 +193,8 @@ void QMLManager::openLocalThenRemote(QString url)
|
||||||
appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(dive_table.nr));
|
appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(dive_table.nr));
|
||||||
setNotificationText(tr("%1 dives loaded from local dive data file").arg(dive_table.nr));
|
setNotificationText(tr("%1 dives loaded from local dive data file").arg(dive_table.nr));
|
||||||
}
|
}
|
||||||
if (oldStatus() == NOCLOUD) {
|
if (oldStatus() == CS_NOCLOUD) {
|
||||||
// if we switch to credentials from NOCLOUD, we take things online temporarily
|
// if we switch to credentials from CS_NOCLOUD, we take things online temporarily
|
||||||
prefs.git_local_only = false;
|
prefs.git_local_only = false;
|
||||||
appendTextToLog(QStringLiteral("taking things online to be able to switch to cloud account"));
|
appendTextToLog(QStringLiteral("taking things online to be able to switch to cloud account"));
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ void QMLManager::finishSetup()
|
||||||
alreadySaving = true;
|
alreadySaving = true;
|
||||||
openLocalThenRemote(url);
|
openLocalThenRemote(url);
|
||||||
} else if (!same_string(existing_filename, "")) {
|
} else if (!same_string(existing_filename, "")) {
|
||||||
setCredentialStatus(NOCLOUD);
|
setCredentialStatus(CS_NOCLOUD);
|
||||||
appendTextToLog(tr("working in no-cloud mode"));
|
appendTextToLog(tr("working in no-cloud mode"));
|
||||||
int error = parse_file(existing_filename);
|
int error = parse_file(existing_filename);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -245,7 +245,7 @@ void QMLManager::finishSetup()
|
||||||
appendTextToLog(QString("working in no-cloud mode, finished loading %1 dives from %2").arg(dive_table.nr).arg(existing_filename));
|
appendTextToLog(QString("working in no-cloud mode, finished loading %1 dives from %2").arg(dive_table.nr).arg(existing_filename));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setCredentialStatus(UNKNOWN);
|
setCredentialStatus(CS_UNKNOWN);
|
||||||
appendTextToLog(tr("no cloud credentials"));
|
appendTextToLog(tr("no cloud credentials"));
|
||||||
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
|
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ void QMLManager::provideAuth(QNetworkReply *reply, QAuthenticator *auth)
|
||||||
// OK, credentials have been tried and didn't work, so they are invalid
|
// OK, credentials have been tried and didn't work, so they are invalid
|
||||||
appendTextToLog("Cloud credentials are invalid");
|
appendTextToLog("Cloud credentials are invalid");
|
||||||
setStartPageText(RED_FONT + tr("Cloud credentials are invalid") + END_FONT);
|
setStartPageText(RED_FONT + tr("Cloud credentials are invalid") + END_FONT);
|
||||||
setCredentialStatus(INVALID);
|
setCredentialStatus(CS_INCORRECT_USER_PASSWD);
|
||||||
reply->disconnect();
|
reply->disconnect();
|
||||||
reply->abort();
|
reply->abort();
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
@ -455,7 +455,7 @@ void QMLManager::retrieveUserid()
|
||||||
revertToNoCloudIfNeeded();
|
revertToNoCloudIfNeeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setCredentialStatus(VALID);
|
setCredentialStatus(CS_VERIFIED);
|
||||||
QString userid(prefs.userid);
|
QString userid(prefs.userid);
|
||||||
if (userid.isEmpty()) {
|
if (userid.isEmpty()) {
|
||||||
if (same_string(prefs.cloud_storage_email, "") || same_string(prefs.cloud_storage_password, "")) {
|
if (same_string(prefs.cloud_storage_email, "") || same_string(prefs.cloud_storage_password, "")) {
|
||||||
|
@ -474,7 +474,7 @@ void QMLManager::retrieveUserid()
|
||||||
s.setValue("subsurface_webservice_uid", prefs.userid);
|
s.setValue("subsurface_webservice_uid", prefs.userid);
|
||||||
s.sync();
|
s.sync();
|
||||||
}
|
}
|
||||||
setCredentialStatus(VALID);
|
setCredentialStatus(CS_VERIFIED);
|
||||||
setStartPageText(tr("Cloud credentials valid, loading dives..."));
|
setStartPageText(tr("Cloud credentials valid, loading dives..."));
|
||||||
// this only gets called with "alreadySaving" already locked
|
// this only gets called with "alreadySaving" already locked
|
||||||
loadDivesWithValidCredentials();
|
loadDivesWithValidCredentials();
|
||||||
|
@ -529,7 +529,7 @@ successful_exit:
|
||||||
setLoadFromCloud(true);
|
setLoadFromCloud(true);
|
||||||
// if we came from local storage mode, let's merge the local data into the local cache
|
// if we came from local storage mode, let's merge the local data into the local cache
|
||||||
// for the remote data - which then later gets merged with the remote data if necessary
|
// for the remote data - which then later gets merged with the remote data if necessary
|
||||||
if (oldStatus() == NOCLOUD) {
|
if (oldStatus() == CS_NOCLOUD) {
|
||||||
git_storage_update_progress(qPrintable(tr("Loading dives from local storage ('no cloud' mode)")));
|
git_storage_update_progress(qPrintable(tr("Loading dives from local storage ('no cloud' mode)")));
|
||||||
dive_table.preexisting = dive_table.nr;
|
dive_table.preexisting = dive_table.nr;
|
||||||
mergeLocalRepo();
|
mergeLocalRepo();
|
||||||
|
@ -557,11 +557,11 @@ void QMLManager::revertToNoCloudIfNeeded()
|
||||||
currentGitLocalOnly = false;
|
currentGitLocalOnly = false;
|
||||||
prefs.git_local_only = true;
|
prefs.git_local_only = true;
|
||||||
}
|
}
|
||||||
if (oldStatus() == NOCLOUD) {
|
if (oldStatus() == CS_NOCLOUD) {
|
||||||
// we tried to switch to a cloud account and had previously used local data,
|
// we tried to switch to a cloud account and had previously used local data,
|
||||||
// but connecting to the cloud account (and subsequently merging the local
|
// but connecting to the cloud account (and subsequently merging the local
|
||||||
// and cloud data) failed - so let's delete the cloud credentials and go
|
// and cloud data) failed - so let's delete the cloud credentials and go
|
||||||
// back to NOCLOUD mode in order to prevent us from losing the locally stored
|
// back to CS_NOCLOUD mode in order to prevent us from losing the locally stored
|
||||||
// dives
|
// dives
|
||||||
if (syncToCloud() == false) {
|
if (syncToCloud() == false) {
|
||||||
appendTextToLog(QStringLiteral("taking things back offline since sync with cloud failed"));
|
appendTextToLog(QStringLiteral("taking things back offline since sync with cloud failed"));
|
||||||
|
@ -573,7 +573,7 @@ void QMLManager::revertToNoCloudIfNeeded()
|
||||||
prefs.cloud_storage_password = NULL;
|
prefs.cloud_storage_password = NULL;
|
||||||
setCloudUserName("");
|
setCloudUserName("");
|
||||||
setCloudPassword("");
|
setCloudPassword("");
|
||||||
setCredentialStatus(NOCLOUD);
|
setCredentialStatus(CS_NOCLOUD);
|
||||||
set_filename(NOCLOUD_LOCALSTORAGE, true);
|
set_filename(NOCLOUD_LOCALSTORAGE, true);
|
||||||
setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT);
|
setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT);
|
||||||
}
|
}
|
||||||
|
@ -1004,7 +1004,7 @@ void QMLManager::changesNeedSaving()
|
||||||
void QMLManager::saveChangesLocal()
|
void QMLManager::saveChangesLocal()
|
||||||
{
|
{
|
||||||
if (unsaved_changes()) {
|
if (unsaved_changes()) {
|
||||||
if (credentialStatus() == NOCLOUD) {
|
if (credentialStatus() == CS_NOCLOUD) {
|
||||||
if (same_string(existing_filename, "")) {
|
if (same_string(existing_filename, "")) {
|
||||||
char *filename = NOCLOUD_LOCALSTORAGE;
|
char *filename = NOCLOUD_LOCALSTORAGE;
|
||||||
if (git_create_local_repo(filename))
|
if (git_create_local_repo(filename))
|
||||||
|
@ -1367,27 +1367,27 @@ void QMLManager::setStartPageText(const QString& text)
|
||||||
emit startPageTextChanged();
|
emit startPageTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMLManager::credentialStatus_t QMLManager::credentialStatus() const
|
QMLManager::cloud_status_qml QMLManager::credentialStatus() const
|
||||||
{
|
{
|
||||||
return m_credentialStatus;
|
return m_credentialStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::setCredentialStatus(const credentialStatus_t value)
|
void QMLManager::setCredentialStatus(const cloud_status_qml value)
|
||||||
{
|
{
|
||||||
if (m_credentialStatus != value) {
|
if (m_credentialStatus != value) {
|
||||||
if (value == NOCLOUD)
|
if (value == CS_NOCLOUD)
|
||||||
appendTextToLog("Switching to no cloud mode");
|
appendTextToLog("Switching to no cloud mode");
|
||||||
m_credentialStatus = value;
|
m_credentialStatus = value;
|
||||||
emit credentialStatusChanged();
|
emit credentialStatusChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMLManager::credentialStatus_t QMLManager::oldStatus() const
|
QMLManager::cloud_status_qml QMLManager::oldStatus() const
|
||||||
{
|
{
|
||||||
return m_oldStatus;
|
return m_oldStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::setOldStatus(const credentialStatus_t value)
|
void QMLManager::setOldStatus(const cloud_status_qml value)
|
||||||
{
|
{
|
||||||
if (m_oldStatus != value) {
|
if (m_oldStatus != value) {
|
||||||
m_oldStatus = value;
|
m_oldStatus = value;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
class QMLManager : public QObject {
|
class QMLManager : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(credentialStatus_t)
|
Q_ENUMS(cloud_status_qml)
|
||||||
Q_PROPERTY(QString cloudUserName READ cloudUserName WRITE setCloudUserName NOTIFY cloudUserNameChanged)
|
Q_PROPERTY(QString cloudUserName READ cloudUserName WRITE setCloudUserName NOTIFY cloudUserNameChanged)
|
||||||
Q_PROPERTY(QString cloudPassword READ cloudPassword WRITE setCloudPassword NOTIFY cloudPasswordChanged)
|
Q_PROPERTY(QString cloudPassword READ cloudPassword WRITE setCloudPassword NOTIFY cloudPasswordChanged)
|
||||||
Q_PROPERTY(QString cloudPin READ cloudPin WRITE setCloudPin NOTIFY cloudPinChanged)
|
Q_PROPERTY(QString cloudPin READ cloudPin WRITE setCloudPin NOTIFY cloudPinChanged)
|
||||||
|
@ -29,8 +29,8 @@ class QMLManager : public QObject {
|
||||||
Q_PROPERTY(bool loadFromCloud READ loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged)
|
Q_PROPERTY(bool loadFromCloud READ loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged)
|
||||||
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
|
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
|
||||||
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
|
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
|
||||||
Q_PROPERTY(credentialStatus_t credentialStatus READ credentialStatus WRITE setCredentialStatus NOTIFY credentialStatusChanged)
|
Q_PROPERTY(cloud_status_qml credentialStatus READ credentialStatus WRITE setCredentialStatus NOTIFY credentialStatusChanged)
|
||||||
Q_PROPERTY(credentialStatus_t oldStatus READ oldStatus WRITE setOldStatus NOTIFY oldStatusChanged)
|
Q_PROPERTY(cloud_status_qml oldStatus READ oldStatus WRITE setOldStatus NOTIFY oldStatusChanged)
|
||||||
Q_PROPERTY(QString notificationText READ notificationText WRITE setNotificationText NOTIFY notificationTextChanged)
|
Q_PROPERTY(QString notificationText READ notificationText WRITE setNotificationText NOTIFY notificationTextChanged)
|
||||||
Q_PROPERTY(bool syncToCloud READ syncToCloud WRITE setSyncToCloud NOTIFY syncToCloudChanged)
|
Q_PROPERTY(bool syncToCloud READ syncToCloud WRITE setSyncToCloud NOTIFY syncToCloudChanged)
|
||||||
Q_PROPERTY(int updateSelectedDive READ updateSelectedDive WRITE setUpdateSelectedDive NOTIFY updateSelectedDiveChanged)
|
Q_PROPERTY(int updateSelectedDive READ updateSelectedDive WRITE setUpdateSelectedDive NOTIFY updateSelectedDiveChanged)
|
||||||
|
@ -48,11 +48,12 @@ public:
|
||||||
QMLManager();
|
QMLManager();
|
||||||
~QMLManager();
|
~QMLManager();
|
||||||
|
|
||||||
enum credentialStatus_t {
|
enum cloud_status_qml {
|
||||||
UNKNOWN,
|
CS_UNKNOWN,
|
||||||
INVALID,
|
CS_INCORRECT_USER_PASSWD,
|
||||||
VALID,
|
CS_NEED_TO_VERIFY,
|
||||||
NOCLOUD
|
CS_VERIFIED,
|
||||||
|
CS_NOCLOUD
|
||||||
};
|
};
|
||||||
|
|
||||||
static QMLManager *instance();
|
static QMLManager *instance();
|
||||||
|
@ -91,11 +92,11 @@ public:
|
||||||
QString startPageText() const;
|
QString startPageText() const;
|
||||||
void setStartPageText(const QString& text);
|
void setStartPageText(const QString& text);
|
||||||
|
|
||||||
credentialStatus_t credentialStatus() const;
|
cloud_status_qml credentialStatus() const;
|
||||||
void setCredentialStatus(const credentialStatus_t value);
|
void setCredentialStatus(const cloud_status_qml value);
|
||||||
|
|
||||||
credentialStatus_t oldStatus() const;
|
cloud_status_qml oldStatus() const;
|
||||||
void setOldStatus(const credentialStatus_t value);
|
void setOldStatus(const cloud_status_qml value);
|
||||||
|
|
||||||
QString logText() const;
|
QString logText() const;
|
||||||
void setLogText(const QString &logText);
|
void setLogText(const QString &logText);
|
||||||
|
@ -207,8 +208,8 @@ private:
|
||||||
bool m_syncToCloud;
|
bool m_syncToCloud;
|
||||||
int m_updateSelectedDive;
|
int m_updateSelectedDive;
|
||||||
int m_selectedDiveTimestamp;
|
int m_selectedDiveTimestamp;
|
||||||
credentialStatus_t m_credentialStatus;
|
cloud_status_qml m_credentialStatus;
|
||||||
credentialStatus_t m_oldStatus;
|
cloud_status_qml m_oldStatus;
|
||||||
qreal m_lastDevicePixelRatio;
|
qreal m_lastDevicePixelRatio;
|
||||||
QElapsedTimer timer;
|
QElapsedTimer timer;
|
||||||
bool alreadySaving;
|
bool alreadySaving;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue