Skip to content

Commit

Permalink
Show download progress for empty folders as 100 instead of 0
Browse files Browse the repository at this point in the history
This commit fixes the download progress calculation for folders with zero size.
Previously, the progress would be Zero. Now, folders with zero size
show 100% progress.

Closes qbittorrent#19354
  • Loading branch information
vikasc28 committed Mar 17, 2024
1 parent d7aaf80 commit 4882b38
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/gui/torrentcontentmodelfolder.cpp
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 if (tSize == 0)
{
m_progress = 1.0;
m_remaining = 0;
}

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

0 comments on commit 4882b38

Please sign in to comment.