mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 20:58:07 -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:
@@ -139,7 +139,7 @@ void AppController::preferencesAction()
|
||||
// When adding a torrent
|
||||
data[u"torrent_content_layout"_s] = Utils::String::fromEnum(session->torrentContentLayout());
|
||||
data[u"add_to_top_of_queue"_s] = session->isAddTorrentToQueueTop();
|
||||
data[u"start_paused_enabled"_s] = session->isAddTorrentPaused();
|
||||
data[u"add_stopped_enabled"_s] = session->isAddTorrentStopped();
|
||||
data[u"torrent_stop_condition"_s] = Utils::String::fromEnum(session->torrentStopCondition());
|
||||
data[u"merge_trackers"_s] = session->isMergeTrackersEnabled();
|
||||
data[u"auto_delete_mode"_s] = static_cast<int>(TorrentFileGuard::autoDeleteMode());
|
||||
@@ -524,8 +524,8 @@ void AppController::setPreferencesAction()
|
||||
session->setTorrentContentLayout(Utils::String::toEnum(it.value().toString(), BitTorrent::TorrentContentLayout::Original));
|
||||
if (hasKey(u"add_to_top_of_queue"_s))
|
||||
session->setAddTorrentToQueueTop(it.value().toBool());
|
||||
if (hasKey(u"start_paused_enabled"_s))
|
||||
session->setAddTorrentPaused(it.value().toBool());
|
||||
if (hasKey(u"add_stopped_enabled"_s))
|
||||
session->setAddTorrentStopped(it.value().toBool());
|
||||
if (hasKey(u"torrent_stop_condition"_s))
|
||||
session->setTorrentStopCondition(Utils::String::toEnum(it.value().toString(), BitTorrent::Torrent::StopCondition::None));
|
||||
if (hasKey(u"merge_trackers"_s))
|
||||
|
||||
@@ -51,10 +51,10 @@ namespace
|
||||
return u"missingFiles"_s;
|
||||
case BitTorrent::TorrentState::Uploading:
|
||||
return u"uploading"_s;
|
||||
case BitTorrent::TorrentState::PausedUploading:
|
||||
return u"pausedUP"_s;
|
||||
case BitTorrent::TorrentState::StoppedUploading:
|
||||
return u"stoppedUP"_s;
|
||||
case BitTorrent::TorrentState::QueuedUploading:
|
||||
return u"queuedUP"_s;
|
||||
return u"stoppedUP"_s;
|
||||
case BitTorrent::TorrentState::StalledUploading:
|
||||
return u"stalledUP"_s;
|
||||
case BitTorrent::TorrentState::CheckingUploading:
|
||||
@@ -67,8 +67,8 @@ namespace
|
||||
return u"metaDL"_s;
|
||||
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
|
||||
return u"forcedMetaDL"_s;
|
||||
case BitTorrent::TorrentState::PausedDownloading:
|
||||
return u"pausedDL"_s;
|
||||
case BitTorrent::TorrentState::StoppedDownloading:
|
||||
return u"stoppedDL"_s;
|
||||
case BitTorrent::TorrentState::QueuedDownloading:
|
||||
return u"queuedDL"_s;
|
||||
case BitTorrent::TorrentState::StalledDownloading:
|
||||
|
||||
@@ -474,8 +474,8 @@ void SyncController::maindataAction()
|
||||
connect(btSession, &BitTorrent::Session::torrentAboutToBeRemoved, this, &SyncController::onTorrentAboutToBeRemoved);
|
||||
connect(btSession, &BitTorrent::Session::torrentCategoryChanged, this, &SyncController::onTorrentCategoryChanged);
|
||||
connect(btSession, &BitTorrent::Session::torrentMetadataReceived, this, &SyncController::onTorrentMetadataReceived);
|
||||
connect(btSession, &BitTorrent::Session::torrentPaused, this, &SyncController::onTorrentPaused);
|
||||
connect(btSession, &BitTorrent::Session::torrentResumed, this, &SyncController::onTorrentResumed);
|
||||
connect(btSession, &BitTorrent::Session::torrentStopped, this, &SyncController::onTorrentStopped);
|
||||
connect(btSession, &BitTorrent::Session::torrentStarted, this, &SyncController::onTorrentStarted);
|
||||
connect(btSession, &BitTorrent::Session::torrentSavePathChanged, this, &SyncController::onTorrentSavePathChanged);
|
||||
connect(btSession, &BitTorrent::Session::torrentSavingModeChanged, this, &SyncController::onTorrentSavingModeChanged);
|
||||
connect(btSession, &BitTorrent::Session::torrentTagAdded, this, &SyncController::onTorrentTagAdded);
|
||||
@@ -882,12 +882,12 @@ void SyncController::onTorrentMetadataReceived(BitTorrent::Torrent *torrent)
|
||||
m_updatedTorrents.insert(torrent->id());
|
||||
}
|
||||
|
||||
void SyncController::onTorrentPaused(BitTorrent::Torrent *torrent)
|
||||
void SyncController::onTorrentStopped(BitTorrent::Torrent *torrent)
|
||||
{
|
||||
m_updatedTorrents.insert(torrent->id());
|
||||
}
|
||||
|
||||
void SyncController::onTorrentResumed(BitTorrent::Torrent *torrent)
|
||||
void SyncController::onTorrentStarted(BitTorrent::Torrent *torrent)
|
||||
{
|
||||
m_updatedTorrents.insert(torrent->id());
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ private:
|
||||
void onTorrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
|
||||
void onTorrentCategoryChanged(BitTorrent::Torrent *torrent, const QString &oldCategory);
|
||||
void onTorrentMetadataReceived(BitTorrent::Torrent *torrent);
|
||||
void onTorrentPaused(BitTorrent::Torrent *torrent);
|
||||
void onTorrentResumed(BitTorrent::Torrent *torrent);
|
||||
void onTorrentStopped(BitTorrent::Torrent *torrent);
|
||||
void onTorrentStarted(BitTorrent::Torrent *torrent);
|
||||
void onTorrentSavePathChanged(BitTorrent::Torrent *torrent);
|
||||
void onTorrentSavingModeChanged(BitTorrent::Torrent *torrent);
|
||||
void onTorrentTagAdded(BitTorrent::Torrent *torrent, const Tag &tag);
|
||||
|
||||
@@ -276,7 +276,7 @@ void TorrentsController::countAction()
|
||||
// - "force_start": Torrent force start state
|
||||
// - "category": Torrent category
|
||||
// GET params:
|
||||
// - filter (string): all, downloading, seeding, completed, paused, resumed, active, inactive, stalled, stalled_uploading, stalled_downloading
|
||||
// - filter (string): all, downloading, seeding, completed, stopped, running, active, inactive, stalled, stalled_uploading, stalled_downloading
|
||||
// - category (string): torrent category for filtering by it (empty string means "uncategorized"; no "category" param presented means "any category")
|
||||
// - tag (string): torrent tag for filtering by it (empty string means "untagged"; no "tag" param presented means "any tag")
|
||||
// - hashes (string): filter by hashes, can contain multiple hashes separated by |
|
||||
@@ -685,7 +685,7 @@ void TorrentsController::addAction()
|
||||
const bool seqDownload = parseBool(params()[u"sequentialDownload"_s]).value_or(false);
|
||||
const bool firstLastPiece = parseBool(params()[u"firstLastPiecePrio"_s]).value_or(false);
|
||||
const std::optional<bool> addToQueueTop = parseBool(params()[u"addToTopOfQueue"_s]);
|
||||
const std::optional<bool> addPaused = parseBool(params()[u"paused"_s]);
|
||||
const std::optional<bool> addStopped = parseBool(params()[u"stopped"_s]);
|
||||
const QString savepath = params()[u"savepath"_s].trimmed();
|
||||
const QString downloadPath = params()[u"downloadPath"_s].trimmed();
|
||||
const std::optional<bool> useDownloadPath = parseBool(params()[u"useDownloadPath"_s]);
|
||||
@@ -740,7 +740,7 @@ void TorrentsController::addAction()
|
||||
.firstLastPiecePriority = firstLastPiece,
|
||||
.addForced = false,
|
||||
.addToQueueTop = addToQueueTop,
|
||||
.addPaused = addPaused,
|
||||
.addStopped = addStopped,
|
||||
.stopCondition = stopCondition,
|
||||
.filePaths = {},
|
||||
.filePriorities = {},
|
||||
@@ -841,7 +841,7 @@ void TorrentsController::editTrackerAction()
|
||||
|
||||
torrent->replaceTrackers(trackers);
|
||||
|
||||
if (!torrent->isPaused())
|
||||
if (!torrent->isStopped())
|
||||
torrent->forceReannounce();
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ void TorrentsController::removeTrackersAction()
|
||||
const QStringList urls = params()[u"urls"_s].split(u'|');
|
||||
torrent->removeTrackers(urls);
|
||||
|
||||
if (!torrent->isPaused())
|
||||
if (!torrent->isStopped())
|
||||
torrent->forceReannounce();
|
||||
}
|
||||
|
||||
@@ -899,20 +899,20 @@ void TorrentsController::addPeersAction()
|
||||
setResult(results);
|
||||
}
|
||||
|
||||
void TorrentsController::pauseAction()
|
||||
void TorrentsController::stopAction()
|
||||
{
|
||||
requireParams({u"hashes"_s});
|
||||
|
||||
const QStringList hashes = params()[u"hashes"_s].split(u'|');
|
||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->pause(); });
|
||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->stop(); });
|
||||
}
|
||||
|
||||
void TorrentsController::resumeAction()
|
||||
void TorrentsController::startAction()
|
||||
{
|
||||
requireParams({u"hashes"_s});
|
||||
|
||||
const QStringList idStrings = params()[u"hashes"_s].split(u'|');
|
||||
applyToTorrents(idStrings, [](BitTorrent::Torrent *const torrent) { torrent->resume(); });
|
||||
applyToTorrents(idStrings, [](BitTorrent::Torrent *const torrent) { torrent->start(); });
|
||||
}
|
||||
|
||||
void TorrentsController::filePrioAction()
|
||||
@@ -1066,7 +1066,7 @@ void TorrentsController::setForceStartAction()
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [value](BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
torrent->resume(value ? BitTorrent::TorrentOperatingMode::Forced : BitTorrent::TorrentOperatingMode::AutoManaged);
|
||||
torrent->start(value ? BitTorrent::TorrentOperatingMode::Forced : BitTorrent::TorrentOperatingMode::AutoManaged);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ private slots:
|
||||
void filesAction();
|
||||
void pieceHashesAction();
|
||||
void pieceStatesAction();
|
||||
void resumeAction();
|
||||
void pauseAction();
|
||||
void startAction();
|
||||
void stopAction();
|
||||
void recheckAction();
|
||||
void reannounceAction();
|
||||
void renameAction();
|
||||
|
||||
Reference in New Issue
Block a user