mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 22:47:21 -06:00
Inhibit sleep regardless of activity
"Active torrents" is a somewhat unintuitive concept as a basis for preventing sleep, as torrents can become active or inactive on the network at any time. This brings some predictability to the inhibit sleep option, and will inhibit sleep as long as there are unpaused downloads or uploads, regardless of network activity. Closes #1696, #4592, #4655, #7019, #7159, #7452
This commit is contained in:
committed by
sledgehammer999
parent
052206efa1
commit
5e90156e9e
@@ -1863,20 +1863,26 @@ TorrentHandle *Session::findTorrent(const InfoHash &hash) const
|
||||
|
||||
bool Session::hasActiveTorrents() const
|
||||
{
|
||||
foreach (TorrentHandle *const torrent, m_torrents)
|
||||
if (TorrentFilter::ActiveTorrent.match(torrent))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return std::any_of(m_torrents.begin(), m_torrents.end(), [](TorrentHandle *torrent)
|
||||
{
|
||||
return TorrentFilter::ActiveTorrent.match(torrent);
|
||||
});
|
||||
}
|
||||
|
||||
bool Session::hasUnfinishedTorrents() const
|
||||
{
|
||||
foreach (TorrentHandle *const torrent, m_torrents)
|
||||
if (!torrent->isSeed() && !torrent->isPaused())
|
||||
return true;
|
||||
return std::any_of(m_torrents.begin(), m_torrents.end(), [](const TorrentHandle *torrent)
|
||||
{
|
||||
return (!torrent->isSeed() && !torrent->isPaused());
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
bool Session::hasRunningSeed() const
|
||||
{
|
||||
return std::any_of(m_torrents.begin(), m_torrents.end(), [](const TorrentHandle *torrent)
|
||||
{
|
||||
return (torrent->isSeed() && !torrent->isPaused());
|
||||
});
|
||||
}
|
||||
|
||||
void Session::banIP(const QString &ip)
|
||||
|
||||
Reference in New Issue
Block a user