+ int customCompare(const T &left, const T &right)
+ {
+ const bool isLeftValid = isValid(left);
+ const bool isRightValid = isValid(right);
if (isLeftValid && isRightValid)
return threeWayCompare(left, right);
@@ -209,6 +215,7 @@ int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &r
case TransferListModel::TR_DLLIMIT:
case TransferListModel::TR_DLSPEED:
+ case TransferListModel::TR_PRIVATE:
case TransferListModel::TR_QUEUE_POSITION:
case TransferListModel::TR_UPLIMIT:
case TransferListModel::TR_UPSPEED:
diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp
index b08e6b8b3..85ac7b53a 100644
--- a/src/gui/transferlistwidget.cpp
+++ b/src/gui/transferlistwidget.cpp
@@ -184,6 +184,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
setColumnHidden(TransferListModel::TR_LAST_ACTIVITY, true);
setColumnHidden(TransferListModel::TR_TOTAL_SIZE, true);
setColumnHidden(TransferListModel::TR_REANNOUNCE, true);
+ setColumnHidden(TransferListModel::TR_PRIVATE, true);
}
//Ensure that at least one column is visible at all times
diff --git a/src/webui/api/serialize/serialize_torrent.cpp b/src/webui/api/serialize/serialize_torrent.cpp
index 4aa01121a..600ffc68c 100644
--- a/src/webui/api/serialize/serialize_torrent.cpp
+++ b/src/webui/api/serialize/serialize_torrent.cpp
@@ -163,7 +163,8 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
{KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()},
{KEY_TORRENT_REANNOUNCE, torrent.nextAnnounce()},
{KEY_TORRENT_COMMENT, torrent.comment()},
- {KEY_TORRENT_PRIVATE, torrent.isPrivate()},
- {KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()}
+ {KEY_TORRENT_PRIVATE, (torrent.hasMetadata() ? torrent.isPrivate() : QVariant())},
+ {KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()},
+ {KEY_TORRENT_HAS_METADATA, torrent.hasMetadata()}
};
}
diff --git a/src/webui/api/serialize/serialize_torrent.h b/src/webui/api/serialize/serialize_torrent.h
index ae5088e36..c9812ac07 100644
--- a/src/webui/api/serialize/serialize_torrent.h
+++ b/src/webui/api/serialize/serialize_torrent.h
@@ -94,5 +94,6 @@ inline const QString KEY_TORRENT_AVAILABILITY = u"availability"_s;
inline const QString KEY_TORRENT_REANNOUNCE = u"reannounce"_s;
inline const QString KEY_TORRENT_COMMENT = u"comment"_s;
inline const QString KEY_TORRENT_PRIVATE = u"private"_s;
+inline const QString KEY_TORRENT_HAS_METADATA = u"has_metadata"_s;
QVariantMap serialize(const BitTorrent::Torrent &torrent);
diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp
index 0ad56b094..c33b46147 100644
--- a/src/webui/api/torrentscontroller.cpp
+++ b/src/webui/api/torrentscontroller.cpp
@@ -116,6 +116,8 @@ const QString KEY_PROP_PRIVATE = u"private"_s;
const QString KEY_PROP_SSL_CERTIFICATE = u"ssl_certificate"_s;
const QString KEY_PROP_SSL_PRIVATEKEY = u"ssl_private_key"_s;
const QString KEY_PROP_SSL_DHPARAMS = u"ssl_dh_params"_s;
+const QString KEY_PROP_HAS_METADATA = u"has_metadata"_s;
+
// File keys
const QString KEY_FILE_INDEX = u"index"_s;
@@ -438,6 +440,8 @@ void TorrentsController::propertiesAction()
const int uploadLimit = torrent->uploadLimit();
const qreal ratio = torrent->realRatio();
const qreal popularity = torrent->popularity();
+ const bool hasMetadata = torrent->hasMetadata();
+ const bool isPrivate = torrent->isPrivate();
const QJsonObject ret
{
@@ -474,14 +478,15 @@ void TorrentsController::propertiesAction()
{KEY_PROP_PIECES_HAVE, torrent->piecesHave()},
{KEY_PROP_CREATED_BY, torrent->creator()},
{KEY_PROP_IS_PRIVATE, torrent->isPrivate()}, // used for maintaining backward compatibility
- {KEY_PROP_PRIVATE, torrent->isPrivate()},
+ {KEY_PROP_PRIVATE, (hasMetadata ? isPrivate : QJsonValue())},
{KEY_PROP_ADDITION_DATE, Utils::DateTime::toSecsSinceEpoch(torrent->addedTime())},
{KEY_PROP_LAST_SEEN, Utils::DateTime::toSecsSinceEpoch(torrent->lastSeenComplete())},
{KEY_PROP_COMPLETION_DATE, Utils::DateTime::toSecsSinceEpoch(torrent->completedTime())},
{KEY_PROP_CREATION_DATE, Utils::DateTime::toSecsSinceEpoch(torrent->creationDate())},
{KEY_PROP_SAVE_PATH, torrent->savePath().toString()},
{KEY_PROP_DOWNLOAD_PATH, torrent->downloadPath().toString()},
- {KEY_PROP_COMMENT, torrent->comment()}
+ {KEY_PROP_COMMENT, torrent->comment()},
+ {KEY_PROP_HAS_METADATA, torrent->hasMetadata()}
};
setResult(ret);
diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h
index 9465195f6..4d3049341 100644
--- a/src/webui/webapplication.h
+++ b/src/webui/webapplication.h
@@ -54,7 +54,7 @@
#include "base/utils/version.h"
#include "api/isessionmanager.h"
-inline const Utils::Version<3, 2> API_VERSION {2, 11, 1};
+inline const Utils::Version<3, 2> API_VERSION {2, 11, 2};
class QTimer;
diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js
index 07503ea77..55a7e0900 100644
--- a/src/webui/www/private/scripts/dynamicTable.js
+++ b/src/webui/www/private/scripts/dynamicTable.js
@@ -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) {
diff --git a/src/webui/www/private/scripts/prop-general.js b/src/webui/www/private/scripts/prop-general.js
index 96a48f3ba..402199501 100644
--- a/src/webui/www/private/scripts/prop-general.js
+++ b/src/webui/www/private/scripts/prop-general.js
@@ -70,6 +70,7 @@ window.qBittorrent.PropGeneral = (function() {
$("torrent_hash_v2").set("html", "");
$("save_path").set("html", "");
$("comment").set("html", "");
+ $("private").set("html", "");
piecesBar.clear();
};
@@ -210,6 +211,15 @@ window.qBittorrent.PropGeneral = (function() {
$("save_path").set("html", data.save_path);
$("comment").set("html", window.qBittorrent.Misc.parseHtmlLinks(window.qBittorrent.Misc.escapeHtml(data.comment)));
+
+ if (data.has_metadata) {
+ $("private").set("text", (data.private
+ ? "QBT_TR(Yes)QBT_TR[CONTEXT=PropertiesWidget]"
+ : "QBT_TR(No)QBT_TR[CONTEXT=PropertiesWidget]"));
+ }
+ else {
+ $("private").set("text", "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]");
+ }
}
else {
clearData();
diff --git a/src/webui/www/private/views/properties.html b/src/webui/www/private/views/properties.html
index 350f569ad..b42c8d19f 100644
--- a/src/webui/www/private/views/properties.html
+++ b/src/webui/www/private/views/properties.html
@@ -74,6 +74,10 @@
QBT_TR(Created On:)QBT_TR[CONTEXT=PropertiesWidget] |
|
+
+ QBT_TR(Private:)QBT_TR[CONTEXT=PropertiesWidget] |
+ |
+
QBT_TR(Info Hash v1:)QBT_TR[CONTEXT=PropertiesWidget] |
|