Add "Forced metadata downloading" state (#15185)

This commit is contained in:
AbeniMatteo 2021-07-17 20:33:14 +02:00 committed by GitHub
parent e5943b64c1
commit 01d851440b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 2 deletions

View File

@ -72,6 +72,7 @@ namespace BitTorrent
ForcedDownloading,
Downloading,
ForcedDownloadingMetadata,
DownloadingMetadata,
StalledDownloading,

View File

@ -833,6 +833,7 @@ bool TorrentImpl::isDownloading() const
{
return m_state == TorrentState::Downloading
|| m_state == TorrentState::DownloadingMetadata
|| m_state == TorrentState::ForcedDownloadingMetadata
|| m_state == TorrentState::StalledDownloading
|| m_state == TorrentState::CheckingDownloading
|| m_state == TorrentState::PausedDownloading
@ -865,6 +866,7 @@ bool TorrentImpl::isActive() const
return (uploadPayloadRate() > 0);
return m_state == TorrentState::DownloadingMetadata
|| m_state == TorrentState::ForcedDownloadingMetadata
|| m_state == TorrentState::Downloading
|| m_state == TorrentState::ForcedDownloading
|| m_state == TorrentState::Uploading
@ -934,7 +936,7 @@ void TorrentImpl::updateState()
else if (m_session->isQueueingSystemEnabled() && isQueued())
m_state = TorrentState::QueuedDownloading;
else
m_state = TorrentState::DownloadingMetadata;
m_state = isForced() ? TorrentState::ForcedDownloadingMetadata : TorrentState::DownloadingMetadata;
}
else if ((m_nativeStatus.state == lt::torrent_status::checking_files)
&& (!isPaused() || (m_nativeStatus.flags & lt::torrent_flags::auto_managed)

View File

@ -75,6 +75,7 @@ namespace
{BitTorrent::TorrentState::Downloading, QLatin1String("TransferList.Downloading")},
{BitTorrent::TorrentState::StalledDownloading, QLatin1String("TransferList.StalledDownloading")},
{BitTorrent::TorrentState::DownloadingMetadata, QLatin1String("TransferList.DownloadingMetadata")},
{BitTorrent::TorrentState::ForcedDownloadingMetadata, QLatin1String("TransferList.ForcedDownloadingMetadata")},
{BitTorrent::TorrentState::ForcedDownloading, QLatin1String("TransferList.ForcedDownloading")},
{BitTorrent::TorrentState::Uploading, QLatin1String("TransferList.Uploading")},
{BitTorrent::TorrentState::StalledUploading, QLatin1String("TransferList.StalledUploading")},
@ -111,6 +112,7 @@ TransferListModel::TransferListModel(QObject *parent)
{BitTorrent::TorrentState::Downloading, tr("Downloading")},
{BitTorrent::TorrentState::StalledDownloading, tr("Stalled", "Torrent is waiting for download to begin")},
{BitTorrent::TorrentState::DownloadingMetadata, tr("Downloading metadata", "Used when loading a magnet link")},
{BitTorrent::TorrentState::ForcedDownloadingMetadata, tr("[F] Downloading metadata", "Used when forced to load a magnet link. You probably shouldn't translate the F.")},
{BitTorrent::TorrentState::ForcedDownloading, tr("[F] Downloading", "Used when the torrent is forced started. You probably shouldn't translate the F.")},
{BitTorrent::TorrentState::Uploading, tr("Seeding", "Torrent is complete and in upload-only mode")},
{BitTorrent::TorrentState::StalledUploading, tr("Seeding", "Torrent is complete and in upload-only mode")},
@ -664,6 +666,7 @@ QIcon getIconByState(const BitTorrent::TorrentState state)
case BitTorrent::TorrentState::Downloading:
case BitTorrent::TorrentState::ForcedDownloading:
case BitTorrent::TorrentState::DownloadingMetadata:
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
return getDownloadingIcon();
case BitTorrent::TorrentState::StalledDownloading:
return getStalledDownloadingIcon();
@ -704,6 +707,7 @@ QColor getDefaultColorByState(const BitTorrent::TorrentState state)
case BitTorrent::TorrentState::Downloading:
case BitTorrent::TorrentState::ForcedDownloading:
case BitTorrent::TorrentState::DownloadingMetadata:
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
if (!dark)
return {34, 139, 34}; // Forest Green
else

View File

@ -63,6 +63,8 @@ namespace
return QLatin1String("downloading");
case BitTorrent::TorrentState::DownloadingMetadata:
return QLatin1String("metaDL");
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
return QLatin1String("forcedMetaDL");
case BitTorrent::TorrentState::PausedDownloading:
return QLatin1String("pausedDL");
case BitTorrent::TorrentState::QueuedDownloading:

View File

@ -930,6 +930,7 @@ window.qBittorrent.DynamicTable = (function() {
switch (state) {
case "forcedDL":
case "metaDL":
case "forcedMetaDL":
state = "downloading";
break;
case "forcedUP":
@ -994,6 +995,9 @@ window.qBittorrent.DynamicTable = (function() {
case "metaDL":
status = "QBT_TR(Downloading metadata)QBT_TR[CONTEXT=TransferListDelegate]";
break;
case "forcedMetaDL":
status = "QBT_TR([F] Downloading metadata)QBT_TR[CONTEXT=TransferListDelegate]";
break;
case "forcedDL":
status = "QBT_TR([F] Downloading)QBT_TR[CONTEXT=TransferListDelegate]";
break;
@ -1310,7 +1314,7 @@ window.qBittorrent.DynamicTable = (function() {
if (state == 'stalledDL')
r = (row['full_data'].upspeed > 0);
else
r = state == 'metaDL' || state == 'downloading' || state == 'forcedDL' || state == 'uploading' || state == 'forcedUP';
r = state == 'metaDL' || state == 'forcedMetaDL' || state == 'downloading' || state == 'forcedDL' || state == 'uploading' || state == 'forcedUP';
if (r == inactive)
return false;
break;