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
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..."));

View File

@@ -82,7 +82,7 @@ private slots:
void displayContentTreeMenu(const QPoint &);
void updateDiskSpaceLabel();
void onSavePathChanged(const QString &newPath);
void updateMetadata(const BitTorrent::TorrentInfo &info);
void updateMetadata(const BitTorrent::TorrentInfo &metadata);
void handleDownloadFinished(const Net::DownloadResult &result);
void TMMChanged(int index);
void categoryChanged(int index);