mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
Add availability column to torrent content model
This commit is contained in:
parent
114c9a8421
commit
d5af8722a6
8 changed files with 68 additions and 0 deletions
|
@ -76,6 +76,7 @@ void TorrentContentModel::updateFilesProgress(const QVector<qreal> &fp)
|
|||
m_filesIndex[i]->setProgress(fp[i]);
|
||||
// Update folders progress in the tree
|
||||
m_rootItem->recalculateProgress();
|
||||
m_rootItem->recalculateAvailability();
|
||||
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
|
||||
}
|
||||
|
||||
|
@ -92,6 +93,20 @@ void TorrentContentModel::updateFilesPriorities(const QVector<int> &fprio)
|
|||
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
|
||||
}
|
||||
|
||||
void TorrentContentModel::updateFilesAvailability(const QVector<qreal> &fa)
|
||||
{
|
||||
Q_ASSERT(m_filesIndex.size() == fa.size());
|
||||
// XXX: Why is this necessary?
|
||||
if (m_filesIndex.size() != fa.size()) return;
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
for (int i = 0; i < fa.size(); ++i)
|
||||
m_filesIndex[i]->setAvailability(fa[i]);
|
||||
// Update folders progress in the tree
|
||||
m_rootItem->recalculateProgress();
|
||||
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
|
||||
}
|
||||
|
||||
QVector<int> TorrentContentModel::getFilePriorities() const
|
||||
{
|
||||
QVector<int> prio;
|
||||
|
@ -134,6 +149,7 @@ bool TorrentContentModel::setData(const QModelIndex& index, const QVariant& valu
|
|||
item->setPriority(prio::NORMAL);
|
||||
// Update folders progress in the tree
|
||||
m_rootItem->recalculateProgress();
|
||||
m_rootItem->recalculateAvailability();
|
||||
emit dataChanged(this->index(0, 0), this->index(rowCount() - 1, columnCount() - 1));
|
||||
emit filteredFilesChanged();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue