mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Provide correct error description in "upload mode"
This commit is contained in:
committed by
Vladimir Golovnev (glassez)
parent
0c71756009
commit
6aa8251b98
@@ -1005,7 +1005,13 @@ QString TorrentImpl::error() const
|
||||
return QString::fromStdString(m_nativeStatus.errc.message());
|
||||
|
||||
if (m_nativeStatus.flags & lt::torrent_flags::upload_mode)
|
||||
return tr("There's not enough space on disk. Torrent is currently in \"upload only\" mode.");
|
||||
{
|
||||
const QString writeErrorStr = tr("Couldn't write to file.");
|
||||
const QString uploadModeStr = tr("Torrent is currently in \"upload only\" mode.");
|
||||
const QString errorMessage = QString::fromLocal8Bit(m_lastFileError.error.message().c_str());
|
||||
|
||||
return writeErrorStr + QLatin1Char(' ') + errorMessage + QLatin1String(". ") + uploadModeStr;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
@@ -1922,6 +1928,11 @@ void TorrentImpl::handleFileCompletedAlert(const lt::file_completed_alert *p)
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentImpl::handleFileErrorAlert(const lt::file_error_alert *p)
|
||||
{
|
||||
m_lastFileError = {p->error, p->op};
|
||||
}
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 20003)
|
||||
void TorrentImpl::handleFilePrioAlert(const lt::file_prio_alert *)
|
||||
{
|
||||
@@ -1981,6 +1992,9 @@ void TorrentImpl::handleAlert(const lt::alert *a)
|
||||
case lt::file_completed_alert::alert_type:
|
||||
handleFileCompletedAlert(static_cast<const lt::file_completed_alert*>(a));
|
||||
break;
|
||||
case lt::file_error_alert::alert_type:
|
||||
handleFileErrorAlert(static_cast<const lt::file_error_alert*>(a));
|
||||
break;
|
||||
case lt::torrent_finished_alert::alert_type:
|
||||
handleTorrentFinishedAlert(static_cast<const lt::torrent_finished_alert*>(a));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user