Made progress calculation more efficient in torrent content model

Stop to address issue #24.
This commit is contained in:
Christophe Dumez
2012-08-27 22:01:35 +03:00
parent f73f267997
commit ca2a659970
4 changed files with 16 additions and 18 deletions

View File

@@ -59,6 +59,8 @@ void TorrentContentModel::updateFilesProgress(const std::vector<libtorrent::size
for (uint i = 0; i < fp.size(); ++i) {
m_filesIndex[i]->setProgress(fp[i]);
}
// Update folders progress in the tree
m_rootItem->recalculateProgress();
emit dataChanged(index(0,0), index(rowCount(), columnCount()));
}
@@ -118,6 +120,8 @@ bool TorrentContentModel::setData(const QModelIndex& index, const QVariant& valu
item->setPriority(prio::IGNORED);
else
item->setPriority(prio::NORMAL);
// Update folders progress in the tree
m_rootItem->recalculateProgress();
emit dataChanged(this->index(0,0), this->index(rowCount()-1, columnCount()-1));
emit filteredFilesChanged();
}