mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Pass number to WebUI instead of text and use float when comparing.
This commit is contained in:
parent
44b0a59fde
commit
b70d824854
3 changed files with 23 additions and 1 deletions
|
@ -208,7 +208,6 @@ int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &r
|
||||||
case TransferListModel::TR_RATIO:
|
case TransferListModel::TR_RATIO:
|
||||||
case TransferListModel::TR_RATIO_LIMIT:
|
case TransferListModel::TR_RATIO_LIMIT:
|
||||||
case TransferListModel::TR_POPULARITY:
|
case TransferListModel::TR_POPULARITY:
|
||||||
case TransferListModel::TR_PERCENT_SELECTED:
|
|
||||||
return customCompare(leftValue.toReal(), rightValue.toReal());
|
return customCompare(leftValue.toReal(), rightValue.toReal());
|
||||||
|
|
||||||
case TransferListModel::TR_STATUS:
|
case TransferListModel::TR_STATUS:
|
||||||
|
@ -243,6 +242,9 @@ int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &r
|
||||||
return threeWayCompare(totalL, totalR);
|
return threeWayCompare(totalL, totalR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TransferListModel::TR_PERCENT_SELECTED:
|
||||||
|
return customCompare(leftValue.toFloat(), rightValue.toFloat());
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Missing comparison case");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "Missing comparison case");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -178,6 +178,14 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
||||||
{KEY_TORRENT_LAST_ACTIVITY_TIME, getLastActivityTime()},
|
{KEY_TORRENT_LAST_ACTIVITY_TIME, getLastActivityTime()},
|
||||||
{KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()},
|
{KEY_TORRENT_AVAILABILITY, torrent.distributedCopies()},
|
||||||
{KEY_TORRENT_REANNOUNCE, torrent.nextAnnounce()},
|
{KEY_TORRENT_REANNOUNCE, torrent.nextAnnounce()},
|
||||||
|
<<<<<<< HEAD
|
||||||
{KEY_TORRENT_COMMENT, torrent.comment()}
|
{KEY_TORRENT_COMMENT, torrent.comment()}
|
||||||
|
=======
|
||||||
|
{KEY_TORRENT_COMMENT, torrent.comment()},
|
||||||
|
{KEY_TORRENT_PRIVATE, (torrent.hasMetadata() ? torrent.isPrivate() : QVariant())},
|
||||||
|
{KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()},
|
||||||
|
{KEY_TORRENT_HAS_METADATA, torrent.hasMetadata()},
|
||||||
|
{KEY_TORRENT_PERCENT_SELECTED, torrent.hasMetadata() ? (torrent.wantedSize() * 100) / torrent.totalSize() : -1},
|
||||||
|
>>>>>>> ba7b726ce (Pass number to WebUI instead of text and use float when comparing.)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1555,6 +1555,18 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
td.textContent = string;
|
td.textContent = string;
|
||||||
td.title = string;
|
td.title = string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// percent_selected
|
||||||
|
this.columns["percent_selected"].updateTd = function(td, row) {
|
||||||
|
if (this.getRowValue(row) === -1) {
|
||||||
|
td.textContent = "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]";
|
||||||
|
td.title = "QBT_TR(N/A)QBT_TR[CONTEXT=TrackerListWidget]";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const value = window.qBittorrent.Misc.toFixedPointString(this.getRowValue(row), 2) + "%";
|
||||||
|
td.textContent = value;
|
||||||
|
td.title = value;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
applyFilter(row, filterName, category, tag, trackerHost, filterTerms) {
|
applyFilter(row, filterName, category, tag, trackerHost, filterTerms) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue