1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-01 12:35:22 +00:00

Fix sorting by progress (Qt client)

Magnet transfers caused the by-progress sorting to become non-stable, as their
percentComplete() could return NaN. This patch fixes this by preferring active
downloads over magnet transfers, then sorting them by percentComplete().
This commit is contained in:
Christian Muehlhaeuser 2017-03-30 04:22:01 +02:00 committed by Mike Gelfand
parent 6ea6f630dc
commit 6dd034b826

View file

@ -155,6 +155,11 @@ bool TorrentFilter::lessThan(QModelIndex const& left, QModelIndex const& right)
// fall through
case SortMode::SORT_BY_PROGRESS:
if (a->isMagnet() != b->isMagnet())
{
val = -compare(a->isMagnet(), b->isMagnet());
}
if (val == 0)
{
val = compare(a->percentComplete(), b->percentComplete());