mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-09 00:52:30 -06:00
Add auto torrent management to webui context menu (addresses #6815)
This commit is contained in:
committed by
Chocobo1
parent
e2893fe68f
commit
771033a449
@@ -115,6 +115,9 @@
|
||||
<a href="#Category" class="arrow-right"><img src="theme/view-categories" alt="QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]</a>
|
||||
<ul id="contextCategoryList" class="scrollableMenu"></ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#AutoTorrentManagement"><img src="theme/checked" alt="QBT_TR(Automatic Torrent Management)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Automatic Torrent Management)QBT_TR[CONTEXT=TransferListWidget]</a>
|
||||
</li>
|
||||
<li id="queueingMenuItems" class="separator">
|
||||
<a href="#priority" class="arrow-right"><span style="display: inline-block; width:16px"></span> QBT_TR(Priority)QBT_TR[CONTEXT=TransferListWidget]</a>
|
||||
<ul>
|
||||
|
||||
@@ -255,6 +255,8 @@ var TorrentsTableContextMenu = new Class({
|
||||
all_are_force_start = true;
|
||||
there_are_force_start = false;
|
||||
all_are_super_seeding = true;
|
||||
all_are_auto_tmm = true;
|
||||
there_are_auto_tmm = false;
|
||||
|
||||
var h = torrentsTable.selectedRowsIds();
|
||||
h.each(function(item, index){
|
||||
@@ -284,6 +286,11 @@ var TorrentsTableContextMenu = new Class({
|
||||
all_are_force_start = false;
|
||||
else
|
||||
there_are_force_start = true;
|
||||
|
||||
if (data['auto_tmm'] != true)
|
||||
all_are_auto_tmm = false;
|
||||
else
|
||||
there_are_auto_tmm = true;
|
||||
});
|
||||
|
||||
show_seq_dl = true;
|
||||
@@ -336,6 +343,12 @@ var TorrentsTableContextMenu = new Class({
|
||||
this.hideItem('ForceStart');
|
||||
else if (!there_are_paused && !there_are_force_start)
|
||||
this.hideItem('Start');
|
||||
|
||||
if (!all_are_auto_tmm && there_are_auto_tmm)
|
||||
this.hideItem('AutoTorrentManagement');
|
||||
else
|
||||
this.setItemChecked('AutoTorrentManagement', all_are_auto_tmm);
|
||||
|
||||
},
|
||||
|
||||
updateCategoriesSubMenu : function (category_list) {
|
||||
|
||||
@@ -303,6 +303,27 @@ initializeWindows = function() {
|
||||
}
|
||||
};
|
||||
|
||||
autoTorrentManagementFN = function() {
|
||||
var hashes = torrentsTable.selectedRowsIds();
|
||||
if (hashes.length) {
|
||||
var enable = false;
|
||||
hashes.each(function(hash, index) {
|
||||
var row = torrentsTable.rows[hash];
|
||||
if (!row.full_data.auto_tmm)
|
||||
enable = true;
|
||||
});
|
||||
new Request({
|
||||
url: 'command/setAutoTMM',
|
||||
method: 'post',
|
||||
data: {
|
||||
hashes: hashes.join("|"),
|
||||
enable: enable
|
||||
}
|
||||
}).send();
|
||||
updateMainData();
|
||||
}
|
||||
};
|
||||
|
||||
recheckFN = function() {
|
||||
var hashes = torrentsTable.selectedRowsIds();
|
||||
if (hashes.length) {
|
||||
|
||||
@@ -70,6 +70,9 @@
|
||||
toggleFirstLastPiecePrioFN();
|
||||
},
|
||||
|
||||
AutoTorrentManagement : function (element, ref) {
|
||||
autoTorrentManagementFN();
|
||||
},
|
||||
ForceRecheck : function (element, ref) {
|
||||
recheckFN();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user