[Pkg-owncloud-commits] [owncloud-client] 48/78: Progress: Don't count items without propagation jobs #4856 (#4910)

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Jun 24 16:29:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit b9fdae6d67e962b43d678d62f29c0021db346d9f
Author: ckamm <mail at ckamm.de>
Date:   Fri May 27 10:52:00 2016 +0200

    Progress: Don't count items without propagation jobs #4856 (#4910)
    
    * Progress: Don't count dirs without propagation jobs #4856
    
    These directory SyncFileItems are necessary for bookkeeping
    but should not influence the progress display at all.
    
    * Progress: Skip ignored files #4856
---
 src/libsync/progressdispatcher.cpp | 45 +++++++++++++++++++++++++++++++-------
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/src/libsync/progressdispatcher.cpp b/src/libsync/progressdispatcher.cpp
index 560c1ff..3e9540a 100644
--- a/src/libsync/progressdispatcher.cpp
+++ b/src/libsync/progressdispatcher.cpp
@@ -155,16 +155,37 @@ bool ProgressInfo::isUpdatingEstimates() const
     return _updateEstimatesTimer.isActive();
 }
 
+static bool shouldCountProgress(const SyncFileItem &item)
+{
+    const auto instruction = item._instruction;
+
+    // Don't worry about directories that won't have propagation
+    // jobs associated with them.
+    if (item._isDirectory
+            && (instruction == CSYNC_INSTRUCTION_NONE
+                || instruction == CSYNC_INSTRUCTION_SYNC
+                || instruction == CSYNC_INSTRUCTION_CONFLICT)) {
+        return false;
+    }
+
+    // Skip any ignored or error files, we do nothing with them.
+    if (instruction == CSYNC_INSTRUCTION_IGNORE
+            || instruction == CSYNC_INSTRUCTION_ERROR) {
+        return false;
+    }
+
+    return true;
+}
+
 void ProgressInfo::adjustTotalsForFile(const SyncFileItem &item)
 {
-    if (!item._isDirectory) {
-        _fileProgress._total++;
-        if (isSizeDependent(item)) {
-            _sizeProgress._total += item._size;
-        }
-    } else if (item._instruction != CSYNC_INSTRUCTION_NONE) {
-        // Added or removed directories certainly count.
-        _fileProgress._total++;
+    if (!shouldCountProgress(item)) {
+        return;
+    }
+
+    _fileProgress._total += item._affectedItems;
+    if (isSizeDependent(item)) {
+        _sizeProgress._total += item._size;
     }
 }
 
@@ -195,6 +216,10 @@ quint64 ProgressInfo::completedSize() const
 
 void ProgressInfo::setProgressComplete(const SyncFileItem &item)
 {
+    if (!shouldCountProgress(item)) {
+        return;
+    }
+
     _currentItems.remove(item._file);
     _fileProgress.setCompleted(_fileProgress._completed + item._affectedItems);
     if (ProgressInfo::isSizeDependent(item)) {
@@ -206,6 +231,10 @@ void ProgressInfo::setProgressComplete(const SyncFileItem &item)
 
 void ProgressInfo::setProgressItem(const SyncFileItem &item, quint64 completed)
 {
+    if (!shouldCountProgress(item)) {
+        return;
+    }
+
     _currentItems[item._file]._item = item;
     _currentItems[item._file]._progress._total = item._size;
     _currentItems[item._file]._progress.setCompleted(completed);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list