Allow to disable confirmation of Pause/Resume All

PR #19067.
Closes #18155.
This commit is contained in:
Vladimir Golovnev
2023-06-04 08:57:14 +03:00
committed by GitHub
parent 83e6afcb71
commit cf415dd7fe
5 changed files with 44 additions and 14 deletions

View File

@@ -362,14 +362,15 @@ void TransferListWidget::setSelectedTorrentsLocation()
void TransferListWidget::pauseAllTorrents()
{
// Show confirmation if user would really like to Pause All
const QMessageBox::StandardButton ret =
QMessageBox::question(this, tr("Confirm pause")
, tr("Would you like to pause all torrents?")
, (QMessageBox::Yes | QMessageBox::No));
if (Preferences::instance()->confirmPauseAndResumeAll())
{
// Show confirmation if user would really like to Pause All
const QMessageBox::StandardButton ret = QMessageBox::question(this, tr("Confirm pause")
, tr("Would you like to pause all torrents?"), (QMessageBox::Yes | QMessageBox::No));
if (ret != QMessageBox::Yes)
return;
if (ret != QMessageBox::Yes)
return;
}
for (BitTorrent::Torrent *const torrent : asConst(BitTorrent::Session::instance()->torrents()))
torrent->pause();
@@ -377,14 +378,15 @@ void TransferListWidget::pauseAllTorrents()
void TransferListWidget::resumeAllTorrents()
{
// Show confirmation if user would really like to Resume All
const QMessageBox::StandardButton ret =
QMessageBox::question(this, tr("Confirm resume")
, tr("Would you like to resume all torrents?")
, (QMessageBox::Yes | QMessageBox::No));
if (Preferences::instance()->confirmPauseAndResumeAll())
{
// Show confirmation if user would really like to Resume All
const QMessageBox::StandardButton ret = QMessageBox::question(this, tr("Confirm resume")
, tr("Would you like to resume all torrents?"), (QMessageBox::Yes | QMessageBox::No));
if (ret != QMessageBox::Yes)
return;
if (ret != QMessageBox::Yes)
return;
}
for (BitTorrent::Torrent *const torrent : asConst(BitTorrent::Session::instance()->torrents()))
torrent->resume();