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. 18
      src/gui/transferlistwidget.cpp

10
src/base/preferences.cpp

@ -1224,6 +1224,16 @@ void Preferences::setConfirmRemoveAllTags(const bool enabled)
setValue(u"Preferences/Advanced/confirmRemoveAllTags"_qs, 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 #ifndef Q_OS_MACOS
TrayIcon::Style Preferences::trayIconStyle() const TrayIcon::Style Preferences::trayIconStyle() const
{ {

2
src/base/preferences.h

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

3
src/gui/optionsdialog.cpp

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

13
src/gui/optionsdialog.ui

@ -239,6 +239,19 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QCheckBox" name="checkAltRowColors"> <widget class="QCheckBox" name="checkAltRowColors">
<property name="text"> <property name="text">

18
src/gui/transferlistwidget.cpp

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

Loading…
Cancel
Save