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;
}
}
void ProgressInfo::setProgressComplete(const SyncFileItem &item)
{
+ if (!shouldCountProgress(item)) {
+ return;
+ }
+
_currentItems.remove(item._file);
_fileProgress.setCompleted(_fileProgress._completed + item._affectedItems);
if (ProgressInfo::isSizeDependent(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);