mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-25 22:14:32 +00:00
Merge pull request #10750 from Chocobo1/modal
Fix unable to control add torrent dialogs when opened simultaneously
This commit is contained in:
commit
370544764e
@ -92,6 +92,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
|||||||
// TODO: set dialog file properties using m_torrentParams.filePriorities
|
// TODO: set dialog file properties using m_torrentParams.filePriorities
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
m_ui->lblMetaLoading->setVisible(false);
|
m_ui->lblMetaLoading->setVisible(false);
|
||||||
m_ui->progMetaLoading->setVisible(false);
|
m_ui->progMetaLoading->setVisible(false);
|
||||||
|
|
||||||
@ -99,10 +100,6 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
|||||||
m_ui->savePath->setDialogCaption(tr("Choose save path"));
|
m_ui->savePath->setDialogCaption(tr("Choose save path"));
|
||||||
m_ui->savePath->setMaxVisibleItems(20);
|
m_ui->savePath->setMaxVisibleItems(20);
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
setModal(true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const auto *session = BitTorrent::Session::instance();
|
const auto *session = BitTorrent::Session::instance();
|
||||||
|
|
||||||
if (m_torrentParams.addPaused == TriStateBool::True)
|
if (m_torrentParams.addPaused == TriStateBool::True)
|
||||||
@ -240,7 +237,7 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
|
|||||||
: dlg->loadTorrentFile(source);
|
: dlg->loadTorrentFile(source);
|
||||||
|
|
||||||
if (isLoaded)
|
if (isLoaded)
|
||||||
dlg->open();
|
dlg->QDialog::show();
|
||||||
else
|
else
|
||||||
delete dlg;
|
delete dlg;
|
||||||
}
|
}
|
||||||
@ -599,9 +596,6 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &)
|
|||||||
|
|
||||||
void AddNewTorrentDialog::accept()
|
void AddNewTorrentDialog::accept()
|
||||||
{
|
{
|
||||||
if (!m_hasMetadata)
|
|
||||||
disconnect(this, SLOT(updateMetadata(const BitTorrent::TorrentInfo&)));
|
|
||||||
|
|
||||||
// TODO: Check if destination actually exists
|
// TODO: Check if destination actually exists
|
||||||
m_torrentParams.skipChecking = m_ui->skipCheckingCheckBox->isChecked();
|
m_torrentParams.skipChecking = m_ui->skipCheckingCheckBox->isChecked();
|
||||||
|
|
||||||
@ -647,7 +641,6 @@ void AddNewTorrentDialog::accept()
|
|||||||
void AddNewTorrentDialog::reject()
|
void AddNewTorrentDialog::reject()
|
||||||
{
|
{
|
||||||
if (!m_hasMetadata) {
|
if (!m_hasMetadata) {
|
||||||
disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo)));
|
|
||||||
setMetadataProgressIndicator(false);
|
setMetadataProgressIndicator(false);
|
||||||
BitTorrent::Session::instance()->cancelLoadMetadata(m_hash);
|
BitTorrent::Session::instance()->cancelLoadMetadata(m_hash);
|
||||||
}
|
}
|
||||||
@ -659,7 +652,8 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info)
|
|||||||
{
|
{
|
||||||
if (info.hash() != m_hash) return;
|
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()) {
|
if (!info.isValid()) {
|
||||||
RaisedMessageBox::critical(this, tr("I/O Error"), ("Invalid metadata."));
|
RaisedMessageBox::critical(this, tr("I/O Error"), ("Invalid metadata."));
|
||||||
setMetadataProgressIndicator(false, tr("Invalid metadata"));
|
setMetadataProgressIndicator(false, tr("Invalid metadata"));
|
||||||
|
@ -47,7 +47,6 @@ namespace
|
|||||||
|| str.startsWith("https://", Qt::CaseInsensitive)
|
|| str.startsWith("https://", Qt::CaseInsensitive)
|
||||||
|| str.startsWith("ftp://", Qt::CaseInsensitive)
|
|| str.startsWith("ftp://", Qt::CaseInsensitive)
|
||||||
|| str.startsWith("magnet:", 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() == 40) && !str.contains(QRegularExpression("[^0-9A-Fa-f]")))
|
||||||
|| ((str.size() == 32) && !str.contains(QRegularExpression("[^2-7A-Za-z]"))));
|
|| ((str.size() == 32) && !str.contains(QRegularExpression("[^2-7A-Za-z]"))));
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ void SearchJobWidget::downloadTorrent(const QModelIndex &rowIndex)
|
|||||||
const QString siteUrl = m_proxyModel->data(
|
const QString siteUrl = m_proxyModel->data(
|
||||||
m_proxyModel->index(rowIndex.row(), SearchSortModel::ENGINE_URL)).toString();
|
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);
|
addTorrentToSession(torrentUrl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user