mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 23:37:59 +00:00
Notify user when torrent moving finished
This commit is contained in:
parent
2a638d16e0
commit
bac7fbc68e
@ -4699,10 +4699,13 @@ void Session::handleStorageMovedAlert(const lt::storage_moved_alert *p)
|
|||||||
Q_ASSERT(newPath == currentJob.path);
|
Q_ASSERT(newPath == currentJob.path);
|
||||||
|
|
||||||
const InfoHash infoHash = currentJob.torrentHandle.info_hash();
|
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 torrentName = (torrent ? torrent->name() : QString {infoHash});
|
||||||
LogMsg(tr("\"%1\" is successfully moved to \"%2\".").arg(torrentName, newPath));
|
LogMsg(tr("\"%1\" is successfully moved to \"%2\".").arg(torrentName, newPath));
|
||||||
|
|
||||||
|
if (torrent)
|
||||||
|
emit torrentStorageMoveFinished(torrent, newPath);
|
||||||
|
|
||||||
handleMoveTorrentStorageJobFinished();
|
handleMoveTorrentStorageJobFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4714,11 +4717,15 @@ void Session::handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert
|
|||||||
Q_ASSERT(currentJob.torrentHandle == p->handle);
|
Q_ASSERT(currentJob.torrentHandle == p->handle);
|
||||||
|
|
||||||
const InfoHash infoHash = currentJob.torrentHandle.info_hash();
|
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 torrentName = (torrent ? torrent->name() : QString {infoHash});
|
||||||
const QString currentLocation = QString::fromStdString(p->handle.status(lt::torrent_handle::query_save_path).save_path);
|
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.")
|
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();
|
handleMoveTorrentStorageJobFinished();
|
||||||
}
|
}
|
||||||
|
@ -502,6 +502,8 @@ namespace BitTorrent
|
|||||||
void torrentResumed(BitTorrent::TorrentHandle *const torrent);
|
void torrentResumed(BitTorrent::TorrentHandle *const torrent);
|
||||||
void torrentSavePathChanged(BitTorrent::TorrentHandle *const torrent);
|
void torrentSavePathChanged(BitTorrent::TorrentHandle *const torrent);
|
||||||
void torrentSavingModeChanged(BitTorrent::TorrentHandle *const torrent);
|
void torrentSavingModeChanged(BitTorrent::TorrentHandle *const torrent);
|
||||||
|
void torrentStorageMoveFailed(BitTorrent::TorrentHandle *const torrent, const QString &targetPath, const QString &error);
|
||||||
|
void torrentStorageMoveFinished(BitTorrent::TorrentHandle *const torrent, const QString &newPath);
|
||||||
void torrentsUpdated(const QVector<BitTorrent::TorrentHandle *> &torrents);
|
void torrentsUpdated(const QVector<BitTorrent::TorrentHandle *> &torrents);
|
||||||
void torrentTagAdded(TorrentHandle *const torrent, const QString &tag);
|
void torrentTagAdded(TorrentHandle *const torrent, const QString &tag);
|
||||||
void torrentTagRemoved(TorrentHandle *const torrent, const QString &tag);
|
void torrentTagRemoved(TorrentHandle *const torrent, const QString &tag);
|
||||||
|
@ -201,6 +201,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::downloadFromUrlFailed, this, &MainWindow::handleDownloadFromUrlFailure);
|
connect(BitTorrent::Session::instance(), &BitTorrent::Session::downloadFromUrlFailed, this, &MainWindow::handleDownloadFromUrlFailure);
|
||||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::speedLimitModeChanged, this, &MainWindow::updateAltSpeedsBtn);
|
connect(BitTorrent::Session::instance(), &BitTorrent::Session::speedLimitModeChanged, this, &MainWindow::updateAltSpeedsBtn);
|
||||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::recursiveTorrentDownloadPossible, this, &MainWindow::askRecursiveTorrentDownloadConfirmation);
|
connect(BitTorrent::Session::instance(), &BitTorrent::Session::recursiveTorrentDownloadPossible, this, &MainWindow::askRecursiveTorrentDownloadConfirmation);
|
||||||
|
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentStorageMoveFinished, this, &MainWindow::moveTorrentFinished);
|
||||||
|
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentStorageMoveFailed, this, &MainWindow::moveTorrentFailed);
|
||||||
|
|
||||||
qDebug("create tabWidget");
|
qDebug("create tabWidget");
|
||||||
m_tabs = new HidableTabWidget(this);
|
m_tabs = new HidableTabWidget(this);
|
||||||
@ -836,6 +838,16 @@ void MainWindow::finishedTorrent(BitTorrent::TorrentHandle *const torrent) const
|
|||||||
showNotificationBaloon(tr("Download completion"), tr("'%1' has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(torrent->name()));
|
showNotificationBaloon(tr("Download completion"), tr("'%1' has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(torrent->name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::moveTorrentFinished(BitTorrent::TorrentHandle *const torrent, const QString &newPath) const
|
||||||
|
{
|
||||||
|
showNotificationBaloon(tr("Torrent moving finished"), tr("'%1' has finished moving files to '%2'.").arg(torrent->name(), newPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::moveTorrentFailed(BitTorrent::TorrentHandle *const torrent, const QString &targetPath, const QString &error) const
|
||||||
|
{
|
||||||
|
showNotificationBaloon(tr("Torrent moving failed"), tr("'%1' has failed moving files to '%2'. Reason: %3").arg(torrent->name(), targetPath, error));
|
||||||
|
}
|
||||||
|
|
||||||
// Notification when disk is full
|
// Notification when disk is full
|
||||||
void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg) const
|
void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg) const
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,8 @@ private slots:
|
|||||||
void addTorrentFailed(const QString &error) const;
|
void addTorrentFailed(const QString &error) const;
|
||||||
void torrentNew(BitTorrent::TorrentHandle *const torrent) const;
|
void torrentNew(BitTorrent::TorrentHandle *const torrent) const;
|
||||||
void finishedTorrent(BitTorrent::TorrentHandle *const torrent) const;
|
void finishedTorrent(BitTorrent::TorrentHandle *const torrent) const;
|
||||||
|
void moveTorrentFinished(BitTorrent::TorrentHandle *const torrent, const QString &newPath) const;
|
||||||
|
void moveTorrentFailed(BitTorrent::TorrentHandle *const torrent, const QString &targetPath, const QString &error) const;
|
||||||
void askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHandle *const torrent);
|
void askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHandle *const torrent);
|
||||||
void optionsSaved();
|
void optionsSaved();
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
|
Loading…
Reference in New Issue
Block a user