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
1 changed files with 5 additions and 0 deletions

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());