mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Use Start/Stop instead of Resume/Pause
PR #20532. --------- Co-authored-by: Vladimir Golovnev (Glassez) <glassez@yandex.ru>
This commit is contained in:
@@ -116,7 +116,7 @@ BitTorrent::AddTorrentParams BitTorrent::parseAddTorrentParams(const QJsonObject
|
||||
.downloadPath = Path(jsonObj.value(PARAM_DOWNLOADPATH).toString()),
|
||||
.addForced = (getEnum<TorrentOperatingMode>(jsonObj, PARAM_OPERATINGMODE) == TorrentOperatingMode::Forced),
|
||||
.addToQueueTop = getOptionalBool(jsonObj, PARAM_QUEUETOP),
|
||||
.addPaused = getOptionalBool(jsonObj, PARAM_STOPPED),
|
||||
.addStopped = getOptionalBool(jsonObj, PARAM_STOPPED),
|
||||
.stopCondition = getOptionalEnum<Torrent::StopCondition>(jsonObj, PARAM_STOPCONDITION),
|
||||
.filePaths = {},
|
||||
.filePriorities = {},
|
||||
@@ -163,8 +163,8 @@ QJsonObject BitTorrent::serializeAddTorrentParams(const AddTorrentParams ¶ms
|
||||
|
||||
if (params.addToQueueTop)
|
||||
jsonObj[PARAM_QUEUETOP] = *params.addToQueueTop;
|
||||
if (params.addPaused)
|
||||
jsonObj[PARAM_STOPPED] = *params.addPaused;
|
||||
if (params.addStopped)
|
||||
jsonObj[PARAM_STOPPED] = *params.addStopped;
|
||||
if (params.stopCondition)
|
||||
jsonObj[PARAM_STOPCONDITION] = Utils::String::fromEnum(*params.stopCondition);
|
||||
if (params.contentLayout)
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace BitTorrent
|
||||
bool firstLastPiecePriority = false;
|
||||
bool addForced = false;
|
||||
std::optional<bool> addToQueueTop;
|
||||
std::optional<bool> addPaused;
|
||||
std::optional<bool> addStopped;
|
||||
std::optional<Torrent::StopCondition> stopCondition;
|
||||
PathList filePaths; // used if TorrentInfo is set
|
||||
QVector<DownloadPriority> filePriorities; // used if TorrentInfo is set
|
||||
|
||||
@@ -213,8 +213,8 @@ namespace BitTorrent
|
||||
virtual void setPeXEnabled(bool enabled) = 0;
|
||||
virtual bool isAddTorrentToQueueTop() const = 0;
|
||||
virtual void setAddTorrentToQueueTop(bool value) = 0;
|
||||
virtual bool isAddTorrentPaused() const = 0;
|
||||
virtual void setAddTorrentPaused(bool value) = 0;
|
||||
virtual bool isAddTorrentStopped() const = 0;
|
||||
virtual void setAddTorrentStopped(bool value) = 0;
|
||||
virtual Torrent::StopCondition torrentStopCondition() const = 0;
|
||||
virtual void setTorrentStopCondition(Torrent::StopCondition stopCondition) = 0;
|
||||
virtual TorrentContentLayout torrentContentLayout() const = 0;
|
||||
@@ -476,8 +476,8 @@ namespace BitTorrent
|
||||
void torrentFinished(Torrent *torrent);
|
||||
void torrentFinishedChecking(Torrent *torrent);
|
||||
void torrentMetadataReceived(Torrent *torrent);
|
||||
void torrentPaused(Torrent *torrent);
|
||||
void torrentResumed(Torrent *torrent);
|
||||
void torrentStopped(Torrent *torrent);
|
||||
void torrentStarted(Torrent *torrent);
|
||||
void torrentSavePathChanged(Torrent *torrent);
|
||||
void torrentSavingModeChanged(Torrent *torrent);
|
||||
void torrentsLoaded(const QVector<Torrent *> &torrents);
|
||||
|
||||
@@ -461,7 +461,7 @@ SessionImpl::SessionImpl(QObject *parent)
|
||||
, m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY(u"GlobalMaxSeedingMinutes"_s), -1, lowerLimited(-1))
|
||||
, m_globalMaxInactiveSeedingMinutes(BITTORRENT_SESSION_KEY(u"GlobalMaxInactiveSeedingMinutes"_s), -1, lowerLimited(-1))
|
||||
, m_isAddTorrentToQueueTop(BITTORRENT_SESSION_KEY(u"AddTorrentToTopOfQueue"_s), false)
|
||||
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY(u"AddTorrentPaused"_s), false)
|
||||
, m_isAddTorrentStopped(BITTORRENT_SESSION_KEY(u"AddTorrentStopped"_s), false)
|
||||
, m_torrentStopCondition(BITTORRENT_SESSION_KEY(u"TorrentStopCondition"_s), Torrent::StopCondition::None)
|
||||
, m_torrentContentLayout(BITTORRENT_SESSION_KEY(u"TorrentContentLayout"_s), TorrentContentLayout::Original)
|
||||
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY(u"AddExtensionToIncompleteFiles"_s), false)
|
||||
@@ -1114,14 +1114,14 @@ void SessionImpl::setAddTorrentToQueueTop(bool value)
|
||||
m_isAddTorrentToQueueTop = value;
|
||||
}
|
||||
|
||||
bool SessionImpl::isAddTorrentPaused() const
|
||||
bool SessionImpl::isAddTorrentStopped() const
|
||||
{
|
||||
return m_isAddTorrentPaused;
|
||||
return m_isAddTorrentStopped;
|
||||
}
|
||||
|
||||
void SessionImpl::setAddTorrentPaused(const bool value)
|
||||
void SessionImpl::setAddTorrentStopped(const bool value)
|
||||
{
|
||||
m_isAddTorrentPaused = value;
|
||||
m_isAddTorrentStopped = value;
|
||||
}
|
||||
|
||||
Torrent::StopCondition SessionImpl::torrentStopCondition() const
|
||||
@@ -2274,12 +2274,12 @@ void SessionImpl::processShareLimits()
|
||||
LogMsg(u"%1 %2 %3"_s.arg(description, tr("Removing torrent and deleting its content."), torrentName));
|
||||
deleteTorrent(torrentID, DeleteTorrentAndFiles);
|
||||
}
|
||||
else if ((shareLimitAction == ShareLimitAction::Stop) && !torrent->isPaused())
|
||||
else if ((shareLimitAction == ShareLimitAction::Stop) && !torrent->isStopped())
|
||||
{
|
||||
torrent->pause();
|
||||
LogMsg(u"%1 %2 %3"_s.arg(description, tr("Torrent paused."), torrentName));
|
||||
torrent->stop();
|
||||
LogMsg(u"%1 %2 %3"_s.arg(description, tr("Torrent stopped."), torrentName));
|
||||
}
|
||||
else if ((shareLimitAction == ShareLimitAction::EnableSuperSeeding) && !torrent->isPaused() && !torrent->superSeeding())
|
||||
else if ((shareLimitAction == ShareLimitAction::EnableSuperSeeding) && !torrent->isStopped() && !torrent->superSeeding())
|
||||
{
|
||||
torrent->setSuperSeeding(true);
|
||||
LogMsg(u"%1 %2 %3"_s.arg(description, tr("Super seeding enabled."), torrentName));
|
||||
@@ -2596,7 +2596,7 @@ LoadTorrentParams SessionImpl::initLoadTorrentParams(const AddTorrentParams &add
|
||||
loadTorrentParams.hasFinishedStatus = addTorrentParams.skipChecking; // do not react on 'torrent_finished_alert' when skipping
|
||||
loadTorrentParams.contentLayout = addTorrentParams.contentLayout.value_or(torrentContentLayout());
|
||||
loadTorrentParams.operatingMode = (addTorrentParams.addForced ? TorrentOperatingMode::Forced : TorrentOperatingMode::AutoManaged);
|
||||
loadTorrentParams.stopped = addTorrentParams.addPaused.value_or(isAddTorrentPaused());
|
||||
loadTorrentParams.stopped = addTorrentParams.addStopped.value_or(isAddTorrentStopped());
|
||||
loadTorrentParams.stopCondition = addTorrentParams.stopCondition.value_or(torrentStopCondition());
|
||||
loadTorrentParams.addToQueueTop = addTorrentParams.addToQueueTop.value_or(isAddTorrentToQueueTop());
|
||||
loadTorrentParams.ratioLimit = addTorrentParams.ratioLimit;
|
||||
@@ -4896,7 +4896,7 @@ void SessionImpl::handleTorrentMetadataReceived(TorrentImpl *const torrent)
|
||||
emit torrentMetadataReceived(torrent);
|
||||
}
|
||||
|
||||
void SessionImpl::handleTorrentPaused(TorrentImpl *const torrent)
|
||||
void SessionImpl::handleTorrentStopped(TorrentImpl *const torrent)
|
||||
{
|
||||
torrent->resetTrackerEntries();
|
||||
|
||||
@@ -4907,14 +4907,14 @@ void SessionImpl::handleTorrentPaused(TorrentImpl *const torrent)
|
||||
updatedTrackerEntries.emplace(trackerEntry.url, trackerEntry);
|
||||
emit trackerEntriesUpdated(torrent, updatedTrackerEntries);
|
||||
|
||||
LogMsg(tr("Torrent paused. Torrent: \"%1\"").arg(torrent->name()));
|
||||
emit torrentPaused(torrent);
|
||||
LogMsg(tr("Torrent stopped. Torrent: \"%1\"").arg(torrent->name()));
|
||||
emit torrentStopped(torrent);
|
||||
}
|
||||
|
||||
void SessionImpl::handleTorrentResumed(TorrentImpl *const torrent)
|
||||
void SessionImpl::handleTorrentStarted(TorrentImpl *const torrent)
|
||||
{
|
||||
LogMsg(tr("Torrent resumed. Torrent: \"%1\"").arg(torrent->name()));
|
||||
emit torrentResumed(torrent);
|
||||
emit torrentStarted(torrent);
|
||||
}
|
||||
|
||||
void SessionImpl::handleTorrentChecked(TorrentImpl *const torrent)
|
||||
@@ -4932,7 +4932,7 @@ void SessionImpl::handleTorrentFinished(TorrentImpl *const torrent)
|
||||
|
||||
const bool hasUnfinishedTorrents = std::any_of(m_torrents.cbegin(), m_torrents.cend(), [](const TorrentImpl *torrent)
|
||||
{
|
||||
return !(torrent->isFinished() || torrent->isPaused() || torrent->isErrored());
|
||||
return !(torrent->isFinished() || torrent->isStopped() || torrent->isErrored());
|
||||
});
|
||||
if (!hasUnfinishedTorrents)
|
||||
emit allTorrentsFinished();
|
||||
@@ -6151,7 +6151,7 @@ void SessionImpl::updateTrackerEntries(lt::torrent_handle torrentHandle, QHash<s
|
||||
, updatedTrackers = std::move(updatedTrackers)]
|
||||
{
|
||||
TorrentImpl *torrent = m_torrents.value(torrentHandle.info_hash());
|
||||
if (!torrent || torrent->isPaused())
|
||||
if (!torrent || torrent->isStopped())
|
||||
return;
|
||||
|
||||
QHash<QString, TrackerEntry> updatedTrackerEntries;
|
||||
|
||||
@@ -189,8 +189,8 @@ namespace BitTorrent
|
||||
void setPeXEnabled(bool enabled) override;
|
||||
bool isAddTorrentToQueueTop() const override;
|
||||
void setAddTorrentToQueueTop(bool value) override;
|
||||
bool isAddTorrentPaused() const override;
|
||||
void setAddTorrentPaused(bool value) override;
|
||||
bool isAddTorrentStopped() const override;
|
||||
void setAddTorrentStopped(bool value) override;
|
||||
Torrent::StopCondition torrentStopCondition() const override;
|
||||
void setTorrentStopCondition(Torrent::StopCondition stopCondition) override;
|
||||
TorrentContentLayout torrentContentLayout() const override;
|
||||
@@ -439,8 +439,8 @@ namespace BitTorrent
|
||||
void handleTorrentTagRemoved(TorrentImpl *torrent, const Tag &tag);
|
||||
void handleTorrentSavingModeChanged(TorrentImpl *torrent);
|
||||
void handleTorrentMetadataReceived(TorrentImpl *torrent);
|
||||
void handleTorrentPaused(TorrentImpl *torrent);
|
||||
void handleTorrentResumed(TorrentImpl *torrent);
|
||||
void handleTorrentStopped(TorrentImpl *torrent);
|
||||
void handleTorrentStarted(TorrentImpl *torrent);
|
||||
void handleTorrentChecked(TorrentImpl *torrent);
|
||||
void handleTorrentFinished(TorrentImpl *torrent);
|
||||
void handleTorrentTrackersAdded(TorrentImpl *torrent, const QVector<TrackerEntry> &newTrackers);
|
||||
@@ -663,7 +663,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_globalMaxSeedingMinutes;
|
||||
CachedSettingValue<int> m_globalMaxInactiveSeedingMinutes;
|
||||
CachedSettingValue<bool> m_isAddTorrentToQueueTop;
|
||||
CachedSettingValue<bool> m_isAddTorrentPaused;
|
||||
CachedSettingValue<bool> m_isAddTorrentStopped;
|
||||
CachedSettingValue<Torrent::StopCondition> m_torrentStopCondition;
|
||||
CachedSettingValue<TorrentContentLayout> m_torrentContentLayout;
|
||||
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace BitTorrent
|
||||
return infoHash().toTorrentID();
|
||||
}
|
||||
|
||||
bool Torrent::isResumed() const
|
||||
bool Torrent::isRunning() const
|
||||
{
|
||||
return !isPaused();
|
||||
return !isStopped();
|
||||
}
|
||||
|
||||
qlonglong Torrent::remainingSize() const
|
||||
|
||||
@@ -94,8 +94,8 @@ namespace BitTorrent
|
||||
CheckingUploading,
|
||||
CheckingDownloading,
|
||||
|
||||
PausedDownloading,
|
||||
PausedUploading,
|
||||
StoppedDownloading,
|
||||
StoppedUploading,
|
||||
|
||||
Moving,
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace BitTorrent
|
||||
|
||||
virtual TorrentInfo info() const = 0;
|
||||
virtual bool isFinished() const = 0;
|
||||
virtual bool isPaused() const = 0;
|
||||
virtual bool isStopped() const = 0;
|
||||
virtual bool isQueued() const = 0;
|
||||
virtual bool isForced() const = 0;
|
||||
virtual bool isChecking() const = 0;
|
||||
@@ -290,8 +290,8 @@ namespace BitTorrent
|
||||
virtual void setName(const QString &name) = 0;
|
||||
virtual void setSequentialDownload(bool enable) = 0;
|
||||
virtual void setFirstLastPiecePriority(bool enabled) = 0;
|
||||
virtual void pause() = 0;
|
||||
virtual void resume(TorrentOperatingMode mode = TorrentOperatingMode::AutoManaged) = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void start(TorrentOperatingMode mode = TorrentOperatingMode::AutoManaged) = 0;
|
||||
virtual void forceReannounce(int index = -1) = 0;
|
||||
virtual void forceDHTAnnounce() = 0;
|
||||
virtual void forceRecheck() = 0;
|
||||
@@ -325,7 +325,7 @@ namespace BitTorrent
|
||||
virtual void fetchDownloadingPieces(std::function<void (QBitArray)> resultHandler) const = 0;
|
||||
|
||||
TorrentID id() const;
|
||||
bool isResumed() const;
|
||||
bool isRunning() const;
|
||||
qlonglong remainingSize() const;
|
||||
|
||||
void toggleSequentialDownload();
|
||||
|
||||
@@ -981,15 +981,15 @@ TorrentInfo TorrentImpl::info() const
|
||||
return m_torrentInfo;
|
||||
}
|
||||
|
||||
bool TorrentImpl::isPaused() const
|
||||
bool TorrentImpl::isStopped() const
|
||||
{
|
||||
return m_isStopped;
|
||||
}
|
||||
|
||||
bool TorrentImpl::isQueued() const
|
||||
{
|
||||
// Torrent is Queued if it isn't in Paused state but paused internally
|
||||
return (!isPaused()
|
||||
// Torrent is Queued if it isn't in Stopped state but paused internally
|
||||
return (!isStopped()
|
||||
&& (m_nativeStatus.flags & lt::torrent_flags::auto_managed)
|
||||
&& (m_nativeStatus.flags & lt::torrent_flags::paused));
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ bool TorrentImpl::isDownloading() const
|
||||
case TorrentState::ForcedDownloadingMetadata:
|
||||
case TorrentState::StalledDownloading:
|
||||
case TorrentState::CheckingDownloading:
|
||||
case TorrentState::PausedDownloading:
|
||||
case TorrentState::StoppedDownloading:
|
||||
case TorrentState::QueuedDownloading:
|
||||
case TorrentState::ForcedDownloading:
|
||||
return true;
|
||||
@@ -1049,7 +1049,7 @@ bool TorrentImpl::isCompleted() const
|
||||
case TorrentState::Uploading:
|
||||
case TorrentState::StalledUploading:
|
||||
case TorrentState::CheckingUploading:
|
||||
case TorrentState::PausedUploading:
|
||||
case TorrentState::StoppedUploading:
|
||||
case TorrentState::QueuedUploading:
|
||||
case TorrentState::ForcedUploading:
|
||||
return true;
|
||||
@@ -1102,7 +1102,7 @@ bool TorrentImpl::isFinished() const
|
||||
|
||||
bool TorrentImpl::isForced() const
|
||||
{
|
||||
return (!isPaused() && (m_operatingMode == TorrentOperatingMode::Forced));
|
||||
return (!isStopped() && (m_operatingMode == TorrentOperatingMode::Forced));
|
||||
}
|
||||
|
||||
bool TorrentImpl::isSequentialDownload() const
|
||||
@@ -1140,22 +1140,22 @@ void TorrentImpl::updateState()
|
||||
}
|
||||
else if (!hasMetadata())
|
||||
{
|
||||
if (isPaused())
|
||||
m_state = TorrentState::PausedDownloading;
|
||||
if (isStopped())
|
||||
m_state = TorrentState::StoppedDownloading;
|
||||
else if (m_session->isQueueingSystemEnabled() && isQueued())
|
||||
m_state = TorrentState::QueuedDownloading;
|
||||
else
|
||||
m_state = isForced() ? TorrentState::ForcedDownloadingMetadata : TorrentState::DownloadingMetadata;
|
||||
}
|
||||
else if ((m_nativeStatus.state == lt::torrent_status::checking_files) && !isPaused())
|
||||
else if ((m_nativeStatus.state == lt::torrent_status::checking_files) && !isStopped())
|
||||
{
|
||||
// If the torrent is not just in the "checking" state, but is being actually checked
|
||||
m_state = m_hasFinishedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading;
|
||||
}
|
||||
else if (isFinished())
|
||||
{
|
||||
if (isPaused())
|
||||
m_state = TorrentState::PausedUploading;
|
||||
if (isStopped())
|
||||
m_state = TorrentState::StoppedUploading;
|
||||
else if (m_session->isQueueingSystemEnabled() && isQueued())
|
||||
m_state = TorrentState::QueuedUploading;
|
||||
else if (isForced())
|
||||
@@ -1167,8 +1167,8 @@ void TorrentImpl::updateState()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isPaused())
|
||||
m_state = TorrentState::PausedDownloading;
|
||||
if (isStopped())
|
||||
m_state = TorrentState::StoppedDownloading;
|
||||
else if (m_session->isQueueingSystemEnabled() && isQueued())
|
||||
m_state = TorrentState::QueuedDownloading;
|
||||
else if (isForced())
|
||||
@@ -1236,7 +1236,7 @@ qlonglong TorrentImpl::finishedTime() const
|
||||
|
||||
qlonglong TorrentImpl::eta() const
|
||||
{
|
||||
if (isPaused()) return MAX_ETA;
|
||||
if (isStopped()) return MAX_ETA;
|
||||
|
||||
const SpeedSampleAvg speedAverage = m_payloadRateMonitor.average();
|
||||
|
||||
@@ -1499,14 +1499,14 @@ qreal TorrentImpl::realRatio() const
|
||||
|
||||
int TorrentImpl::uploadPayloadRate() const
|
||||
{
|
||||
// workaround: suppress the speed for paused state
|
||||
return isPaused() ? 0 : m_nativeStatus.upload_payload_rate;
|
||||
// workaround: suppress the speed for Stopped state
|
||||
return isStopped() ? 0 : m_nativeStatus.upload_payload_rate;
|
||||
}
|
||||
|
||||
int TorrentImpl::downloadPayloadRate() const
|
||||
{
|
||||
// workaround: suppress the speed for paused state
|
||||
return isPaused() ? 0 : m_nativeStatus.download_payload_rate;
|
||||
// workaround: suppress the speed for Stopped state
|
||||
return isStopped() ? 0 : m_nativeStatus.download_payload_rate;
|
||||
}
|
||||
|
||||
qlonglong TorrentImpl::totalPayloadUpload() const
|
||||
@@ -1597,10 +1597,10 @@ void TorrentImpl::forceRecheck()
|
||||
m_nativeStatus.pieces.clear_all();
|
||||
m_nativeStatus.num_pieces = 0;
|
||||
|
||||
if (isPaused())
|
||||
if (isStopped())
|
||||
{
|
||||
// When "force recheck" is applied on paused torrent, we temporarily resume it
|
||||
resume();
|
||||
// When "force recheck" is applied on Stopped torrent, we start them to perform checking
|
||||
start();
|
||||
m_stopCondition = StopCondition::FilesChecked;
|
||||
}
|
||||
}
|
||||
@@ -1768,7 +1768,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi
|
||||
p.flags |= lt::torrent_flags::paused;
|
||||
p.flags &= ~lt::torrent_flags::auto_managed;
|
||||
|
||||
m_session->handleTorrentPaused(this);
|
||||
m_session->handleTorrentStopped(this);
|
||||
}
|
||||
|
||||
reload();
|
||||
@@ -1836,14 +1836,14 @@ void TorrentImpl::reload()
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentImpl::pause()
|
||||
void TorrentImpl::stop()
|
||||
{
|
||||
if (!m_isStopped)
|
||||
{
|
||||
m_stopCondition = StopCondition::None;
|
||||
m_isStopped = true;
|
||||
deferredRequestResumeData();
|
||||
m_session->handleTorrentPaused(this);
|
||||
m_session->handleTorrentStopped(this);
|
||||
}
|
||||
|
||||
if (m_maintenanceJob == MaintenanceJob::None)
|
||||
@@ -1855,7 +1855,7 @@ void TorrentImpl::pause()
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentImpl::resume(const TorrentOperatingMode mode)
|
||||
void TorrentImpl::start(const TorrentOperatingMode mode)
|
||||
{
|
||||
if (hasError())
|
||||
{
|
||||
@@ -1878,7 +1878,7 @@ void TorrentImpl::resume(const TorrentOperatingMode mode)
|
||||
{
|
||||
m_isStopped = false;
|
||||
deferredRequestResumeData();
|
||||
m_session->handleTorrentResumed(this);
|
||||
m_session->handleTorrentStarted(this);
|
||||
}
|
||||
|
||||
if (m_maintenanceJob == MaintenanceJob::None)
|
||||
@@ -1967,7 +1967,7 @@ void TorrentImpl::handleTorrentCheckedAlert([[maybe_unused]] const lt::torrent_c
|
||||
}
|
||||
|
||||
if (stopCondition() == StopCondition::FilesChecked)
|
||||
pause();
|
||||
stop();
|
||||
|
||||
m_statusUpdatedTriggers.enqueue([this]()
|
||||
{
|
||||
@@ -1983,7 +1983,7 @@ void TorrentImpl::handleTorrentCheckedAlert([[maybe_unused]] const lt::torrent_c
|
||||
adjustStorageLocation();
|
||||
manageActualFilePaths();
|
||||
|
||||
if (!isPaused())
|
||||
if (!isStopped())
|
||||
{
|
||||
// torrent is internally paused using NativeTorrentExtension after files checked
|
||||
// so we need to resume it if there is no corresponding "stop condition" set
|
||||
@@ -2468,7 +2468,7 @@ void TorrentImpl::setStopCondition(const StopCondition stopCondition)
|
||||
if (stopCondition == m_stopCondition)
|
||||
return;
|
||||
|
||||
if (isPaused())
|
||||
if (isStopped())
|
||||
return;
|
||||
|
||||
if ((stopCondition == StopCondition::MetadataReceived) && hasMetadata())
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace BitTorrent
|
||||
|
||||
TorrentInfo info() const override;
|
||||
bool isFinished() const override;
|
||||
bool isPaused() const override;
|
||||
bool isStopped() const override;
|
||||
bool isQueued() const override;
|
||||
bool isForced() const override;
|
||||
bool isChecking() const override;
|
||||
@@ -222,8 +222,8 @@ namespace BitTorrent
|
||||
void setName(const QString &name) override;
|
||||
void setSequentialDownload(bool enable) override;
|
||||
void setFirstLastPiecePriority(bool enabled) override;
|
||||
void pause() override;
|
||||
void resume(TorrentOperatingMode mode = TorrentOperatingMode::AutoManaged) override;
|
||||
void stop() override;
|
||||
void start(TorrentOperatingMode mode = TorrentOperatingMode::AutoManaged) override;
|
||||
void forceReannounce(int index = -1) override;
|
||||
void forceDHTAnnounce() override;
|
||||
void forceRecheck() override;
|
||||
|
||||
@@ -468,7 +468,7 @@ QJsonObject AutoDownloadRule::toJsonObject() const
|
||||
|
||||
// TODO: The following code is deprecated. Replace with the commented one after several releases in 4.6.x.
|
||||
// === BEGIN DEPRECATED CODE === //
|
||||
, {S_ADD_PAUSED, toJsonValue(addTorrentParams.addPaused)}
|
||||
, {S_ADD_PAUSED, toJsonValue(addTorrentParams.addStopped)}
|
||||
, {S_CONTENT_LAYOUT, contentLayoutToJsonValue(addTorrentParams.contentLayout)}
|
||||
, {S_SAVE_PATH, addTorrentParams.savePath.toString()}
|
||||
, {S_ASSIGNED_CATEGORY, addTorrentParams.category}
|
||||
@@ -525,7 +525,7 @@ AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, co
|
||||
{
|
||||
addTorrentParams.savePath = Path(jsonObj.value(S_SAVE_PATH).toString());
|
||||
addTorrentParams.category = jsonObj.value(S_ASSIGNED_CATEGORY).toString();
|
||||
addTorrentParams.addPaused = toOptionalBool(jsonObj.value(S_ADD_PAUSED));
|
||||
addTorrentParams.addStopped = toOptionalBool(jsonObj.value(S_ADD_PAUSED));
|
||||
if (!addTorrentParams.savePath.isEmpty())
|
||||
addTorrentParams.useAutoTMM = false;
|
||||
|
||||
@@ -568,7 +568,7 @@ QVariantHash AutoDownloadRule::toLegacyDict() const
|
||||
{u"enabled"_s, isEnabled()},
|
||||
{u"category_assigned"_s, addTorrentParams.category},
|
||||
{u"use_regex"_s, useRegex()},
|
||||
{u"add_paused"_s, toAddPausedLegacy(addTorrentParams.addPaused)},
|
||||
{u"add_paused"_s, toAddPausedLegacy(addTorrentParams.addStopped)},
|
||||
{u"episode_filter"_s, episodeFilter()},
|
||||
{u"last_match"_s, lastMatch()},
|
||||
{u"ignore_days"_s, ignoreDays()}};
|
||||
@@ -579,7 +579,7 @@ AutoDownloadRule AutoDownloadRule::fromLegacyDict(const QVariantHash &dict)
|
||||
BitTorrent::AddTorrentParams addTorrentParams;
|
||||
addTorrentParams.savePath = Path(dict.value(u"save_path"_s).toString());
|
||||
addTorrentParams.category = dict.value(u"category_assigned"_s).toString();
|
||||
addTorrentParams.addPaused = addPausedLegacyToOptionalBool(dict.value(u"add_paused"_s).toInt());
|
||||
addTorrentParams.addStopped = addPausedLegacyToOptionalBool(dict.value(u"add_paused"_s).toInt());
|
||||
if (!addTorrentParams.savePath.isEmpty())
|
||||
addTorrentParams.useAutoTMM = false;
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ const std::optional<Tag> TorrentFilter::AnyTag;
|
||||
const TorrentFilter TorrentFilter::DownloadingTorrent(TorrentFilter::Downloading);
|
||||
const TorrentFilter TorrentFilter::SeedingTorrent(TorrentFilter::Seeding);
|
||||
const TorrentFilter TorrentFilter::CompletedTorrent(TorrentFilter::Completed);
|
||||
const TorrentFilter TorrentFilter::PausedTorrent(TorrentFilter::Paused);
|
||||
const TorrentFilter TorrentFilter::ResumedTorrent(TorrentFilter::Resumed);
|
||||
const TorrentFilter TorrentFilter::StoppedTorrent(TorrentFilter::Stopped);
|
||||
const TorrentFilter TorrentFilter::RunningTorrent(TorrentFilter::Running);
|
||||
const TorrentFilter TorrentFilter::ActiveTorrent(TorrentFilter::Active);
|
||||
const TorrentFilter TorrentFilter::InactiveTorrent(TorrentFilter::Inactive);
|
||||
const TorrentFilter TorrentFilter::StalledTorrent(TorrentFilter::Stalled);
|
||||
@@ -90,10 +90,10 @@ bool TorrentFilter::setTypeByName(const QString &filter)
|
||||
type = Seeding;
|
||||
else if (filter == u"completed")
|
||||
type = Completed;
|
||||
else if (filter == u"paused")
|
||||
type = Paused;
|
||||
else if (filter == u"resumed")
|
||||
type = Resumed;
|
||||
else if (filter == u"stopped")
|
||||
type = Stopped;
|
||||
else if (filter == u"running")
|
||||
type = Running;
|
||||
else if (filter == u"active")
|
||||
type = Active;
|
||||
else if (filter == u"inactive")
|
||||
@@ -167,10 +167,10 @@ bool TorrentFilter::matchState(const BitTorrent::Torrent *const torrent) const
|
||||
return torrent->isUploading();
|
||||
case Completed:
|
||||
return torrent->isCompleted();
|
||||
case Paused:
|
||||
return torrent->isPaused();
|
||||
case Resumed:
|
||||
return torrent->isResumed();
|
||||
case Stopped:
|
||||
return torrent->isStopped();
|
||||
case Running:
|
||||
return torrent->isRunning();
|
||||
case Active:
|
||||
return torrent->isActive();
|
||||
case Inactive:
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
Downloading,
|
||||
Seeding,
|
||||
Completed,
|
||||
Resumed,
|
||||
Paused,
|
||||
Running,
|
||||
Stopped,
|
||||
Active,
|
||||
Inactive,
|
||||
Stalled,
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
static const TorrentFilter DownloadingTorrent;
|
||||
static const TorrentFilter SeedingTorrent;
|
||||
static const TorrentFilter CompletedTorrent;
|
||||
static const TorrentFilter PausedTorrent;
|
||||
static const TorrentFilter ResumedTorrent;
|
||||
static const TorrentFilter StoppedTorrent;
|
||||
static const TorrentFilter RunningTorrent;
|
||||
static const TorrentFilter ActiveTorrent;
|
||||
static const TorrentFilter InactiveTorrent;
|
||||
static const TorrentFilter StalledTorrent;
|
||||
|
||||
Reference in New Issue
Block a user