mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Fix peers and seeds sorting in transfer list.
When active peers (or seeds) of two torrents are the same we sort by total peers (or seeds).
This commit is contained in:
parent
78469c8faa
commit
bb61b3c05f
1 changed files with 10 additions and 0 deletions
|
@ -66,6 +66,16 @@ protected:
|
||||||
if (!vR.isValid()) return true;
|
if (!vR.isValid()) return true;
|
||||||
|
|
||||||
return vL < vR;
|
return vL < vR;
|
||||||
|
} else if (sortColumn() == TorrentModelItem::TR_PEERS || sortColumn() == TorrentModelItem::TR_SEEDS) {
|
||||||
|
int left_active = sourceModel()->data(left).toInt();
|
||||||
|
int left_total = sourceModel()->data(left, Qt::UserRole).toInt();
|
||||||
|
int right_active = sourceModel()->data(right).toInt();
|
||||||
|
int right_total = sourceModel()->data(right, Qt::UserRole).toInt();
|
||||||
|
|
||||||
|
// Active peers/seeds take precedence over total peers/seeds.
|
||||||
|
if (left_active == right_active)
|
||||||
|
return (left_total < right_total);
|
||||||
|
else return (left_active < right_active);
|
||||||
}
|
}
|
||||||
return QSortFilterProxyModel::lessThan(left, right);
|
return QSortFilterProxyModel::lessThan(left, right);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue