mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Improve "info hash" handling
Define "torrent ID" concept, which is either a SHA1 hash for torrents of version 1, or a SHA256 hash (truncated to SHA1 hash length) for torrents of version 2. Add support for native libtorrent2 info hashes.
This commit is contained in:
parent
4da4fb0676
commit
561b597031
34 changed files with 463 additions and 320 deletions
|
@ -77,10 +77,10 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
|
|||
const bool isFirstTorrentPEXDisabled = torrents[0]->isPEXDisabled();
|
||||
const bool isFirstTorrentLSDDisabled = torrents[0]->isLSDDisabled();
|
||||
|
||||
m_torrentHashes.reserve(torrents.size());
|
||||
m_torrentIDs.reserve(torrents.size());
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
{
|
||||
m_torrentHashes << torrent->hash();
|
||||
m_torrentIDs << torrent->id();
|
||||
if (allSameUpLimit)
|
||||
{
|
||||
if (qMax(0, torrent->uploadLimit()) != firstTorrentUpLimit)
|
||||
|
@ -288,9 +288,9 @@ void TorrentOptionsDialog::accept()
|
|||
}
|
||||
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
for (const BitTorrent::InfoHash &hash : asConst(m_torrentHashes))
|
||||
for (const BitTorrent::TorrentID &id : asConst(m_torrentIDs))
|
||||
{
|
||||
BitTorrent::Torrent *torrent = session->findTorrent(hash);
|
||||
BitTorrent::Torrent *torrent = session->findTorrent(id);
|
||||
if (!torrent) continue;
|
||||
|
||||
if (m_initialValues.upSpeedLimit != m_ui->spinUploadLimit->value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue