|
|
@ -39,7 +39,7 @@ TorrentContentModelFolder::TorrentContentModelFolder(const QString& name, Torren |
|
|
|
if (m_name.endsWith(".!qB")) |
|
|
|
if (m_name.endsWith(".!qB")) |
|
|
|
m_name.chop(4); |
|
|
|
m_name.chop(4); |
|
|
|
|
|
|
|
|
|
|
|
// Update parent
|
|
|
|
// Add to parent
|
|
|
|
m_parentItem->appendChild(this); |
|
|
|
m_parentItem->appendChild(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -71,6 +71,9 @@ void TorrentContentModelFolder::appendChild(TorrentContentModelItem* item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_ASSERT(item); |
|
|
|
Q_ASSERT(item); |
|
|
|
m_childItems.append(item); |
|
|
|
m_childItems.append(item); |
|
|
|
|
|
|
|
// Update own size
|
|
|
|
|
|
|
|
if (item->itemType() == FileType) |
|
|
|
|
|
|
|
increaseSize(item->size()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TorrentContentModelItem* TorrentContentModelFolder::child(int row) const |
|
|
|
TorrentContentModelItem* TorrentContentModelFolder::child(int row) const |
|
|
@ -132,7 +135,6 @@ void TorrentContentModelFolder::setPriority(int new_prio, bool update_parent) |
|
|
|
child->setPriority(m_priority, false); |
|
|
|
child->setPriority(m_priority, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateSize(); |
|
|
|
|
|
|
|
updateProgress(); |
|
|
|
updateProgress(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -154,19 +156,11 @@ void TorrentContentModelFolder::updateProgress() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TorrentContentModelFolder::updateSize() |
|
|
|
void TorrentContentModelFolder::increaseSize(qulonglong delta) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (isRootItem()) |
|
|
|
if (isRootItem()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
qulonglong size = 0; |
|
|
|
m_size += delta; |
|
|
|
foreach (TorrentContentModelItem* child, m_childItems) { |
|
|
|
m_parentItem->increaseSize(delta); |
|
|
|
if (child->priority() != prio::IGNORED) |
|
|
|
|
|
|
|
size += child->size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (size != m_size) { |
|
|
|
|
|
|
|
m_size = size; |
|
|
|
|
|
|
|
m_parentItem->updateSize(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|