mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Merge pull request #11319 from Chocobo1/backport
Preserve relative order when moving to top/bottom in queue (backport)
This commit is contained in:
commit
73fd4d83af
1 changed files with 4 additions and 4 deletions
|
@ -2034,7 +2034,7 @@ void Session::topTorrentsPriority(const QStringList &hashes)
|
|||
{
|
||||
std::priority_queue<QPair<int, TorrentHandle *>,
|
||||
std::vector<QPair<int, TorrentHandle *>>,
|
||||
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||
|
||||
// Sort torrents by priority
|
||||
for (const InfoHash infoHash : hashes) {
|
||||
|
@ -2043,7 +2043,7 @@ void Session::topTorrentsPriority(const QStringList &hashes)
|
|||
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
||||
}
|
||||
|
||||
// Top torrents priority (starting with the ones with highest priority)
|
||||
// Top torrents priority (starting with the ones with lowest priority)
|
||||
while (!torrentQueue.empty()) {
|
||||
TorrentHandle *const torrent = torrentQueue.top().second;
|
||||
torrentQueuePositionTop(torrent->nativeHandle());
|
||||
|
@ -2057,7 +2057,7 @@ void Session::bottomTorrentsPriority(const QStringList &hashes)
|
|||
{
|
||||
std::priority_queue<QPair<int, TorrentHandle *>,
|
||||
std::vector<QPair<int, TorrentHandle *>>,
|
||||
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||
|
||||
// Sort torrents by priority
|
||||
for (const InfoHash infoHash : hashes) {
|
||||
|
@ -2066,7 +2066,7 @@ void Session::bottomTorrentsPriority(const QStringList &hashes)
|
|||
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
||||
}
|
||||
|
||||
// Bottom torrents priority (starting with the ones with lowest priority)
|
||||
// Bottom torrents priority (starting with the ones with highest priority)
|
||||
while (!torrentQueue.empty()) {
|
||||
TorrentHandle *const torrent = torrentQueue.top().second;
|
||||
torrentQueuePositionBottom(torrent->nativeHandle());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue