Skip to content

Commit

Permalink
Time estimation: Avoid a progress reset before finish. #2328
Browse files Browse the repository at this point in the history
The current algorithm doesn't care much, but resetting progress
to 0 just before completing a job is confusing anyway.
  • Loading branch information
ckamm committed Apr 22, 2015
1 parent 0f33e26 commit 509b83e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/libsync/propagateupload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,14 @@ void PropagateUploadFileQNAM::finalize(const SyncFileItem &copy)

void PropagateUploadFileQNAM::slotUploadProgress(qint64 sent, qint64 total)
{
// Completion is signaled with sent=0, total=0; avoid accidentally
// resetting progress due to the sent being zero by ignoring it.
// finishedSignal() is bound to be emitted soon anyway.
// See https://bugreports.qt.io/browse/QTBUG-44782.
if (sent == 0 && total == 0) {
return; // QNAM bug https://bugreports.qt.io/browse/QTBUG-44782
return;
}

int progressChunk = _currentChunk + _startChunk - 1;
if (progressChunk >= _chunkCount)
progressChunk = _currentChunk - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/propagateupload.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class PUTFileJob : public AbstractNetworkJob {

QString errorString() {
return _errorString.isEmpty() ? reply()->errorString() : _errorString;
};
}

virtual void slotTimeout() Q_DECL_OVERRIDE;

Expand Down

0 comments on commit 509b83e

Please sign in to comment.