diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-04-19 10:27:18 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-19 10:34:49 -0700 |
commit | 660f421d6d690f363893e8ca0edcd8203df73582 (patch) | |
tree | e263c24e3c3ee8422ad54393149bad57ba788f34 /mobile-widgets | |
parent | ac0c1eb5e17d33db52d3aa803bcfaaa4c53f1a3e (diff) | |
download | subsurface-660f421d6d690f363893e8ca0edcd8203df73582.tar.gz |
QML UI: correctly show if we are accessing remote or local storage
This makes sure that if the user switches to offline mode they don't get
incorrect notifications that tell them that they are accessing cloud
storage.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/main.qml | 7 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 14 |
2 files changed, 12 insertions, 9 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 8497e7e53..06e691eee 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -22,10 +22,15 @@ Kirigami.ApplicationWindow { property bool showingDiveList: false property alias syncToCloud: manager.syncToCloud onAccessingCloudChanged: { + // >= 0 for updating cloud, -1 for hide, < -1 for local storage if (accessingCloud >= 0) { // we now keep updating this to show progress, so timing out after 30 seconds is more useful // but should still be very conservative - showPassiveNotification("Accessing Subsurface Cloud Storage " + accessingCloud +"%", 30000); + showPassiveNotification("Accessing Subsurface cloud storage " + accessingCloud +"%", 30000); + } else if (accessingCloud < -1) { + // local storage should be much faster, so timeout of 5 seconds + // the offset of 2 is so that things start 0 again + showPassiveNotification("Accessing local storage " + -(accessingCloud + 2) +"%", 5000); } else { hidePassiveNotification(); } diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index ed5951c26..c2c60ce5c 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -46,7 +46,7 @@ extern "C" int gitProgressCB(bool reset, const char *text) if (!timer.isValid() || reset) { timer.restart(); lastTime = 0; - lastPercent = 0; + lastPercent = prefs.git_local_only ? -2 : 0; lastText.clear(); } if (self) { @@ -54,7 +54,11 @@ extern "C" int gitProgressCB(bool reset, const char *text) // don't show the same status twice in 200ms if (lastText == text && elapsed - lastTime < 200) return 0; - self->loadDiveProgress(++lastPercent); + if (lastPercent < 0) + lastPercent--; + else + lastPercent++; + self->loadDiveProgress(lastPercent); QString logText = QString::number(elapsed / 1000.0, 'f', 1) + " / " + QString::number((elapsed - lastTime) / 1000.0, 'f', 3) + QString(" : git %1 (%2)").arg(lastPercent).arg(text); self->appendTextToLog(logText); @@ -356,13 +360,7 @@ void QMLManager::retrieveUserid() void QMLManager::loadDiveProgress(int percent) { - QString text(tr("Loading dive list from cloud storage.")); setAccessingCloud(percent); - while (percent > 0) { - text.append("."); - percent -= 10; - } - setStartPageText(text); } void QMLManager::loadDivesWithValidCredentials() |