mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Notify user when torrent moving finished
This commit is contained in:
parent
2a638d16e0
commit
bac7fbc68e
4 changed files with 26 additions and 3 deletions
|
@ -4699,10 +4699,13 @@ void Session::handleStorageMovedAlert(const lt::storage_moved_alert *p)
|
|||
Q_ASSERT(newPath == currentJob.path);
|
||||
|
||||
const InfoHash infoHash = currentJob.torrentHandle.info_hash();
|
||||
const TorrentHandleImpl *torrent = m_torrents.value(infoHash);
|
||||
TorrentHandleImpl *torrent = m_torrents.value(infoHash);
|
||||
const QString torrentName = (torrent ? torrent->name() : QString {infoHash});
|
||||
LogMsg(tr("\"%1\" is successfully moved to \"%2\".").arg(torrentName, newPath));
|
||||
|
||||
if (torrent)
|
||||
emit torrentStorageMoveFinished(torrent, newPath);
|
||||
|
||||
handleMoveTorrentStorageJobFinished();
|
||||
}
|
||||
|
||||
|
@ -4714,11 +4717,15 @@ void Session::handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert
|
|||
Q_ASSERT(currentJob.torrentHandle == p->handle);
|
||||
|
||||
const InfoHash infoHash = currentJob.torrentHandle.info_hash();
|
||||
const TorrentHandleImpl *torrent = m_torrents.value(infoHash);
|
||||
TorrentHandleImpl *torrent = m_torrents.value(infoHash);
|
||||
const QString torrentName = (torrent ? torrent->name() : QString {infoHash});
|
||||
const QString currentLocation = QString::fromStdString(p->handle.status(lt::torrent_handle::query_save_path).save_path);
|
||||
const QString errorMessage = QString::fromStdString(p->message());
|
||||
LogMsg(tr("Failed to move \"%1\" from \"%2\" to \"%3\". Reason: %4.")
|
||||
.arg(torrentName, currentLocation, currentJob.path, QString::fromStdString(p->message())), Log::CRITICAL);
|
||||
.arg(torrentName, currentLocation, currentJob.path, errorMessage), Log::CRITICAL);
|
||||
|
||||
if (torrent)
|
||||
emit torrentStorageMoveFailed(torrent, currentJob.path, errorMessage);
|
||||
|
||||
handleMoveTorrentStorageJobFinished();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue