Browse Source

Allow to disable confirmation of Pause/Resume All

PR #19067.
Closes #18155.
adaptive-webui-19844
Vladimir Golovnev 2 years ago committed by GitHub
parent
commit
cf415dd7fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/base/preferences.cpp
  2. 2
      src/base/preferences.h
  3. 3
      src/gui/optionsdialog.cpp
  4. 13
      src/gui/optionsdialog.ui
  5. 30
      src/gui/transferlistwidget.cpp

10
src/base/preferences.cpp

@ -1224,6 +1224,16 @@ void Preferences::setConfirmRemoveAllTags(const bool enabled) @@ -1224,6 +1224,16 @@ void Preferences::setConfirmRemoveAllTags(const bool enabled)
setValue(u"Preferences/Advanced/confirmRemoveAllTags"_qs, enabled);
}
bool Preferences::confirmPauseAndResumeAll() const
{
return value(u"GUI/ConfirmActions/PauseAndResumeAllTorrents"_qs, true);
}
void Preferences::setConfirmPauseAndResumeAll(const bool enabled)
{
setValue(u"GUI/ConfirmActions/PauseAndResumeAllTorrents"_qs, enabled);
}
#ifndef Q_OS_MACOS
TrayIcon::Style Preferences::trayIconStyle() const
{

2
src/base/preferences.h

@ -315,6 +315,8 @@ public: @@ -315,6 +315,8 @@ public:
void setConfirmTorrentRecheck(bool enabled);
bool confirmRemoveAllTags() const;
void setConfirmRemoveAllTags(bool enabled);
bool confirmPauseAndResumeAll() const;
void setConfirmPauseAndResumeAll(bool enabled);
#ifndef Q_OS_MACOS
bool systemTrayEnabled() const;
void setSystemTrayEnabled(bool enabled);

3
src/gui/optionsdialog.cpp

@ -253,6 +253,7 @@ void OptionsDialog::loadBehaviorTabOptions() @@ -253,6 +253,7 @@ void OptionsDialog::loadBehaviorTabOptions()
m_ui->checkShowSplash->setChecked(!pref->isSplashScreenDisabled());
m_ui->checkProgramExitConfirm->setChecked(pref->confirmOnExit());
m_ui->checkProgramAutoExitConfirm->setChecked(!pref->dontConfirmAutoExit());
m_ui->checkConfirmPauseAndResumeAll->setChecked(pref->confirmPauseAndResumeAll());
m_ui->windowStateComboBox->addItem(tr("Normal"), QVariant::fromValue(WindowState::Normal));
m_ui->windowStateComboBox->addItem(tr("Minimized"), QVariant::fromValue(WindowState::Minimized));
@ -354,6 +355,7 @@ void OptionsDialog::loadBehaviorTabOptions() @@ -354,6 +355,7 @@ void OptionsDialog::loadBehaviorTabOptions()
connect(m_ui->checkShowSplash, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkProgramExitConfirm, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkProgramAutoExitConfirm, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkConfirmPauseAndResumeAll, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkShowSystray, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMinimizeToSysTray, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkCloseToSystray, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
@ -425,6 +427,7 @@ void OptionsDialog::saveBehaviorTabOptions() const @@ -425,6 +427,7 @@ void OptionsDialog::saveBehaviorTabOptions() const
pref->setSplashScreenDisabled(isSplashScreenDisabled());
pref->setConfirmOnExit(m_ui->checkProgramExitConfirm->isChecked());
pref->setDontConfirmAutoExit(!m_ui->checkProgramAutoExitConfirm->isChecked());
pref->setConfirmPauseAndResumeAll(m_ui->checkConfirmPauseAndResumeAll->isChecked());
#ifdef Q_OS_WIN
pref->setWinStartup(WinStartup());

13
src/gui/optionsdialog.ui

@ -239,6 +239,19 @@ @@ -239,6 +239,19 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkConfirmPauseAndResumeAll">
<property name="toolTip">
<string>Shows a confirmation dialog upon pausing/resuming all the torrents</string>
</property>
<property name="text">
<string>Confirm "Pause/Resume all" actions</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkAltRowColors">
<property name="text">

30
src/gui/transferlistwidget.cpp

@ -362,14 +362,15 @@ void TransferListWidget::setSelectedTorrentsLocation() @@ -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() @@ -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();

Loading…
Cancel
Save