Immediately update torrent status on moving files

PR #19220.
This commit is contained in:
Vladimir Golovnev 2023-06-25 12:45:58 +03:00 committed by Vladimir Golovnev (Glassez)
commit 4497ca4a0e
3 changed files with 15 additions and 2 deletions

View file

@ -4637,6 +4637,11 @@ void SessionImpl::handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoH
}
}
void SessionImpl::handleTorrentStorageMovingStateChanged(TorrentImpl *torrent)
{
emit torrentsUpdated({torrent});
}
bool SessionImpl::addMoveTorrentStorageJob(TorrentImpl *torrent, const Path &newPath, const MoveStorageMode mode)
{
Q_ASSERT(torrent);

View file

@ -422,6 +422,7 @@ namespace BitTorrent
void handleTorrentUrlSeedsRemoved(TorrentImpl *const torrent, const QVector<QUrl> &urlSeeds);
void handleTorrentResumeDataReady(TorrentImpl *const torrent, const LoadTorrentParams &data);
void handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoHash &prevInfoHash);
void handleTorrentStorageMovingStateChanged(TorrentImpl *torrent);
bool addMoveTorrentStorageJob(TorrentImpl *torrent, const Path &newPath, MoveStorageMode mode);

View file

@ -1744,9 +1744,13 @@ void TorrentImpl::moveStorage(const Path &newPath, const MoveStorageMode mode)
}
if (m_session->addMoveTorrentStorageJob(this, newPath, mode))
{
if (!m_storageIsMoving)
{
m_storageIsMoving = true;
updateState();
m_session->handleTorrentStorageMovingStateChanged(this);
}
}
}
@ -1778,6 +1782,9 @@ void TorrentImpl::handleMoveStorageJobFinished(const Path &path, const bool hasO
if (!m_storageIsMoving)
{
updateState();
m_session->handleTorrentStorageMovingStateChanged(this);
if (m_hasMissingFiles)
{
// it can be moved to the proper location