Rename isSeed to isFinished to correctly represent its meaning

PR #18580.
This commit is contained in:
Vladimir Golovnev
2023-02-17 07:08:00 +03:00
committed by GitHub
parent 4c0ebc0e0f
commit 1e913f46f0
11 changed files with 47 additions and 45 deletions

View File

@@ -1906,11 +1906,11 @@ void MainWindow::updatePowerManagementState()
const QVector<BitTorrent::Torrent *> allTorrents = BitTorrent::Session::instance()->torrents();
const bool hasUnfinishedTorrents = std::any_of(allTorrents.cbegin(), allTorrents.cend(), [](const BitTorrent::Torrent *torrent)
{
return (!torrent->isSeed() && !torrent->isPaused() && !torrent->isErrored() && torrent->hasMetadata());
return (!torrent->isFinished() && !torrent->isPaused() && !torrent->isErrored() && torrent->hasMetadata());
});
const bool hasRunningSeed = std::any_of(allTorrents.cbegin(), allTorrents.cend(), [](const BitTorrent::Torrent *torrent)
{
return (torrent->isSeed() && !torrent->isPaused());
return (torrent->isFinished() && !torrent->isPaused());
});
const bool inhibitSuspend = (Preferences::instance()->preventFromSuspendWhenDownloading() && hasUnfinishedTorrents)
|| (Preferences::instance()->preventFromSuspendWhenSeeding() && hasRunningSeed);

View File

@@ -378,12 +378,16 @@ void PropertiesWidget::loadDynamicData()
m_ui->labelDlLimitVal->setText(m_torrent->downloadLimit() <= 0 ? C_INFINITY : Utils::Misc::friendlyUnit(m_torrent->downloadLimit(), true));
QString elapsedString;
if (m_torrent->isSeed())
if (m_torrent->isFinished())
{
elapsedString = tr("%1 (seeded for %2)", "e.g. 4m39s (seeded for 3m10s)")
.arg(Utils::Misc::userFriendlyDuration(m_torrent->activeTime())
, Utils::Misc::userFriendlyDuration(m_torrent->finishedTime()));
.arg(Utils::Misc::userFriendlyDuration(m_torrent->activeTime())
, Utils::Misc::userFriendlyDuration(m_torrent->finishedTime()));
}
else
{
elapsedString = Utils::Misc::userFriendlyDuration(m_torrent->activeTime());
}
m_ui->labelElapsedVal->setText(elapsedString);
m_ui->labelConnectionsVal->setText(tr("%1 (%2 max)", "%1 and %2 are numbers, e.g. 3 (10 max)")
@@ -429,7 +433,7 @@ void PropertiesWidget::loadDynamicData()
m_ui->labelTotalPiecesVal->setText(tr("%1 x %2 (have %3)", "(torrent pieces) eg 152 x 4MB (have 25)").arg(m_torrent->piecesCount()).arg(Utils::Misc::friendlyUnit(m_torrent->pieceLength())).arg(m_torrent->piecesHave()));
if (!m_torrent->isSeed() && !m_torrent->isPaused() && !m_torrent->isQueued() && !m_torrent->isChecking())
if (!m_torrent->isFinished() && !m_torrent->isPaused() && !m_torrent->isQueued() && !m_torrent->isChecking())
{
// Pieces availability
showPiecesAvailability(true);

View File

@@ -271,7 +271,7 @@ void TransferListWidget::torrentDoubleClicked()
if (!torrent) return;
int action;
if (torrent->isSeed())
if (torrent->isFinished())
action = Preferences::instance()->getActionOnDblClOnTorrentFn();
else
action = Preferences::instance()->getActionOnDblClOnTorrentDl();
@@ -991,7 +991,7 @@ void TransferListWidget::displayListMenu()
bool superSeedingMode = false;
bool allSameSequentialDownloadMode = true, allSamePrioFirstlast = true;
bool sequentialDownloadMode = false, prioritizeFirstLast = false;
bool oneHasMetadata = false, oneNotSeed = false;
bool oneHasMetadata = false, oneNotFinished = false;
bool allSameCategory = true;
bool allSameAutoTMM = true;
bool firstAutoTMM = false;
@@ -1032,9 +1032,9 @@ void TransferListWidget::displayListMenu()
if (torrent->hasMetadata())
oneHasMetadata = true;
if (!torrent->isSeed())
if (!torrent->isFinished())
{
oneNotSeed = true;
oneNotFinished = true;
if (first)
{
sequentialDownloadMode = torrent->isSequentialDownload();
@@ -1050,7 +1050,7 @@ void TransferListWidget::displayListMenu()
}
else
{
if (!oneNotSeed && allSameSuperSeeding && torrent->hasMetadata())
if (!oneNotFinished && allSameSuperSeeding && torrent->hasMetadata())
{
if (first)
superSeedingMode = torrent->superSeeding();
@@ -1100,7 +1100,7 @@ void TransferListWidget::displayListMenu()
if (!isPaused && !rechecking && !queued)
oneCanForceReannounce = true;
if (oneHasMetadata && oneNotSeed && !allSameSequentialDownloadMode
if (oneHasMetadata && oneNotFinished && !allSameSequentialDownloadMode
&& !allSamePrioFirstlast && !allSameSuperSeeding && !allSameCategory
&& needsStart && needsForce && needsPause && needsPreview && !allSameAutoTMM
&& hasInfohashV1 && hasInfohashV2 && oneCanForceReannounce)
@@ -1193,7 +1193,7 @@ void TransferListWidget::displayListMenu()
listMenu->addSeparator();
listMenu->addAction(actionTorrentOptions);
if (!oneNotSeed && oneHasMetadata)
if (!oneNotFinished && oneHasMetadata)
{
actionSuperSeedingMode->setCheckState(allSameSuperSeeding
? (superSeedingMode ? Qt::Checked : Qt::Unchecked)
@@ -1207,7 +1207,7 @@ void TransferListWidget::displayListMenu()
listMenu->addAction(actionPreviewFile);
addedPreviewAction = true;
}
if (oneNotSeed)
if (oneNotFinished)
{
actionSequentialDownload->setCheckState(allSameSequentialDownloadMode
? (sequentialDownloadMode ? Qt::Checked : Qt::Unchecked)
@@ -1234,7 +1234,7 @@ void TransferListWidget::displayListMenu()
actionForceReannounce->setToolTip(tr("Can not force reannounce if torrent is Paused/Queued/Errored/Checking"));
listMenu->addSeparator();
listMenu->addAction(actionOpenDestinationFolder);
if (BitTorrent::Session::instance()->isQueueingSystemEnabled() && oneNotSeed)
if (BitTorrent::Session::instance()->isQueueingSystemEnabled() && oneNotFinished)
{
listMenu->addSeparator();
QMenu *queueMenu = listMenu->addMenu(