Skip to content

Commit

Permalink
Show download progress for folders with zero byte size as 100 instead…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
vikasc28 authored Jun 20, 2024
1 parent 7a2bfae commit 9317c25
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/gui/torrentcontentmodelfolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,19 @@ void TorrentContentModelFolder::recalculateProgress()
tRemaining += child->remaining();
}

if (!isRootItem() && (tSize > 0))
if (!isRootItem())
{
m_progress = tProgress / tSize;
m_remaining = tRemaining;
if (tSize > 0)
{
m_progress = tProgress / tSize;
m_remaining = tRemaining;
}
else
{
m_progress = 1.0;
m_remaining = 0;
}

Q_ASSERT(m_progress <= 1.);
}
}
Expand Down

0 comments on commit 9317c25

Please sign in to comment.