diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index 957a33247cb9..73f93fcc267f 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -4412,6 +4412,9 @@ void SessionImpl::setQueueingSystemEnabled(const bool enabled) m_torrentsQueueChanged = true; else removeTorrentsQueue(); + + for (TorrentImpl *torrent : asConst(m_torrents)) + torrent->handleQueueingModeChanged(); } } diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 5a1be7a4e052..9431b4c279e3 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -999,6 +999,9 @@ bool TorrentImpl::isStopped() const bool TorrentImpl::isQueued() const { + if (!m_session->isQueueingSystemEnabled()) + return false; + // Torrent is Queued if it isn't in Stopped state but paused internally return (!isStopped() && (m_nativeStatus.flags & lt::torrent_flags::auto_managed) @@ -1153,7 +1156,7 @@ void TorrentImpl::updateState() { if (isStopped()) m_state = TorrentState::StoppedDownloading; - else if (m_session->isQueueingSystemEnabled() && isQueued()) + else if (isQueued()) m_state = TorrentState::QueuedDownloading; else m_state = isForced() ? TorrentState::ForcedDownloadingMetadata : TorrentState::DownloadingMetadata; @@ -1167,7 +1170,7 @@ void TorrentImpl::updateState() { if (isStopped()) m_state = TorrentState::StoppedUploading; - else if (m_session->isQueueingSystemEnabled() && isQueued()) + else if (isQueued()) m_state = TorrentState::QueuedUploading; else if (isForced()) m_state = TorrentState::ForcedUploading; @@ -1180,7 +1183,7 @@ void TorrentImpl::updateState() { if (isStopped()) m_state = TorrentState::StoppedDownloading; - else if (m_session->isQueueingSystemEnabled() && isQueued()) + else if (isQueued()) m_state = TorrentState::QueuedDownloading; else if (isForced()) m_state = TorrentState::ForcedDownloading; @@ -1953,6 +1956,11 @@ void TorrentImpl::handleStateUpdate(const lt::torrent_status &nativeStatus) updateStatus(nativeStatus); } +void TorrentImpl::handleQueueingModeChanged() +{ + updateState(); +} + void TorrentImpl::handleMoveStorageJobFinished(const Path &path, const MoveStorageContext context, const bool hasOutstandingJob) { if (context == MoveStorageContext::ChangeSavePath) diff --git a/src/base/bittorrent/torrentimpl.h b/src/base/bittorrent/torrentimpl.h index 44907c164f4a..54b84c1f4fd0 100644 --- a/src/base/bittorrent/torrentimpl.h +++ b/src/base/bittorrent/torrentimpl.h @@ -269,6 +269,7 @@ namespace BitTorrent void handleAlert(const lt::alert *a); void handleStateUpdate(const lt::torrent_status &nativeStatus); + void handleQueueingModeChanged(); void handleCategoryOptionsChanged(); void handleAppendExtensionToggled(); void handleUnwantedFolderToggled(); diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index a3307447499e..a1b79b29e327 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -1120,8 +1120,7 @@ void TransferListWidget::displayListMenu() needsStop = true; } - const bool queued = (BitTorrent::Session::instance()->isQueueingSystemEnabled() && torrent->isQueued()); - + const bool queued = torrent->isQueued(); if (!isStopped && !rechecking && !queued) oneCanForceReannounce = true;