From 014273d7ecd7e7254e18aa3e1b9b7034929d7947 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 3 Jun 2019 17:38:02 +0800 Subject: [PATCH 1/3] Drop support for "BC Link" format Fixup 19d6de795c125846b72c09b987902b3fcfd27d39. --- src/gui/downloadfromurldialog.cpp | 1 - src/gui/search/searchjobwidget.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/downloadfromurldialog.cpp b/src/gui/downloadfromurldialog.cpp index 78b879a8e..e1d690d46 100644 --- a/src/gui/downloadfromurldialog.cpp +++ b/src/gui/downloadfromurldialog.cpp @@ -47,7 +47,6 @@ namespace || str.startsWith("https://", Qt::CaseInsensitive) || str.startsWith("ftp://", Qt::CaseInsensitive) || str.startsWith("magnet:", Qt::CaseInsensitive) - || str.startsWith("bc://bt/", Qt::CaseInsensitive) || ((str.size() == 40) && !str.contains(QRegularExpression("[^0-9A-Fa-f]"))) || ((str.size() == 32) && !str.contains(QRegularExpression("[^2-7A-Za-z]")))); } diff --git a/src/gui/search/searchjobwidget.cpp b/src/gui/search/searchjobwidget.cpp index 8d1689bfa..87413921c 100644 --- a/src/gui/search/searchjobwidget.cpp +++ b/src/gui/search/searchjobwidget.cpp @@ -261,7 +261,7 @@ void SearchJobWidget::downloadTorrent(const QModelIndex &rowIndex) const QString siteUrl = m_proxyModel->data( m_proxyModel->index(rowIndex.row(), SearchSortModel::ENGINE_URL)).toString(); - if (torrentUrl.startsWith("bc://bt/", Qt::CaseInsensitive) || torrentUrl.startsWith("magnet:", Qt::CaseInsensitive)) { + if (torrentUrl.startsWith("magnet:", Qt::CaseInsensitive)) { addTorrentToSession(torrentUrl); } else { From 03fdc0e1c42d594d44e282a643b59771247974a4 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 4 Jun 2019 00:14:57 +0800 Subject: [PATCH 2/3] Remove redundant disconnect() The dialog is going out-of-scope in these instance and the signal-slot connection will disconnect automatically. --- src/gui/addnewtorrentdialog.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 7b90af8c8..cb4e31bbc 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -600,9 +600,6 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &) void AddNewTorrentDialog::accept() { - if (!m_hasMetadata) - disconnect(this, SLOT(updateMetadata(const BitTorrent::TorrentInfo&))); - // TODO: Check if destination actually exists m_torrentParams.skipChecking = m_ui->skipCheckingCheckBox->isChecked(); @@ -648,7 +645,6 @@ void AddNewTorrentDialog::accept() void AddNewTorrentDialog::reject() { if (!m_hasMetadata) { - disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo))); setMetadataProgressIndicator(false); BitTorrent::Session::instance()->cancelLoadMetadata(m_hash); } @@ -660,7 +656,8 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info) { if (info.hash() != m_hash) return; - disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo))); + disconnect(BitTorrent::Session::instance(), &BitTorrent::Session::metadataLoaded, this, &AddNewTorrentDialog::updateMetadata); + if (!info.isValid()) { RaisedMessageBox::critical(this, tr("I/O Error"), ("Invalid metadata.")); setMetadataProgressIndicator(false, tr("Invalid metadata")); From dc9d0ed76fdaf9593c471f0259cf53fdb882327b Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 5 Jun 2019 12:25:45 +0800 Subject: [PATCH 3/3] Fix unable to control add torrent dialogs when opened simultaneously --- src/gui/addnewtorrentdialog.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index cb4e31bbc..f14ad9291 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -93,6 +93,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP // TODO: set dialog file properties using m_torrentParams.filePriorities m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); + m_ui->lblMetaLoading->setVisible(false); m_ui->progMetaLoading->setVisible(false); @@ -100,10 +101,6 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP m_ui->savePath->setDialogCaption(tr("Choose save path")); m_ui->savePath->setMaxVisibleItems(20); -#ifdef Q_OS_MAC - setModal(true); -#endif - const auto *session = BitTorrent::Session::instance(); if (m_torrentParams.addPaused == TriStateBool::True) @@ -241,7 +238,7 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre : dlg->loadTorrentFile(source); if (isLoaded) - dlg->open(); + dlg->QDialog::show(); else delete dlg; }