mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Cosmetic fix for eta sorting in torrent list: 'infinity' must always come last
This commit is contained in:
parent
34a88c83f0
commit
0c0c7459f1
@ -124,18 +124,18 @@ qlonglong TorrentSpeedMonitor::getETA(const QString &hash) const
|
||||
QMutexLocker locker(&m_mutex);
|
||||
QTorrentHandle h = m_session->getTorrentHandle(hash);
|
||||
if (h.is_paused() || !m_samples.contains(hash))
|
||||
return -1;
|
||||
return MAX_ETA;
|
||||
|
||||
const QPair<qreal, qreal> speed_average = m_samples.value(hash).average();
|
||||
|
||||
if(h.is_seed()) {
|
||||
if (speed_average.second == 0)
|
||||
return -1;
|
||||
return MAX_ETA;
|
||||
|
||||
bool _unused;
|
||||
qreal max_ratio = m_session->getMaxRatioPerTorrent(hash, &_unused);
|
||||
if (max_ratio < 0)
|
||||
return -1;
|
||||
return MAX_ETA;
|
||||
|
||||
libtorrent::size_type realDL = h.all_time_download();
|
||||
if (realDL <= 0)
|
||||
@ -144,7 +144,7 @@ qlonglong TorrentSpeedMonitor::getETA(const QString &hash) const
|
||||
return (realDL * max_ratio - h.all_time_upload()) / speed_average.second;
|
||||
} else {
|
||||
if (speed_average.first == 0)
|
||||
return -1;
|
||||
return MAX_ETA;
|
||||
|
||||
return (h.total_wanted() - h.total_done()) / speed_average.first;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user