diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-03-02 17:13:42 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-03-02 17:13:42 -0800 |
commit | 1f0b716021fa9e16f1a94159d7f4b353c4635308 (patch) | |
tree | 8dcca8625bbe4764079c0a6b760c0dd317259ba4 /qt-mobile/qmlmanager.cpp | |
parent | 605d08557396d9e1524c3d2aedf0817b4ac32ce1 (diff) | |
download | subsurface-1f0b716021fa9e16f1a94159d7f4b353c4635308.tar.gz |
QML UI: new property to tell the UI that we are accessing cloud storage
This can then be used to give the user visual feedback (instead of them
just thinking the app is hung).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 76ffb13af..085f3d5f8 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -53,6 +53,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), qDebug() << "Starting" << getUserAgent(); qDebug() << QStringLiteral("build with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion()); setStartPageText(tr("Starting...")); + setAccessingCloud(false); // create location manager service locationProvider = new GpsLocation(&appendTextToLogStandalone, this); set_git_update_cb(&gitProgressCB); @@ -88,6 +89,7 @@ void QMLManager::openLocalThenRemote(QString url) appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(i)); } appendTextToLog(QStringLiteral("have cloud credentials, trying to connect")); + setAccessingCloud(true); tryRetrieveDataFromBackend(); } @@ -250,6 +252,7 @@ void QMLManager::retrieveUserid() { if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) != 302) { appendTextToLog(QStringLiteral("Cloud storage connection not working correctly: ") + reply->readAll()); + setAccessingCloud(false); return; } setCredentialStatus(VALID); @@ -288,6 +291,7 @@ void QMLManager::loadDivesWithValidCredentials() if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) != 302) { appendTextToLog(QStringLiteral("Cloud storage connection not working correctly: ") + reply->readAll()); setStartPageText(tr("Cannot connect to cloud storage")); + setAccessingCloud(false); return; } setCredentialStatus(VALID); @@ -299,6 +303,7 @@ void QMLManager::loadDivesWithValidCredentials() QString errorString(get_error_string()); appendTextToLog(errorString); setStartPageText(tr("Cloud storage error: %1").arg(errorString)); + setAccessingCloud(false); return; } QByteArray fileNamePrt = QFile::encodeName(url); @@ -306,6 +311,7 @@ void QMLManager::loadDivesWithValidCredentials() qDebug() << "local cache was current, no need to modify dive list"; appendTextToLog("Cloud sync shows local cache was current"); setLoadFromCloud(true); + setAccessingCloud(false); return; } clear_dive_file_data(); @@ -322,6 +328,7 @@ void QMLManager::loadDivesWithValidCredentials() QString errorString(get_error_string()); appendTextToLog(errorString); setStartPageText(tr("Cloud storage error: %1").arg(errorString)); + setAccessingCloud(false); return; } prefs.unit_system = informational_prefs.unit_system; @@ -340,6 +347,7 @@ void QMLManager::loadDivesWithValidCredentials() if (dive_table.nr == 0) setStartPageText(tr("Cloud storage open successfully. No dives in dive list.")); setLoadFromCloud(true); + setAccessingCloud(false); } void QMLManager::refreshDiveList() @@ -930,3 +938,14 @@ QString QMLManager::getVersion() const return versionRe.cap(1); } + +bool QMLManager::accessingCloud() const +{ + return m_accessingCloud; +} + +void QMLManager::setAccessingCloud(bool status) +{ + m_accessingCloud = status; + emit accessingCloudChanged(); +} |