mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Fix calculation of torrent current state
Some actions can be performed despite of other states (e.g. "Errored" torrent can check its files currently) so the states that relate to such actions should override other (so-called "static") states.
This commit is contained in:
parent
18b2511238
commit
b6bf09fc0f
1 changed files with 10 additions and 10 deletions
|
@ -851,15 +851,21 @@ TorrentState TorrentHandleImpl::state() const
|
|||
|
||||
void TorrentHandleImpl::updateState()
|
||||
{
|
||||
if (hasError()) {
|
||||
m_state = TorrentState::Error;
|
||||
}
|
||||
else if (m_nativeStatus.state == lt::torrent_status::checking_resume_data) {
|
||||
if (m_nativeStatus.state == lt::torrent_status::checking_resume_data) {
|
||||
m_state = TorrentState::CheckingResumeData;
|
||||
}
|
||||
else if (m_nativeStatus.state == lt::torrent_status::checking_files) {
|
||||
m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading;
|
||||
}
|
||||
else if (m_nativeStatus.state == lt::torrent_status::allocating) {
|
||||
m_state = TorrentState::Allocating;
|
||||
}
|
||||
else if (isMoveInProgress()) {
|
||||
m_state = TorrentState::Moving;
|
||||
}
|
||||
else if (hasError()) {
|
||||
m_state = TorrentState::Error;
|
||||
}
|
||||
else if (hasMissingFiles()) {
|
||||
m_state = TorrentState::MissingFiles;
|
||||
}
|
||||
|
@ -878,12 +884,6 @@ void TorrentHandleImpl::updateState()
|
|||
else
|
||||
m_state = m_nativeStatus.upload_payload_rate > 0 ? TorrentState::Uploading : TorrentState::StalledUploading;
|
||||
break;
|
||||
case lt::torrent_status::allocating:
|
||||
m_state = TorrentState::Allocating;
|
||||
break;
|
||||
case lt::torrent_status::checking_files:
|
||||
m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading;
|
||||
break;
|
||||
case lt::torrent_status::downloading_metadata:
|
||||
m_state = TorrentState::DownloadingMetadata;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue