mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 16:58:06 -06:00
Improve structure of AddNewTorrentDialog code
Restructures the code to separate the basic logic from the logic that depends on the parameters and properties of the torrent being added. Also fixes "Never show again" checkbox functionality. PR #20848.
This commit is contained in:
committed by
GitHub
parent
e09a871ca3
commit
b8a774f1fb
@@ -226,14 +226,16 @@ bool GUIAddTorrentManager::processTorrent(const QString &source, const BitTorren
|
||||
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
m_dialogs[infoHash] = dlg;
|
||||
connect(dlg, &QDialog::finished, this, [this, source, infoHash, dlg](int result)
|
||||
connect(dlg, &AddNewTorrentDialog::torrentAccepted, this
|
||||
, [this, source](const BitTorrent::TorrentDescriptor &torrentDescr, const BitTorrent::AddTorrentParams &addTorrentParams)
|
||||
{
|
||||
addTorrentToSession(source, torrentDescr, addTorrentParams);
|
||||
});
|
||||
connect(dlg, &QDialog::finished, this, [this, source, infoHash, dlg]
|
||||
{
|
||||
if (dlg->isDoNotDeleteTorrentChecked())
|
||||
releaseTorrentFileGuard(source);
|
||||
|
||||
if (result == QDialog::Accepted)
|
||||
addTorrentToSession(source, dlg->torrentDescriptor(), dlg->addTorrentParams());
|
||||
|
||||
m_dialogs.remove(infoHash);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user