Improve adding torrent using Magnet URI

Closes #13249.
This commit is contained in:
Vladimir Golovnev (Glassez) 2020-08-14 16:32:09 +03:00
parent 4539c679d9
commit 20206ec92a
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
4 changed files with 31 additions and 67 deletions

View file

@ -591,20 +591,20 @@ void AddNewTorrentDialog::reject()
QDialog::reject();
}
void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info)
void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &metadata)
{
if (info.hash() != m_hash) return;
if (metadata.hash() != m_magnetURI.hash()) return;
disconnect(BitTorrent::Session::instance(), &BitTorrent::Session::metadataLoaded, this, &AddNewTorrentDialog::updateMetadata);
if (!info.isValid()) {
if (!metadata.isValid()) {
RaisedMessageBox::critical(this, tr("I/O Error"), ("Invalid metadata."));
setMetadataProgressIndicator(false, tr("Invalid metadata"));
return;
}
// Good to go
m_torrentInfo = info;
m_torrentInfo = metadata;
m_hasMetadata = true;
setMetadataProgressIndicator(true, tr("Parsing metadata..."));