Show download progress for folders with zero byte size as 100 instead of 0

Fixes the download progress calculation for folders with zero size.
Previously, the progress would be Zero. Now, folders with zero size
show 100% progress.

PR #20567.
This commit is contained in:
vikas_c 2024-06-20 10:38:55 +05:30 committed by sledgehammer999
parent 0f5a27ed50
commit cea20141a9
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2

View file

@ -147,10 +147,19 @@ void TorrentContentModelFolder::recalculateProgress()
tRemaining += child->remaining(); tRemaining += child->remaining();
} }
if (!isRootItem() && (tSize > 0)) if (!isRootItem())
{ {
m_progress = tProgress / tSize; if (tSize > 0)
m_remaining = tRemaining; {
m_progress = tProgress / tSize;
m_remaining = tRemaining;
}
else
{
m_progress = 1.0;
m_remaining = 0;
}
Q_ASSERT(m_progress <= 1.); Q_ASSERT(m_progress <= 1.);
} }
} }