Group several torrent options into one dialog

Speed limits, share limits and the new options to disable DHT, PeX, LSD per torrent
This commit is contained in:
thalieht
2020-11-29 16:36:07 +02:00
parent fbb8f0cbf5
commit 8db4bde15d
14 changed files with 780 additions and 432 deletions

View File

@@ -1028,6 +1028,21 @@ bool TorrentHandleImpl::superSeeding() const
return static_cast<bool>(m_nativeStatus.flags & lt::torrent_flags::super_seeding);
}
bool TorrentHandleImpl::isDHTDisabled() const
{
return static_cast<bool>(m_nativeStatus.flags & lt::torrent_flags::disable_dht);
}
bool TorrentHandleImpl::isPEXDisabled() const
{
return static_cast<bool>(m_nativeStatus.flags & lt::torrent_flags::disable_pex);
}
bool TorrentHandleImpl::isLSDDisabled() const
{
return static_cast<bool>(m_nativeStatus.flags & lt::torrent_flags::disable_lsd);
}
QVector<PeerInfo> TorrentHandleImpl::peers() const
{
std::vector<lt::peer_info> nativePeers;
@@ -1966,10 +1981,50 @@ void TorrentHandleImpl::setDownloadLimit(const int limit)
void TorrentHandleImpl::setSuperSeeding(const bool enable)
{
if (enable == superSeeding())
return;
if (enable)
m_nativeHandle.set_flags(lt::torrent_flags::super_seeding);
else
m_nativeHandle.unset_flags(lt::torrent_flags::super_seeding);
saveResumeData();
}
void TorrentHandleImpl::setDHTDisabled(const bool disable)
{
if (disable == isDHTDisabled())
return;
if (disable)
m_nativeHandle.set_flags(lt::torrent_flags::disable_dht);
else
m_nativeHandle.unset_flags(lt::torrent_flags::disable_dht);
saveResumeData();
}
void TorrentHandleImpl::setPEXDisabled(const bool disable)
{
if (disable == isPEXDisabled())
return;
if (disable)
m_nativeHandle.set_flags(lt::torrent_flags::disable_pex);
else
m_nativeHandle.unset_flags(lt::torrent_flags::disable_pex);
saveResumeData();
}
void TorrentHandleImpl::setLSDDisabled(const bool disable)
{
if (disable == isLSDDisabled())
return;
if (disable)
m_nativeHandle.set_flags(lt::torrent_flags::disable_lsd);
else
m_nativeHandle.unset_flags(lt::torrent_flags::disable_lsd);
saveResumeData();
}
void TorrentHandleImpl::flushCache() const