From 811b525b1d9e47ce443ee3dbd705607e206174ca Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 2 Oct 2019 13:58:12 +0800 Subject: [PATCH] Preserve relative order when moving to top/bottom in queue --- src/base/bittorrent/session.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 3c2367150..9bc5125ef 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -2034,7 +2034,7 @@ void Session::topTorrentsPriority(const QStringList &hashes) { std::priority_queue, std::vector>, - std::greater>> torrentQueue; + std::less>> 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, std::vector>, - std::less>> torrentQueue; + std::greater>> 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());