mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-27 15:04:36 +00:00
Add confirmation to resume/pause all
This adds a confirmation dialog to Pause All and Resume All. First I wanted to only add it in Tray, but honestly, clicking around in the menu, using hotkeys might trigger it just as easy. Closes #17683. PR #17945.
This commit is contained in:
parent
22fb9797c4
commit
162273da47
@ -363,12 +363,30 @@ void TransferListWidget::setSelectedTorrentsLocation()
|
|||||||
|
|
||||||
void TransferListWidget::pauseAllTorrents()
|
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 (ret != QMessageBox::Yes)
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::resumeAllTorrents()
|
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 (ret != QMessageBox::Yes)
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
@ -979,18 +979,34 @@ const initializeWindows = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
['pause', 'resume'].each(function(item) {
|
addClickEvent('pauseAll', (e) => {
|
||||||
addClickEvent(item + 'All', function(e) {
|
new Event(e).stop();
|
||||||
new Event(e).stop();
|
|
||||||
|
if (confirm('QBT_TR(Would you like to pause all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/' + item,
|
url: 'api/v2/torrents/pause',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
hashes: "all"
|
hashes: "all"
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
updateMainData();
|
updateMainData();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addClickEvent('resumeAll', (e) => {
|
||||||
|
new Event(e).stop();
|
||||||
|
|
||||||
|
if (confirm('QBT_TR(Would you like to resume all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
|
||||||
|
new Request({
|
||||||
|
url: 'api/v2/torrents/resume',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
hashes: "all"
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
|
updateMainData();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
['pause', 'resume', 'recheck'].each(function(item) {
|
['pause', 'resume', 'recheck'].each(function(item) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user