Prevent torrent from being started unexpectedly

Improves "Metadata received" stop condition handling by "Add new torrent" dialog.
The problem is when "Metadata received" stop condition is set the metadata can still be received 0.1 sec before clicking the "OK" button so torrent is actually added with metadata and therefore it cannot respect "Metadata received" stop condition.
The solution is to uncheck "Start torrent" checkbox once metadata is received.

PR #19597.
Closes #19583.
This commit is contained in:
Vladimir Golovnev 2023-09-13 15:48:13 +03:00 committed by GitHub
parent c394868f87
commit 633167a6da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -733,6 +733,9 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &metadata
m_torrentDescr.setTorrentInfo(metadata);
setMetadataProgressIndicator(true, tr("Parsing metadata..."));
const auto stopCondition = m_ui->stopConditionComboBox->currentData().value<BitTorrent::Torrent::StopCondition>();
if (stopCondition == BitTorrent::Torrent::StopCondition::MetadataReceived)
m_ui->startTorrentCheckBox->setChecked(false);
// Update UI
setupTreeview();