|
|
|
@ -1998,6 +1998,8 @@ void Session::increaseTorrentsPriority(const QStringList &hashes)
@@ -1998,6 +1998,8 @@ void Session::increaseTorrentsPriority(const QStringList &hashes)
|
|
|
|
|
torrentQueuePositionUp(torrent->nativeHandle()); |
|
|
|
|
torrentQueue.pop(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleTorrentsPrioritiesChanged(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Session::decreaseTorrentsPriority(const QStringList &hashes) |
|
|
|
@ -2022,6 +2024,8 @@ void Session::decreaseTorrentsPriority(const QStringList &hashes)
@@ -2022,6 +2024,8 @@ void Session::decreaseTorrentsPriority(const QStringList &hashes)
|
|
|
|
|
|
|
|
|
|
for (auto i = m_loadedMetadata.cbegin(); i != m_loadedMetadata.cend(); ++i) |
|
|
|
|
torrentQueuePositionBottom(m_nativeSession->find_torrent(i.key())); |
|
|
|
|
|
|
|
|
|
handleTorrentsPrioritiesChanged(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Session::topTorrentsPriority(const QStringList &hashes) |
|
|
|
@ -2043,6 +2047,8 @@ void Session::topTorrentsPriority(const QStringList &hashes)
@@ -2043,6 +2047,8 @@ void Session::topTorrentsPriority(const QStringList &hashes)
|
|
|
|
|
torrentQueuePositionTop(torrent->nativeHandle()); |
|
|
|
|
torrentQueue.pop(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleTorrentsPrioritiesChanged(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Session::bottomTorrentsPriority(const QStringList &hashes) |
|
|
|
@ -2067,6 +2073,8 @@ void Session::bottomTorrentsPriority(const QStringList &hashes)
@@ -2067,6 +2073,8 @@ void Session::bottomTorrentsPriority(const QStringList &hashes)
|
|
|
|
|
|
|
|
|
|
for (auto i = m_loadedMetadata.cbegin(); i != m_loadedMetadata.cend(); ++i) |
|
|
|
|
torrentQueuePositionBottom(m_nativeSession->find_torrent(i.key())); |
|
|
|
|
|
|
|
|
|
handleTorrentsPrioritiesChanged(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QHash<InfoHash, TorrentHandle *> Session::torrents() const |
|
|
|
@ -2360,7 +2368,7 @@ void Session::generateResumeData(bool final)
@@ -2360,7 +2368,7 @@ void Session::generateResumeData(bool final)
|
|
|
|
|
if (!final && !torrent->needSaveResumeData()) continue; |
|
|
|
|
if (torrent->hasMissingFiles() || torrent->hasError()) continue; |
|
|
|
|
|
|
|
|
|
saveTorrentResumeData(torrent, final); |
|
|
|
|
saveTorrentResumeData(torrent); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3531,10 +3539,22 @@ void Session::handleTorrentShareLimitChanged(TorrentHandle *const torrent)
@@ -3531,10 +3539,22 @@ void Session::handleTorrentShareLimitChanged(TorrentHandle *const torrent)
|
|
|
|
|
updateSeedingLimitTimer(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Session::saveTorrentResumeData(TorrentHandle *const torrent, bool finalSave) |
|
|
|
|
void Session::handleTorrentsPrioritiesChanged() |
|
|
|
|
{ |
|
|
|
|
// Save fastresume for the torrents that changed queue position
|
|
|
|
|
for (TorrentHandle *const torrent : torrents()) { |
|
|
|
|
if (!torrent->isSeed()) { |
|
|
|
|
// cached vs actual queue position, qBt starts queue at 1
|
|
|
|
|
if (torrent->queuePosition() != (torrent->nativeHandle().queue_position() + 1)) |
|
|
|
|
saveTorrentResumeData(torrent); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Session::saveTorrentResumeData(TorrentHandle *const torrent) |
|
|
|
|
{ |
|
|
|
|
qDebug("Saving fastresume data for %s", qUtf8Printable(torrent->name())); |
|
|
|
|
torrent->saveResumeData(finalSave); |
|
|
|
|
torrent->saveResumeData(); |
|
|
|
|
++m_numResumeData; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3653,8 +3673,11 @@ void Session::handleTorrentChecked(TorrentHandle *const torrent)
@@ -3653,8 +3673,11 @@ void Session::handleTorrentChecked(TorrentHandle *const torrent)
|
|
|
|
|
|
|
|
|
|
void Session::handleTorrentFinished(TorrentHandle *const torrent) |
|
|
|
|
{ |
|
|
|
|
if (!torrent->hasError() && !torrent->hasMissingFiles()) |
|
|
|
|
if (!torrent->hasError() && !torrent->hasMissingFiles()) { |
|
|
|
|
saveTorrentResumeData(torrent); |
|
|
|
|
if (isQueueingSystemEnabled()) |
|
|
|
|
handleTorrentsPrioritiesChanged(); |
|
|
|
|
} |
|
|
|
|
emit torrentFinished(torrent); |
|
|
|
|
|
|
|
|
|
qDebug("Checking if the torrent contains torrent files to download"); |
|
|
|
|