Time estimation: Avoid a progress reset before finish. #2328

The current algorithm doesn't care much, but resetting progress
to 0 just before completing a job is confusing anyway.
This commit is contained in:
Christian Kamm 2015-01-30 09:16:14 +01:00
parent 0f33e266ce
commit 509b83e73e
2 changed files with 7 additions and 2 deletions

View file

@ -635,9 +635,14 @@ void PropagateUploadFileQNAM::finalize(const SyncFileItem &copy)
void PropagateUploadFileQNAM::slotUploadProgress(qint64 sent, qint64 total) 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) { if (sent == 0 && total == 0) {
return; // QNAM bug https://bugreports.qt.io/browse/QTBUG-44782 return;
} }
int progressChunk = _currentChunk + _startChunk - 1; int progressChunk = _currentChunk + _startChunk - 1;
if (progressChunk >= _chunkCount) if (progressChunk >= _chunkCount)
progressChunk = _currentChunk - 1; progressChunk = _currentChunk - 1;

View file

@ -87,7 +87,7 @@ public:
QString errorString() { QString errorString() {
return _errorString.isEmpty() ? reply()->errorString() : _errorString; return _errorString.isEmpty() ? reply()->errorString() : _errorString;
}; }
virtual void slotTimeout() Q_DECL_OVERRIDE; virtual void slotTimeout() Q_DECL_OVERRIDE;