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

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsync/owncloudpropagator.cpp5
-rw-r--r--src/libsync/owncloudpropagator.h2
-rw-r--r--src/libsync/progressdispatcher.cpp18
-rw-r--r--src/libsync/progressdispatcher.h13
-rw-r--r--src/libsync/syncengine.cpp7
-rw-r--r--src/libsync/syncengine.h1
6 files changed, 45 insertions, 1 deletions
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index d960b4a2d..cce3cc139 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -674,6 +674,11 @@ void OwncloudPropagator::scheduleNextJobImpl()
}
}
+void OwncloudPropagator::reportFileTotal(const SyncFileItem &item, quint64 newSize)
+{
+ emit updateFileTotal(item, newSize);
+}
+
void OwncloudPropagator::reportProgress(const SyncFileItem &item, quint64 bytes)
{
emit progress(item, bytes);
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index 7cd00531d..e56a47b0d 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -457,6 +457,7 @@ public:
void scheduleNextJob();
void reportProgress(const SyncFileItem &, quint64 bytes);
+ void reportFileTotal(const SyncFileItem &item, quint64 newSize);
void abort()
{
@@ -515,6 +516,7 @@ signals:
void newItem(const SyncFileItemPtr &);
void itemCompleted(const SyncFileItemPtr &);
void progress(const SyncFileItem &, quint64 bytes);
+ void updateFileTotal(const SyncFileItem &, quint64 newSize);
void finished(bool success);
/** Emitted when propagation has problems with a locked file. */
diff --git a/src/libsync/progressdispatcher.cpp b/src/libsync/progressdispatcher.cpp
index bfdc0521b..9b5edd360 100644
--- a/src/libsync/progressdispatcher.cpp
+++ b/src/libsync/progressdispatcher.cpp
@@ -195,6 +195,22 @@ void ProgressInfo::adjustTotalsForFile(const SyncFileItem &item)
}
}
+void ProgressInfo::updateTotalsForFile(const SyncFileItem &item, quint64 newSize)
+{
+ if (!shouldCountProgress(item)) {
+ return;
+ }
+
+ if (!_currentItems.contains(item._file)) {
+ _sizeProgress._total += newSize - item._size;
+ } else {
+ _sizeProgress._total += newSize - _currentItems[item._file]._progress._total;
+ }
+
+ setProgressItem(item, 0);
+ _currentItems[item._file]._progress._total = newSize;
+}
+
quint64 ProgressInfo::totalFiles() const
{
return _fileProgress._total;
@@ -229,7 +245,7 @@ void ProgressInfo::setProgressComplete(const SyncFileItem &item)
_currentItems.remove(item._file);
_fileProgress.setCompleted(_fileProgress._completed + item._affectedItems);
if (ProgressInfo::isSizeDependent(item)) {
- _totalSizeOfCompletedJobs += item._size;
+ _totalSizeOfCompletedJobs += _currentItems[item._file]._progress._total;
}
recomputeCompletedSize();
_lastCompletedItem = item;
diff --git a/src/libsync/progressdispatcher.h b/src/libsync/progressdispatcher.h
index b51be9810..539b24e31 100644
--- a/src/libsync/progressdispatcher.h
+++ b/src/libsync/progressdispatcher.h
@@ -91,6 +91,19 @@ public:
*/
void adjustTotalsForFile(const SyncFileItem &item);
+ /**
+ * Update totals for item.
+ * adjustTotalsForFile is called during the treewalk phase to collect
+ * the initial total size and file count.
+ * updateTotalsForFile is called at most once per item during propagation
+ * to adjust them when new information has become available.
+ *
+ * Example: With delta-sync, the actual size of the download will only
+ * be known during propagation - this function adjusts the total size
+ * to account for it.
+ */
+ void updateTotalsForFile(const SyncFileItem &item, quint64 newSize);
+
quint64 totalFiles() const;
quint64 completedFiles() const;
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 31338f4f6..4a1ca4721 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -1092,6 +1092,8 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
this, &SyncEngine::slotItemCompleted);
connect(_propagator.data(), &OwncloudPropagator::progress,
this, &SyncEngine::slotProgress);
+ connect(_propagator.data(), &OwncloudPropagator::updateFileTotal,
+ this, &SyncEngine::updateFileTotal);
connect(_propagator.data(), &OwncloudPropagator::finished, this, &SyncEngine::slotFinished, Qt::QueuedConnection);
connect(_propagator.data(), &OwncloudPropagator::seenLockedFile, this, &SyncEngine::seenLockedFile);
connect(_propagator.data(), &OwncloudPropagator::touchedFile, this, &SyncEngine::slotAddTouchedFile);
@@ -1212,6 +1214,11 @@ void SyncEngine::slotProgress(const SyncFileItem &item, quint64 current)
emit transmissionProgress(*_progressInfo);
}
+void SyncEngine::updateFileTotal(const SyncFileItem &item, quint64 newSize)
+{
+ _progressInfo->updateTotalsForFile(item, newSize);
+ emit transmissionProgress(*_progressInfo);
+}
/* Given a path on the remote, give the path as it is when the rename is done */
QString SyncEngine::adjustRenamedPath(const QString &original)
diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h
index 5ae335b42..d07075c8f 100644
--- a/src/libsync/syncengine.h
+++ b/src/libsync/syncengine.h
@@ -173,6 +173,7 @@ private slots:
void slotItemCompleted(const SyncFileItemPtr &item);
void slotFinished(bool success);
void slotProgress(const SyncFileItem &item, quint64 curent);
+ void updateFileTotal(const SyncFileItem &item, quint64 newSize);
void slotDiscoveryJobFinished(int updateResult);
void slotCleanPollsJobAborted(const QString &error);