mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Merge pull request #14825 from glassez/upload-mode
Correctly handle "no enough disk space" error
This commit is contained in:
commit
137c6458f7
1 changed files with 14 additions and 2 deletions
|
@ -948,7 +948,7 @@ bool TorrentImpl::hasMissingFiles() const
|
||||||
|
|
||||||
bool TorrentImpl::hasError() const
|
bool TorrentImpl::hasError() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(m_nativeStatus.errc);
|
return (m_nativeStatus.errc || (m_nativeStatus.flags & lt::torrent_flags::upload_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TorrentImpl::hasFilteredPieces() const
|
bool TorrentImpl::hasFilteredPieces() const
|
||||||
|
@ -967,7 +967,13 @@ int TorrentImpl::queuePosition() const
|
||||||
|
|
||||||
QString TorrentImpl::error() const
|
QString TorrentImpl::error() const
|
||||||
{
|
{
|
||||||
|
if (m_nativeStatus.errc)
|
||||||
return QString::fromStdString(m_nativeStatus.errc.message());
|
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.");
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
qlonglong TorrentImpl::totalDownload() const
|
qlonglong TorrentImpl::totalDownload() const
|
||||||
|
@ -1527,7 +1533,10 @@ void TorrentImpl::pause()
|
||||||
void TorrentImpl::resume(const TorrentOperatingMode mode)
|
void TorrentImpl::resume(const TorrentOperatingMode mode)
|
||||||
{
|
{
|
||||||
if (hasError())
|
if (hasError())
|
||||||
|
{
|
||||||
m_nativeHandle.clear_error();
|
m_nativeHandle.clear_error();
|
||||||
|
m_nativeHandle.unset_flags(lt::torrent_flags::upload_mode);
|
||||||
|
}
|
||||||
|
|
||||||
m_operatingMode = mode;
|
m_operatingMode = mode;
|
||||||
|
|
||||||
|
@ -1770,6 +1779,9 @@ void TorrentImpl::prepareResumeData(const lt::add_torrent_params ¶ms)
|
||||||
|
|
||||||
m_ltAddTorrentParams.added_time = addedTime().toSecsSinceEpoch();
|
m_ltAddTorrentParams.added_time = addedTime().toSecsSinceEpoch();
|
||||||
|
|
||||||
|
// We shouldn't save upload_mode flag to allow torrent operate normally on next run
|
||||||
|
m_ltAddTorrentParams.flags &= ~lt::torrent_flags::upload_mode;
|
||||||
|
|
||||||
LoadTorrentParams resumeData;
|
LoadTorrentParams resumeData;
|
||||||
resumeData.name = m_name;
|
resumeData.name = m_name;
|
||||||
resumeData.category = m_category;
|
resumeData.category = m_category;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue