diff --git a/src/gui/transferlistmodel.cpp b/src/gui/transferlistmodel.cpp index 60e721922..1e9324cfc 100644 --- a/src/gui/transferlistmodel.cpp +++ b/src/gui/transferlistmodel.cpp @@ -193,8 +193,8 @@ QVariant TransferListModel::headerData(const int section, const Qt::Orientation case TR_INFOHASH_V1: return tr("Info Hash v1", "i.e: torrent info hash v1"); case TR_INFOHASH_V2: return tr("Info Hash v2", "i.e: torrent info hash v2"); case TR_REANNOUNCE: return tr("Reannounce In", "Indicates the time until next trackers reannounce"); - case TR_PRIVATE: return tr("Private", "Flags private torrents"); case TR_PERCENT_SELECTED: return tr("%", "Percentage of selected data to download"); + case TR_PRIVATE: return tr("Private", "Flags private torrents"); default: return {}; } } @@ -443,10 +443,10 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons return hashString(torrent->infoHash().v2()); case TR_REANNOUNCE: return reannounceString(torrent->nextAnnounce()); + case TR_PERCENT_SELECTED: + return torrent->hasMetadata() ? (QString::number((static_cast(torrent->wantedSize()) * 100) / torrent->totalSize(), 'f', 2) + u'%') : tr("N/A"); case TR_PRIVATE: return privateString(torrent->isPrivate(), torrent->hasMetadata()); - case TR_PERCENT_SELECTED: - return torrent->hasMetadata() ? QString::number((static_cast(torrent->wantedSize()) * 100) / torrent->totalSize(), 'f', 2) + u'%' : tr("N/A"); } return {}; @@ -531,7 +531,7 @@ QVariant TransferListModel::internalValue(const BitTorrent::Torrent *torrent, co case TR_PRIVATE: return (torrent->hasMetadata() ? torrent->isPrivate() : QVariant()); case TR_PERCENT_SELECTED: - return torrent->hasMetadata() ? (static_cast(torrent->wantedSize()) * 100) / torrent->totalSize() : 0; + return torrent->hasMetadata() ? ((static_cast(torrent->wantedSize()) * 100) / torrent->totalSize()) : 0; } return {}; diff --git a/src/gui/transferlistsortmodel.cpp b/src/gui/transferlistsortmodel.cpp index e71e00c5c..7a2eb13b0 100644 --- a/src/gui/transferlistsortmodel.cpp +++ b/src/gui/transferlistsortmodel.cpp @@ -204,11 +204,11 @@ int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &r return customCompare(leftValue.toLongLong(), rightValue.toLongLong()); case TransferListModel::TR_AVAILABILITY: + case TransferListModel::TR_PERCENT_SELECTED: + case TransferListModel::TR_POPULARITY: case TransferListModel::TR_PROGRESS: case TransferListModel::TR_RATIO: case TransferListModel::TR_RATIO_LIMIT: - case TransferListModel::TR_PERCENT_SELECTED: - case TransferListModel::TR_POPULARITY: return customCompare(leftValue.toReal(), rightValue.toReal()); case TransferListModel::TR_STATUS: diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 7e4330228..5a3e7d645 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -1564,7 +1564,7 @@ window.qBittorrent.DynamicTable ??= (() => { td.title = "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]"; return; } - const value = `${window.qBittorrent.Misc.toFixedPointString(percent, 2) }%`; + const value = `${window.qBittorrent.Misc.toFixedPointString(percent, 2)}%`; td.textContent = value; td.title = value; };