Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralex-z <blackslayer4@gmail.com>2022-09-06 14:36:29 +0300
committerallexzander <blackslayer4@gmail.com>2022-09-07 09:31:05 +0300
commit7ba681544c91400665193cf135e2ee3925021727 (patch)
tree9c57c673fe25bc420ca5393dd5bd815683790ca7 /src
parent4dbbcbebf23b127ec0ccb4a6ae5dab103c2a659f (diff)
Fix wrong estimated time when doing sync.
Signed-off-by: alex-z <blackslayer4@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/folderstatusmodel.cpp26
-rw-r--r--src/gui/folderstatusmodel.h2
2 files changed, 22 insertions, 6 deletions
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 51bbe4f74..80080acc5 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -963,6 +963,10 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
auto *pi = &_folders[folderIndex]._progress;
+ if (progress.status() == ProgressInfo::Starting) {
+ _isSyncRunningForAwhile = false;
+ }
+
QVector<int> roles;
roles << FolderStatusDelegate::SyncProgressItemString
<< FolderStatusDelegate::WarningCount
@@ -1086,13 +1090,23 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
QString s1 = Utility::octetsToString(completedSize);
QString s2 = Utility::octetsToString(totalSize);
- if (progress.trustEta()) {
+ const auto estimatedEta = progress.totalProgress().estimatedEta;
+
+ if (progress.trustEta() && (estimatedEta > 0 || _isSyncRunningForAwhile)) {
+ _isSyncRunningForAwhile = true;
//: Example text: "5 minutes left, 12 MB of 345 MB, file 6 of 7"
- overallSyncString = tr("%5 left, %1 of %2, file %3 of %4")
- .arg(s1, s2)
- .arg(currentFile)
- .arg(totalFileCount)
- .arg(Utility::durationToDescriptiveString1(progress.totalProgress().estimatedEta));
+ if (estimatedEta == 0) {
+ overallSyncString = tr("A few seconds left, %1 of %2, file %3 of %4")
+ .arg(s1, s2)
+ .arg(currentFile)
+ .arg(totalFileCount);
+ } else {
+ overallSyncString = tr("%5 left, %1 of %2, file %3 of %4")
+ .arg(s1, s2)
+ .arg(currentFile)
+ .arg(totalFileCount)
+ .arg(Utility::durationToDescriptiveString1(estimatedEta));
+ }
} else {
//: Example text: "12 MB of 345 MB, file 6 of 7"
diff --git a/src/gui/folderstatusmodel.h b/src/gui/folderstatusmodel.h
index 896a19550..9896d5644 100644
--- a/src/gui/folderstatusmodel.h
+++ b/src/gui/folderstatusmodel.h
@@ -147,6 +147,8 @@ private:
const AccountState *_accountState = nullptr;
bool _dirty = false; // If the selective sync checkboxes were changed
+ bool _isSyncRunningForAwhile = false;
+
/**
* Keeps track of items that are fetching data from the server.
*