mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Fix queue sorting order fixes #1120
This commit is contained in:
parent
33b0a2b55f
commit
85cfe464f9
@ -66,16 +66,26 @@ protected:
|
||||
if (!vR.isValid()) return true;
|
||||
|
||||
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();
|
||||
}
|
||||
else if (sortColumn() == TorrentModelItem::TR_PRIORITY) {
|
||||
int vL = sourceModel()->data(left).toInt();
|
||||
int vR = sourceModel()->data(right).toInt();
|
||||
|
||||
//finished torrents should be last
|
||||
if (vL == -1) return false;
|
||||
if (vR == -1) return true;
|
||||
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);
|
||||
// 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user