Add ability to display torrent "privateness" in UI

PR #20951.

---------

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
Co-authored-by: thalieht <thalieht@users.noreply.github.com>
This commit is contained in:
ManiMatter 2024-07-07 18:09:57 +02:00 committed by GitHub
parent a4f63a5c30
commit 87a202c71e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 183 additions and 85 deletions

View file

@ -948,6 +948,7 @@ window.qBittorrent.DynamicTable = (function() {
this.newColumn("last_activity", "", "QBT_TR(Last Activity)QBT_TR[CONTEXT=TransferListModel]", 100, false);
this.newColumn("availability", "", "QBT_TR(Availability)QBT_TR[CONTEXT=TransferListModel]", 100, false);
this.newColumn("reannounce", "", "QBT_TR(Reannounce In)QBT_TR[CONTEXT=TransferListModel]", 100, false);
this.newColumn("private", "", "QBT_TR(Private)QBT_TR[CONTEXT=TransferListModel]", 100, false);
this.columns["state_icon"].onclick = "";
this.columns["state_icon"].dataProperties[0] = "state";
@ -1331,6 +1332,19 @@ window.qBittorrent.DynamicTable = (function() {
td.set("text", time);
td.set("title", time);
};
// private
this.columns["private"].updateTd = function(td, row) {
const hasMetadata = row["full_data"].has_metadata;
const isPrivate = this.getRowValue(row);
const string = hasMetadata
? (isPrivate
? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]"
: "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]")
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
td.set("text", string);
td.set("title", string);
};
},
applyFilter: function(row, filterName, categoryHash, tagHash, trackerHash, filterTerms) {