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:
parent
6ea6f630dc
commit
6dd034b826
|
@ -155,6 +155,11 @@ bool TorrentFilter::lessThan(QModelIndex const& left, QModelIndex const& right)
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case SortMode::SORT_BY_PROGRESS:
|
case SortMode::SORT_BY_PROGRESS:
|
||||||
|
if (a->isMagnet() != b->isMagnet())
|
||||||
|
{
|
||||||
|
val = -compare(a->isMagnet(), b->isMagnet());
|
||||||
|
}
|
||||||
|
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
{
|
{
|
||||||
val = compare(a->percentComplete(), b->percentComplete());
|
val = compare(a->percentComplete(), b->percentComplete());
|
||||||
|
|
Loading…
Reference in New Issue