Use Start/Stop instead of Resume/Pause

PR #20532.

---------

Co-authored-by: Vladimir Golovnev (Glassez) <glassez@yandex.ru>
This commit is contained in:
thalieht 2024-03-25 18:11:04 +02:00 committed by GitHub
parent f2d6129db3
commit 5d1c249606
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
70 changed files with 413 additions and 391 deletions

View file

@ -55,7 +55,7 @@ let globalDownloadLimitFN = function() {};
let StatisticsLinkFN = function() {};
let downloadLimitFN = function() {};
let deleteFN = function() {};
let pauseFN = function() {};
let stopFN = function() {};
let startFN = function() {};
let autoTorrentManagementFN = function() {};
let recheckFN = function() {};
@ -71,7 +71,7 @@ let editCategoryFN = function() {};
let removeCategoryFN = function() {};
let deleteUnusedCategoriesFN = function() {};
let startTorrentsByCategoryFN = function() {};
let pauseTorrentsByCategoryFN = function() {};
let stopTorrentsByCategoryFN = function() {};
let deleteTorrentsByCategoryFN = function() {};
let torrentAddTagsFN = function() {};
let torrentSetTagsFN = function() {};
@ -80,10 +80,10 @@ let createTagFN = function() {};
let removeTagFN = function() {};
let deleteUnusedTagsFN = function() {};
let startTorrentsByTagFN = function() {};
let pauseTorrentsByTagFN = function() {};
let stopTorrentsByTagFN = function() {};
let deleteTorrentsByTagFN = function() {};
let resumeTorrentsByTrackerFN = function() {};
let pauseTorrentsByTrackerFN = function() {};
let startTorrentsByTrackerFN = function() {};
let stopTorrentsByTrackerFN = function() {};
let deleteTorrentsByTrackerFN = function() {};
let copyNameFN = function() {};
let copyInfohashFN = function(policy) {};
@ -405,11 +405,11 @@ const initializeWindows = function() {
deleteFN();
});
pauseFN = function() {
stopFN = function() {
const hashes = torrentsTable.selectedRowsIds();
if (hashes.length) {
new Request({
url: 'api/v2/torrents/pause',
url: 'api/v2/torrents/stop',
method: 'post',
data: {
hashes: hashes.join("|")
@ -423,7 +423,7 @@ const initializeWindows = function() {
const hashes = torrentsTable.selectedRowsIds();
if (hashes.length) {
new Request({
url: 'api/v2/torrents/resume',
url: 'api/v2/torrents/start',
method: 'post',
data: {
hashes: hashes.join("|")
@ -679,7 +679,7 @@ const initializeWindows = function() {
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL, TRACKERS_ALL);
if (hashes.length) {
new Request({
url: 'api/v2/torrents/resume',
url: 'api/v2/torrents/start',
method: 'post',
data: {
hashes: hashes.join("|")
@ -689,11 +689,11 @@ const initializeWindows = function() {
}
};
pauseTorrentsByCategoryFN = function(categoryHash) {
stopTorrentsByCategoryFN = function(categoryHash) {
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL, TRACKERS_ALL);
if (hashes.length) {
new Request({
url: 'api/v2/torrents/pause',
url: 'api/v2/torrents/stop',
method: 'post',
data: {
hashes: hashes.join("|")
@ -821,7 +821,7 @@ const initializeWindows = function() {
const hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, tagHash, TRACKERS_ALL);
if (hashes.length) {
new Request({
url: 'api/v2/torrents/resume',
url: 'api/v2/torrents/start',
method: 'post',
data: {
hashes: hashes.join("|")
@ -831,11 +831,11 @@ const initializeWindows = function() {
}
};
pauseTorrentsByTagFN = function(tagHash) {
stopTorrentsByTagFN = function(tagHash) {
const hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, tagHash, TRACKERS_ALL);
if (hashes.length) {
new Request({
url: 'api/v2/torrents/pause',
url: 'api/v2/torrents/stop',
method: 'post',
data: {
hashes: hashes.join("|")
@ -864,7 +864,7 @@ const initializeWindows = function() {
}
};
resumeTorrentsByTrackerFN = function(trackerHash) {
startTorrentsByTrackerFN = function(trackerHash) {
const trackerHashInt = Number.parseInt(trackerHash, 10);
let hashes = [];
switch (trackerHashInt) {
@ -881,7 +881,7 @@ const initializeWindows = function() {
if (hashes.length > 0) {
new Request({
url: 'api/v2/torrents/resume',
url: 'api/v2/torrents/start',
method: 'post',
data: {
hashes: hashes.join("|")
@ -891,7 +891,7 @@ const initializeWindows = function() {
}
};
pauseTorrentsByTrackerFN = function(trackerHash) {
stopTorrentsByTrackerFN = function(trackerHash) {
const trackerHashInt = Number.parseInt(trackerHash, 10);
let hashes = [];
switch (trackerHashInt) {
@ -908,7 +908,7 @@ const initializeWindows = function() {
if (hashes.length) {
new Request({
url: 'api/v2/torrents/pause',
url: 'api/v2/torrents/stop',
method: 'post',
data: {
hashes: hashes.join("|")
@ -1047,12 +1047,12 @@ const initializeWindows = function() {
}
};
addClickEvent('pauseAll', (e) => {
addClickEvent('stopAll', (e) => {
new Event(e).stop();
if (confirm('QBT_TR(Would you like to pause all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
if (confirm('QBT_TR(Would you like to stop all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
new Request({
url: 'api/v2/torrents/pause',
url: 'api/v2/torrents/stop',
method: 'post',
data: {
hashes: "all"
@ -1062,12 +1062,12 @@ const initializeWindows = function() {
}
});
addClickEvent('resumeAll', (e) => {
addClickEvent('startAll', (e) => {
new Event(e).stop();
if (confirm('QBT_TR(Would you like to resume all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
if (confirm('QBT_TR(Would you like to start all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
new Request({
url: 'api/v2/torrents/resume',
url: 'api/v2/torrents/start',
method: 'post',
data: {
hashes: "all"
@ -1077,7 +1077,7 @@ const initializeWindows = function() {
}
});
['pause', 'resume', 'recheck'].each(function(item) {
['stop', 'start', 'recheck'].each(function(item) {
addClickEvent(item, function(e) {
new Event(e).stop();
const hashes = torrentsTable.selectedRowsIds();