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, ForcedDownloading,
Downloading, Downloading,
ForcedDownloadingMetadata,
DownloadingMetadata, DownloadingMetadata,
StalledDownloading, StalledDownloading,

View File

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

View File

@ -75,6 +75,7 @@ namespace
{BitTorrent::TorrentState::Downloading, QLatin1String("TransferList.Downloading")}, {BitTorrent::TorrentState::Downloading, QLatin1String("TransferList.Downloading")},
{BitTorrent::TorrentState::StalledDownloading, QLatin1String("TransferList.StalledDownloading")}, {BitTorrent::TorrentState::StalledDownloading, QLatin1String("TransferList.StalledDownloading")},
{BitTorrent::TorrentState::DownloadingMetadata, QLatin1String("TransferList.DownloadingMetadata")}, {BitTorrent::TorrentState::DownloadingMetadata, QLatin1String("TransferList.DownloadingMetadata")},
{BitTorrent::TorrentState::ForcedDownloadingMetadata, QLatin1String("TransferList.ForcedDownloadingMetadata")},
{BitTorrent::TorrentState::ForcedDownloading, QLatin1String("TransferList.ForcedDownloading")}, {BitTorrent::TorrentState::ForcedDownloading, QLatin1String("TransferList.ForcedDownloading")},
{BitTorrent::TorrentState::Uploading, QLatin1String("TransferList.Uploading")}, {BitTorrent::TorrentState::Uploading, QLatin1String("TransferList.Uploading")},
{BitTorrent::TorrentState::StalledUploading, QLatin1String("TransferList.StalledUploading")}, {BitTorrent::TorrentState::StalledUploading, QLatin1String("TransferList.StalledUploading")},
@ -111,6 +112,7 @@ TransferListModel::TransferListModel(QObject *parent)
{BitTorrent::TorrentState::Downloading, tr("Downloading")}, {BitTorrent::TorrentState::Downloading, tr("Downloading")},
{BitTorrent::TorrentState::StalledDownloading, tr("Stalled", "Torrent is waiting for download to begin")}, {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::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::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::Uploading, tr("Seeding", "Torrent is complete and in upload-only mode")},
{BitTorrent::TorrentState::StalledUploading, 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::Downloading:
case BitTorrent::TorrentState::ForcedDownloading: case BitTorrent::TorrentState::ForcedDownloading:
case BitTorrent::TorrentState::DownloadingMetadata: case BitTorrent::TorrentState::DownloadingMetadata:
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
return getDownloadingIcon(); return getDownloadingIcon();
case BitTorrent::TorrentState::StalledDownloading: case BitTorrent::TorrentState::StalledDownloading:
return getStalledDownloadingIcon(); return getStalledDownloadingIcon();
@ -704,6 +707,7 @@ QColor getDefaultColorByState(const BitTorrent::TorrentState state)
case BitTorrent::TorrentState::Downloading: case BitTorrent::TorrentState::Downloading:
case BitTorrent::TorrentState::ForcedDownloading: case BitTorrent::TorrentState::ForcedDownloading:
case BitTorrent::TorrentState::DownloadingMetadata: case BitTorrent::TorrentState::DownloadingMetadata:
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
if (!dark) if (!dark)
return {34, 139, 34}; // Forest Green return {34, 139, 34}; // Forest Green
else else

View File

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

View File

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