mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-21 03:12:21 +08: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
@ -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…
Reference in New Issue
Block a user