mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #9094 from Chocobo1/recursive
Fix crash in Recursive Download dialog
This commit is contained in:
commit
97b3761dbf
@ -927,18 +927,26 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHand
|
|||||||
{
|
{
|
||||||
Preferences *const pref = Preferences::instance();
|
Preferences *const pref = Preferences::instance();
|
||||||
if (pref->recursiveDownloadDisabled()) return;
|
if (pref->recursiveDownloadDisabled()) return;
|
||||||
// Get Torrent name
|
|
||||||
QString torrentName = torrent->name();
|
|
||||||
QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent '%1' contains torrent files, do you want to proceed with their download?").arg(torrentName), QMessageBox::NoButton, this);
|
|
||||||
QPushButton *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
|
|
||||||
/*QPushButton *no = */ confirmBox.addButton(tr("No"), QMessageBox::NoRole);
|
|
||||||
QPushButton *never = confirmBox.addButton(tr("Never"), QMessageBox::NoRole);
|
|
||||||
confirmBox.exec();
|
|
||||||
|
|
||||||
if (confirmBox.clickedButton() == yes)
|
const auto torrentHash = torrent->hash();
|
||||||
BitTorrent::Session::instance()->recursiveTorrentDownload(torrent->hash());
|
|
||||||
else if (confirmBox.clickedButton() == never)
|
QMessageBox *confirmBox = new QMessageBox(QMessageBox::Question, tr("Recursive download confirmation")
|
||||||
pref->disableRecursiveDownload();
|
, tr("The torrent '%1' contains torrent files, do you want to proceed with their download?").arg(torrent->name())
|
||||||
|
, QMessageBox::NoButton, this);
|
||||||
|
confirmBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
confirmBox->setModal(true);
|
||||||
|
|
||||||
|
const QPushButton *yes = confirmBox->addButton(tr("Yes"), QMessageBox::YesRole);
|
||||||
|
/*QPushButton *no = */ confirmBox->addButton(tr("No"), QMessageBox::NoRole);
|
||||||
|
const QPushButton *never = confirmBox->addButton(tr("Never"), QMessageBox::NoRole);
|
||||||
|
connect(confirmBox, &QMessageBox::buttonClicked, this, [torrentHash, yes, never](const QAbstractButton *button)
|
||||||
|
{
|
||||||
|
if (button == yes)
|
||||||
|
BitTorrent::Session::instance()->recursiveTorrentDownload(torrentHash);
|
||||||
|
if (button == never)
|
||||||
|
Preferences::instance()->disableRecursiveDownload();
|
||||||
|
});
|
||||||
|
confirmBox->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const
|
void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const
|
||||||
|
@ -254,6 +254,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
connect(m_ui->textTempPath, &FileSystemPathEdit::selectedPathChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->textTempPath, &FileSystemPathEdit::selectedPathChanged, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkAppendqB, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkAppendqB, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkPreallocateAll, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkPreallocateAll, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
|
connect(m_ui->checkRecursiveDownload, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkAdditionDialog, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkAdditionDialog, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkAdditionDialogFront, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkAdditionDialogFront, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkStartPaused, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkStartPaused, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
@ -602,6 +603,7 @@ void OptionsDialog::saveOptions()
|
|||||||
session->setTempPath(Utils::Fs::expandPathAbs(m_ui->textTempPath->selectedPath()));
|
session->setTempPath(Utils::Fs::expandPathAbs(m_ui->textTempPath->selectedPath()));
|
||||||
session->setAppendExtensionEnabled(m_ui->checkAppendqB->isChecked());
|
session->setAppendExtensionEnabled(m_ui->checkAppendqB->isChecked());
|
||||||
session->setPreallocationEnabled(preAllocateAllFiles());
|
session->setPreallocationEnabled(preAllocateAllFiles());
|
||||||
|
pref->disableRecursiveDownload(!m_ui->checkRecursiveDownload->isChecked());
|
||||||
AddNewTorrentDialog::setEnabled(useAdditionDialog());
|
AddNewTorrentDialog::setEnabled(useAdditionDialog());
|
||||||
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
|
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
|
||||||
session->setAddTorrentPaused(addTorrentsInPause());
|
session->setAddTorrentPaused(addTorrentsInPause());
|
||||||
@ -849,6 +851,7 @@ void OptionsDialog::loadOptions()
|
|||||||
m_ui->textTempPath->setSelectedPath(Utils::Fs::toNativePath(session->tempPath()));
|
m_ui->textTempPath->setSelectedPath(Utils::Fs::toNativePath(session->tempPath()));
|
||||||
m_ui->checkAppendqB->setChecked(session->isAppendExtensionEnabled());
|
m_ui->checkAppendqB->setChecked(session->isAppendExtensionEnabled());
|
||||||
m_ui->checkPreallocateAll->setChecked(session->isPreallocationEnabled());
|
m_ui->checkPreallocateAll->setChecked(session->isPreallocationEnabled());
|
||||||
|
m_ui->checkRecursiveDownload->setChecked(!pref->recursiveDownloadDisabled());
|
||||||
|
|
||||||
strValue = session->torrentExportDirectory();
|
strValue = session->torrentExportDirectory();
|
||||||
if (strValue.isEmpty()) {
|
if (strValue.isEmpty()) {
|
||||||
|
@ -779,6 +779,27 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkPreallocateAll">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pre-allocate disk space for all files</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkAppendqB">
|
||||||
|
<property name="text">
|
||||||
|
<string>Append .!qB extension to incomplete files</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkRecursiveDownload">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable recursive download dialog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupSavingManagement">
|
<widget class="QGroupBox" name="groupSavingManagement">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -1004,20 +1025,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkPreallocateAll">
|
|
||||||
<property name="text">
|
|
||||||
<string>Pre-allocate disk space for all files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkAppendqB">
|
|
||||||
<property name="text">
|
|
||||||
<string>Append .!qB extension to incomplete files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user