mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 22:52:33 -06:00
Clean up code
This commit is contained in:
committed by
sledgehammer999
parent
fd50d6e9af
commit
1e9151364a
@@ -142,13 +142,14 @@ void TorrentContentModelFolder::recalculateProgress()
|
||||
qulonglong tSize = 0;
|
||||
qulonglong tRemaining = 0;
|
||||
foreach (TorrentContentModelItem *child, m_childItems) {
|
||||
if (child->priority() != prio::IGNORED) {
|
||||
if (child->itemType() == FolderType)
|
||||
static_cast<TorrentContentModelFolder *>(child)->recalculateProgress();
|
||||
tProgress += child->progress() * child->size();
|
||||
tSize += child->size();
|
||||
tRemaining += child->remaining();
|
||||
}
|
||||
if (child->priority() == prio::IGNORED)
|
||||
continue;
|
||||
|
||||
if (child->itemType() == FolderType)
|
||||
static_cast<TorrentContentModelFolder *>(child)->recalculateProgress();
|
||||
tProgress += child->progress() * child->size();
|
||||
tSize += child->size();
|
||||
tRemaining += child->remaining();
|
||||
}
|
||||
|
||||
if (!isRootItem() && (tSize > 0)) {
|
||||
|
||||
@@ -74,9 +74,7 @@ qreal TorrentContentModelItem::progress() const
|
||||
{
|
||||
Q_ASSERT(!isRootItem());
|
||||
|
||||
if (m_size > 0) return m_progress;
|
||||
|
||||
return 1;
|
||||
return (m_size > 0) ? m_progress : 1;
|
||||
}
|
||||
|
||||
qulonglong TorrentContentModelItem::remaining() const
|
||||
@@ -89,7 +87,7 @@ qreal TorrentContentModelItem::availability() const
|
||||
{
|
||||
Q_ASSERT(!isRootItem());
|
||||
|
||||
return m_size > 0 ? m_availability : 0.;
|
||||
return (m_size > 0) ? m_availability : 0;
|
||||
}
|
||||
|
||||
int TorrentContentModelItem::priority() const
|
||||
|
||||
Reference in New Issue
Block a user