mirror of
https://github.com/transmission/transmission
synced 2025-01-01 12:35:22 +00:00
Merge pull request #234 from muesli/master
Fix sorting by progress (Qt client)
This commit is contained in:
commit
c19e49d851
2 changed files with 6 additions and 1 deletions
|
@ -314,7 +314,7 @@ public:
|
||||||
|
|
||||||
double percentComplete() const
|
double percentComplete() const
|
||||||
{
|
{
|
||||||
return haveTotal() / static_cast<double>(totalSize());
|
return totalSize() != 0 ? haveTotal() / static_cast<double>(totalSize()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double percentDone() const
|
double percentDone() const
|
||||||
|
|
|
@ -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 (val == 0)
|
||||||
|
{
|
||||||
|
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 a new issue