mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Add availability column to torrent content model
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user