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
70 changed files with 413 additions and 391 deletions

View File

@@ -236,8 +236,8 @@ window.addEventListener("DOMContentLoaded", function() {
$("downloading_filter").removeClass("selectedFilter");
$("seeding_filter").removeClass("selectedFilter");
$("completed_filter").removeClass("selectedFilter");
$("paused_filter").removeClass("selectedFilter");
$("resumed_filter").removeClass("selectedFilter");
$("stopped_filter").removeClass("selectedFilter");
$("running_filter").removeClass("selectedFilter");
$("active_filter").removeClass("selectedFilter");
$("inactive_filter").removeClass("selectedFilter");
$("stalled_filter").removeClass("selectedFilter");
@@ -414,8 +414,8 @@ window.addEventListener("DOMContentLoaded", function() {
updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('completed', 'QBT_TR(Completed (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('resumed', 'QBT_TR(Resumed (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('paused', 'QBT_TR(Paused (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('running', 'QBT_TR(Running (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('stopped', 'QBT_TR(Stopped (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('active', 'QBT_TR(Active (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('inactive', 'QBT_TR(Inactive (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
updateFilter('stalled', 'QBT_TR(Stalled (%1))QBT_TR[CONTEXT=StatusFilterWidget]');

View File

@@ -306,8 +306,8 @@ window.qBittorrent.ContextMenu = (function() {
let all_are_f_l_piece_prio = true;
let there_are_f_l_piece_prio = false;
let all_are_downloaded = true;
let all_are_paused = true;
let there_are_paused = false;
let all_are_stopped = true;
let there_are_stopped = false;
let all_are_force_start = true;
let there_are_force_start = false;
let all_are_super_seeding = true;
@@ -334,10 +334,10 @@ window.qBittorrent.ContextMenu = (function() {
else if (data['super_seeding'] !== true)
all_are_super_seeding = false;
if (data['state'] != 'pausedUP' && data['state'] != 'pausedDL')
all_are_paused = false;
if (data['state'] != 'stoppedUP' && data['state'] != 'stoppedDL')
all_are_stopped = false;
else
there_are_paused = true;
there_are_stopped = true;
if (data['force_start'] !== true)
all_are_force_start = false;
@@ -406,13 +406,13 @@ window.qBittorrent.ContextMenu = (function() {
}
this.showItem('start');
this.showItem('pause');
this.showItem('stop');
this.showItem('forceStart');
if (all_are_paused)
this.hideItem('pause');
if (all_are_stopped)
this.hideItem('stop');
else if (all_are_force_start)
this.hideItem('forceStart');
else if (!there_are_paused && !there_are_force_start)
else if (!there_are_stopped && !there_are_force_start)
this.hideItem('start');
if (!all_are_auto_tmm && there_are_auto_tmm) {

View File

@@ -63,7 +63,7 @@ window.qBittorrent.Download = (function() {
defaultSavePath = pref.save_path;
$('savepath').setProperty('value', defaultSavePath);
$('startTorrent').checked = !pref.start_paused_enabled;
$('startTorrent').checked = !pref.add_stopped_enabled;
$('addToTopOfQueue').checked = pref.add_to_top_of_queue;
if (pref.auto_tmm_enabled == 1) {

View File

@@ -981,11 +981,11 @@ window.qBittorrent.DynamicTable = (function() {
state = "stalledDL";
img_path = "images/stalledDL.svg";
break;
case "pausedDL":
case "stoppedDL":
state = "torrent-stop";
img_path = "images/stopped.svg";
break;
case "pausedUP":
case "stoppedUP":
state = "checked-completed";
img_path = "images/checked-completed.svg";
break;
@@ -1075,10 +1075,10 @@ window.qBittorrent.DynamicTable = (function() {
case "checkingResumeData":
status = "QBT_TR(Checking resume data)QBT_TR[CONTEXT=TransferListDelegate]";
break;
case "pausedDL":
status = "QBT_TR(Paused)QBT_TR[CONTEXT=TransferListDelegate]";
case "stoppedDL":
status = "QBT_TR(Stopped)QBT_TR[CONTEXT=TransferListDelegate]";
break;
case "pausedUP":
case "stoppedUP":
status = "QBT_TR(Completed)QBT_TR[CONTEXT=TransferListDelegate]";
break;
case "moving":
@@ -1338,12 +1338,12 @@ window.qBittorrent.DynamicTable = (function() {
if ((state != 'uploading') && (state.indexOf('UP') === -1))
return false;
break;
case 'paused':
if (state.indexOf('paused') === -1)
case 'stopped':
if (state.indexOf('stopped') === -1)
return false;
break;
case 'resumed':
if (state.indexOf('paused') > -1)
case 'running':
if (state.indexOf('stopped') > -1)
return false;
break;
case 'stalled':
@@ -1509,10 +1509,10 @@ window.qBittorrent.DynamicTable = (function() {
this._this.selectRow(this.rowId);
const row = this._this.rows.get(this.rowId);
const state = row['full_data'].state;
if (state.indexOf('paused') > -1)
if (state.indexOf('stopped') > -1)
startFN();
else
pauseFN();
stopFN();
return true;
});
tr.addClass("torrentsTableContextMenuTarget");

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();