mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-31 12:00:16 -07:00
Properly check if file priority changes
Current item priority is compared against new checkbox state. I believe the intention was to check if the priority changes before performing further actions. This PR fixes the issue - compare priority against new value that is about to be set rather then the checkbox state. PR #15740.
This commit is contained in:
parent
b45248bf99
commit
fa1d49add5
1 changed files with 8 additions and 7 deletions
|
@ -284,14 +284,15 @@ bool TorrentContentModel::setData(const QModelIndex &index, const QVariant &valu
|
||||||
{
|
{
|
||||||
auto *item = static_cast<TorrentContentModelItem*>(index.internalPointer());
|
auto *item = static_cast<TorrentContentModelItem*>(index.internalPointer());
|
||||||
qDebug("setData(%s, %d)", qUtf8Printable(item->name()), value.toInt());
|
qDebug("setData(%s, %d)", qUtf8Printable(item->name()), value.toInt());
|
||||||
if (static_cast<int>(item->priority()) != value.toInt())
|
|
||||||
{
|
|
||||||
BitTorrent::DownloadPriority prio = BitTorrent::DownloadPriority::Normal;
|
|
||||||
if (value.toInt() == Qt::PartiallyChecked)
|
|
||||||
prio = BitTorrent::DownloadPriority::Mixed;
|
|
||||||
else if (value.toInt() == Qt::Unchecked)
|
|
||||||
prio = BitTorrent::DownloadPriority::Ignored;
|
|
||||||
|
|
||||||
|
BitTorrent::DownloadPriority prio = BitTorrent::DownloadPriority::Normal;
|
||||||
|
if (value.toInt() == Qt::PartiallyChecked)
|
||||||
|
prio = BitTorrent::DownloadPriority::Mixed;
|
||||||
|
else if (value.toInt() == Qt::Unchecked)
|
||||||
|
prio = BitTorrent::DownloadPriority::Ignored;
|
||||||
|
|
||||||
|
if (item->priority() != prio)
|
||||||
|
{
|
||||||
item->setPriority(prio);
|
item->setPriority(prio);
|
||||||
// Update folders progress in the tree
|
// Update folders progress in the tree
|
||||||
m_rootItem->recalculateProgress();
|
m_rootItem->recalculateProgress();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue