mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Maintain 200 status code for existing APIs
This is to avoid introducing breaking changes. Without this change, these APIs would start returning a 204 due to their lack of response content.
This commit is contained in:
parent
72548fd18d
commit
0813633173
8 changed files with 137 additions and 3 deletions
|
@ -123,6 +123,7 @@ void AppController::shutdownAction()
|
|||
{
|
||||
QCoreApplication::exit();
|
||||
});
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void AppController::preferencesAction()
|
||||
|
@ -1167,6 +1168,8 @@ void AppController::setPreferencesAction()
|
|||
|
||||
// Save preferences
|
||||
pref->apply();
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void AppController::defaultSavePathAction()
|
||||
|
@ -1177,9 +1180,9 @@ void AppController::defaultSavePathAction()
|
|||
void AppController::sendTestEmailAction()
|
||||
{
|
||||
app()->sendTestEmail();
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
|
||||
void AppController::getDirectoryContentAction()
|
||||
{
|
||||
requireParams({u"dirPath"_s});
|
||||
|
@ -1269,6 +1272,8 @@ void AppController::setCookiesAction()
|
|||
}
|
||||
|
||||
Net::DownloadManager::instance()->setAllCookies(cookies);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void AppController::networkInterfaceListAction()
|
||||
|
|
|
@ -46,11 +46,13 @@ AuthController::AuthController(ISessionManager *sessionManager, IApplication *ap
|
|||
void AuthController::setUsername(const QString &username)
|
||||
{
|
||||
m_username = username;
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void AuthController::setPasswordHash(const QByteArray &passwordHash)
|
||||
{
|
||||
m_passwordHash = passwordHash;
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void AuthController::loginAction()
|
||||
|
@ -96,9 +98,10 @@ void AuthController::loginAction()
|
|||
}
|
||||
}
|
||||
|
||||
void AuthController::logoutAction() const
|
||||
void AuthController::logoutAction()
|
||||
{
|
||||
m_sessionManager->sessionEnd();
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
bool AuthController::isBanned() const
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
private slots:
|
||||
void loginAction();
|
||||
void logoutAction() const;
|
||||
void logoutAction();
|
||||
|
||||
private:
|
||||
bool isBanned() const;
|
||||
|
|
|
@ -53,6 +53,8 @@ void RSSController::addFolderAction()
|
|||
const nonstd::expected<RSS::Folder *, QString> result = RSS::Session::instance()->addFolder(path);
|
||||
if (!result)
|
||||
throw APIError(APIErrorType::Conflict, result.error());
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::addFeedAction()
|
||||
|
@ -65,6 +67,8 @@ void RSSController::addFeedAction()
|
|||
const nonstd::expected<RSS::Feed *, QString> result = RSS::Session::instance()->addFeed(url, (path.isEmpty() ? url : path), std::chrono::seconds(refreshInterval));
|
||||
if (!result)
|
||||
throw APIError(APIErrorType::Conflict, result.error());
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::setFeedURLAction()
|
||||
|
@ -76,6 +80,8 @@ void RSSController::setFeedURLAction()
|
|||
const nonstd::expected<void, QString> result = RSS::Session::instance()->setFeedURL(path, url);
|
||||
if (!result)
|
||||
throw APIError(APIErrorType::Conflict, result.error());
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::setFeedRefreshIntervalAction()
|
||||
|
@ -103,6 +109,8 @@ void RSSController::removeItemAction()
|
|||
const nonstd::expected<void, QString> result = RSS::Session::instance()->removeItem(path);
|
||||
if (!result)
|
||||
throw APIError(APIErrorType::Conflict, result.error());
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::moveItemAction()
|
||||
|
@ -114,6 +122,8 @@ void RSSController::moveItemAction()
|
|||
const nonstd::expected<void, QString> result = RSS::Session::instance()->moveItem(itemPath, destPath);
|
||||
if (!result)
|
||||
throw APIError(APIErrorType::Conflict, result.error());
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::itemsAction()
|
||||
|
@ -148,6 +158,8 @@ void RSSController::markAsReadAction()
|
|||
{
|
||||
item->markAsRead();
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::refreshItemAction()
|
||||
|
@ -158,6 +170,8 @@ void RSSController::refreshItemAction()
|
|||
RSS::Item *item = RSS::Session::instance()->itemByPath(itemPath);
|
||||
if (item)
|
||||
item->refresh();
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::setRuleAction()
|
||||
|
@ -169,6 +183,8 @@ void RSSController::setRuleAction()
|
|||
|
||||
const auto jsonObj = QJsonDocument::fromJson(ruleDef).object();
|
||||
RSS::AutoDownloader::instance()->setRule(RSS::AutoDownloadRule::fromJsonObject(jsonObj, ruleName));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::renameRuleAction()
|
||||
|
@ -179,6 +195,8 @@ void RSSController::renameRuleAction()
|
|||
const QString newRuleName {params()[u"newRuleName"_s]};
|
||||
|
||||
RSS::AutoDownloader::instance()->renameRule(ruleName, newRuleName);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::removeRuleAction()
|
||||
|
@ -187,6 +205,8 @@ void RSSController::removeRuleAction()
|
|||
|
||||
const QString ruleName {params()[u"ruleName"_s]};
|
||||
RSS::AutoDownloader::instance()->removeRule(ruleName);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void RSSController::rulesAction()
|
||||
|
|
|
@ -142,6 +142,8 @@ void SearchController::stopAction()
|
|||
searchHandler->cancelSearch();
|
||||
m_activeSearches.remove(id);
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::statusAction()
|
||||
|
@ -215,6 +217,8 @@ void SearchController::deleteAction()
|
|||
searchHandler->cancelSearch();
|
||||
m_activeSearches.remove(id);
|
||||
m_searchHandlers.erase(iter);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::downloadTorrentAction()
|
||||
|
@ -238,6 +242,8 @@ void SearchController::downloadTorrentAction()
|
|||
downloadHandler->deleteLater();
|
||||
});
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::pluginsAction()
|
||||
|
@ -253,6 +259,8 @@ void SearchController::installPluginAction()
|
|||
const QStringList sources = params()[u"sources"_s].split(u'|');
|
||||
for (const QString &source : sources)
|
||||
SearchPluginManager::instance()->installPlugin(source);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::uninstallPluginAction()
|
||||
|
@ -262,6 +270,8 @@ void SearchController::uninstallPluginAction()
|
|||
const QStringList names = params()[u"names"_s].split(u'|');
|
||||
for (const QString &name : names)
|
||||
SearchPluginManager::instance()->uninstallPlugin(name.trimmed());
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::enablePluginAction()
|
||||
|
@ -273,6 +283,8 @@ void SearchController::enablePluginAction()
|
|||
|
||||
for (const QString &name : names)
|
||||
SearchPluginManager::instance()->enablePlugin(name.trimmed(), enable);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::updatePluginsAction()
|
||||
|
@ -282,6 +294,8 @@ void SearchController::updatePluginsAction()
|
|||
connect(pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &SearchController::checkForUpdatesFinished);
|
||||
connect(pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &SearchController::checkForUpdatesFailed);
|
||||
pluginManager->checkForUpdates();
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::checkForUpdatesFinished(const QHash<QString, PluginVersion> &updateInfo)
|
||||
|
@ -300,6 +314,8 @@ void SearchController::checkForUpdatesFinished(const QHash<QString, PluginVersio
|
|||
LogMsg(tr("Updating plugin %1").arg(pluginName), Log::INFO);
|
||||
pluginManager->updatePlugin(pluginName);
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void SearchController::checkForUpdatesFailed(const QString &reason)
|
||||
|
|
|
@ -256,4 +256,6 @@ void TorrentCreatorController::deleteTaskAction()
|
|||
|
||||
if (!m_torrentCreationManager->deleteTask(id))
|
||||
throw APIError(APIErrorType::NotFound);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
|
|
@ -624,6 +624,8 @@ void TorrentsController::addWebSeedsAction()
|
|||
}
|
||||
|
||||
torrent->addUrlSeeds(urls);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::editWebSeedAction()
|
||||
|
@ -656,6 +658,8 @@ void TorrentsController::editWebSeedAction()
|
|||
torrent->removeUrlSeeds({origUrl});
|
||||
torrent->addUrlSeeds({newUrl});
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::removeWebSeedsAction()
|
||||
|
@ -679,6 +683,8 @@ void TorrentsController::removeWebSeedsAction()
|
|||
}
|
||||
|
||||
torrent->removeUrlSeeds(urls);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
// Returns the files in a torrent in JSON format.
|
||||
|
@ -919,6 +925,8 @@ void TorrentsController::addTrackersAction()
|
|||
|
||||
const QList<BitTorrent::TrackerEntry> entries = BitTorrent::parseTrackerEntries(params()[u"urls"_s]);
|
||||
torrent->addTrackers(entries);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::editTrackerAction()
|
||||
|
@ -972,6 +980,8 @@ void TorrentsController::editTrackerAction()
|
|||
|
||||
if (!torrent->isStopped())
|
||||
torrent->forceReannounce();
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::removeTrackersAction()
|
||||
|
@ -1006,6 +1016,8 @@ void TorrentsController::removeTrackersAction()
|
|||
|
||||
for (BitTorrent::Torrent *const torrent : asConst(torrents))
|
||||
torrent->removeTrackers(urls);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::addPeersAction()
|
||||
|
@ -1052,6 +1064,8 @@ void TorrentsController::stopAction()
|
|||
|
||||
const QStringList hashes = params()[u"hashes"_s].split(u'|');
|
||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->stop(); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::startAction()
|
||||
|
@ -1060,6 +1074,8 @@ void TorrentsController::startAction()
|
|||
|
||||
const QStringList idStrings = params()[u"hashes"_s].split(u'|');
|
||||
applyToTorrents(idStrings, [](BitTorrent::Torrent *const torrent) { torrent->start(); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::filePrioAction()
|
||||
|
@ -1101,6 +1117,8 @@ void TorrentsController::filePrioAction()
|
|||
|
||||
if (priorityChanged)
|
||||
torrent->prioritizeFiles(priorities);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::uploadLimitAction()
|
||||
|
@ -1149,6 +1167,8 @@ void TorrentsController::setUploadLimitAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [limit](BitTorrent::Torrent *const torrent) { torrent->setUploadLimit(limit); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setDownloadLimitAction()
|
||||
|
@ -1161,6 +1181,8 @@ void TorrentsController::setDownloadLimitAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [limit](BitTorrent::Torrent *const torrent) { torrent->setDownloadLimit(limit); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setShareLimitsAction()
|
||||
|
@ -1178,6 +1200,8 @@ void TorrentsController::setShareLimitsAction()
|
|||
torrent->setSeedingTimeLimit(seedingTimeLimit);
|
||||
torrent->setInactiveSeedingTimeLimit(inactiveSeedingTimeLimit);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::toggleSequentialDownloadAction()
|
||||
|
@ -1186,6 +1210,8 @@ void TorrentsController::toggleSequentialDownloadAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->toggleSequentialDownload(); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::toggleFirstLastPiecePrioAction()
|
||||
|
@ -1194,6 +1220,8 @@ void TorrentsController::toggleFirstLastPiecePrioAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->toggleFirstLastPiecePriority(); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setSuperSeedingAction()
|
||||
|
@ -1203,6 +1231,8 @@ void TorrentsController::setSuperSeedingAction()
|
|||
const bool value {parseBool(params()[u"value"_s]).value_or(false)};
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [value](BitTorrent::Torrent *const torrent) { torrent->setSuperSeeding(value); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setForceStartAction()
|
||||
|
@ -1215,6 +1245,8 @@ void TorrentsController::setForceStartAction()
|
|||
{
|
||||
torrent->start(value ? BitTorrent::TorrentOperatingMode::Forced : BitTorrent::TorrentOperatingMode::AutoManaged);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::deleteAction()
|
||||
|
@ -1228,6 +1260,8 @@ void TorrentsController::deleteAction()
|
|||
{
|
||||
BitTorrent::Session::instance()->removeTorrent(torrent->id(), deleteOption);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::increasePrioAction()
|
||||
|
@ -1239,6 +1273,8 @@ void TorrentsController::increasePrioAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
BitTorrent::Session::instance()->increaseTorrentsQueuePos(toTorrentIDs(hashes));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::decreasePrioAction()
|
||||
|
@ -1250,6 +1286,8 @@ void TorrentsController::decreasePrioAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
BitTorrent::Session::instance()->decreaseTorrentsQueuePos(toTorrentIDs(hashes));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::topPrioAction()
|
||||
|
@ -1261,6 +1299,8 @@ void TorrentsController::topPrioAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
BitTorrent::Session::instance()->topTorrentsQueuePos(toTorrentIDs(hashes));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::bottomPrioAction()
|
||||
|
@ -1272,6 +1312,8 @@ void TorrentsController::bottomPrioAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
BitTorrent::Session::instance()->bottomTorrentsQueuePos(toTorrentIDs(hashes));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setLocationAction()
|
||||
|
@ -1295,6 +1337,8 @@ void TorrentsController::setLocationAction()
|
|||
torrent->setAutoTMMEnabled(false);
|
||||
torrent->setSavePath(newLocation);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setSavePathAction()
|
||||
|
@ -1320,6 +1364,8 @@ void TorrentsController::setSavePathAction()
|
|||
if (!torrent->isAutoTMMEnabled())
|
||||
torrent->setSavePath(newPath);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setDownloadPathAction()
|
||||
|
@ -1345,6 +1391,8 @@ void TorrentsController::setDownloadPathAction()
|
|||
if (!torrent->isAutoTMMEnabled())
|
||||
torrent->setDownloadPath(newPath);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::renameAction()
|
||||
|
@ -1363,6 +1411,8 @@ void TorrentsController::renameAction()
|
|||
|
||||
name.replace(QRegularExpression(u"\r?\n|\r"_s), u" "_s);
|
||||
torrent->setName(name);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setAutoManagementAction()
|
||||
|
@ -1376,6 +1426,8 @@ void TorrentsController::setAutoManagementAction()
|
|||
{
|
||||
torrent->setAutoTMMEnabled(isEnabled);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::recheckAction()
|
||||
|
@ -1384,6 +1436,8 @@ void TorrentsController::recheckAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->forceRecheck(); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::reannounceAction()
|
||||
|
@ -1392,6 +1446,8 @@ void TorrentsController::reannounceAction()
|
|||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->forceReannounce(); });
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setCategoryAction()
|
||||
|
@ -1406,6 +1462,8 @@ void TorrentsController::setCategoryAction()
|
|||
if (!torrent->setCategory(category))
|
||||
throw APIError(APIErrorType::Conflict, tr("Incorrect category name"));
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::createCategoryAction()
|
||||
|
@ -1431,6 +1489,8 @@ void TorrentsController::createCategoryAction()
|
|||
|
||||
if (!BitTorrent::Session::instance()->addCategory(category, categoryOptions))
|
||||
throw APIError(APIErrorType::Conflict, tr("Unable to create category"));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::editCategoryAction()
|
||||
|
@ -1453,6 +1513,8 @@ void TorrentsController::editCategoryAction()
|
|||
|
||||
if (!BitTorrent::Session::instance()->editCategory(category, categoryOptions))
|
||||
throw APIError(APIErrorType::Conflict, tr("Unable to edit category"));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::removeCategoriesAction()
|
||||
|
@ -1462,6 +1524,8 @@ void TorrentsController::removeCategoriesAction()
|
|||
const QStringList categories {params()[u"categories"_s].split(u'\n')};
|
||||
for (const QString &category : categories)
|
||||
BitTorrent::Session::instance()->removeCategory(category);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::categoriesAction()
|
||||
|
@ -1497,6 +1561,8 @@ void TorrentsController::addTagsAction()
|
|||
torrent->addTag(Tag(tagStr));
|
||||
});
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setTagsAction()
|
||||
|
@ -1542,6 +1608,8 @@ void TorrentsController::removeTagsAction()
|
|||
torrent->removeAllTags();
|
||||
});
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::createTagsAction()
|
||||
|
@ -1552,6 +1620,8 @@ void TorrentsController::createTagsAction()
|
|||
|
||||
for (const QString &tagStr : tags)
|
||||
BitTorrent::Session::instance()->addTag(Tag(tagStr));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::deleteTagsAction()
|
||||
|
@ -1561,6 +1631,8 @@ void TorrentsController::deleteTagsAction()
|
|||
const QStringList tags {params()[u"tags"_s].split(u',', Qt::SkipEmptyParts)};
|
||||
for (const QString &tagStr : tags)
|
||||
BitTorrent::Session::instance()->removeTag(Tag(tagStr));
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::tagsAction()
|
||||
|
@ -1591,6 +1663,8 @@ void TorrentsController::renameFileAction()
|
|||
{
|
||||
throw APIError(APIErrorType::Conflict, error.message());
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::renameFolderAction()
|
||||
|
@ -1613,6 +1687,8 @@ void TorrentsController::renameFolderAction()
|
|||
{
|
||||
throw APIError(APIErrorType::Conflict, error.message());
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::exportAction()
|
||||
|
@ -1669,4 +1745,6 @@ void TorrentsController::setSSLParametersAction()
|
|||
throw APIError(APIErrorType::BadData);
|
||||
|
||||
torrent->setSSLParameters(sslParams);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
|
|
@ -104,6 +104,8 @@ void TransferController::setUploadLimitAction()
|
|||
if (limit == 0) limit = -1;
|
||||
|
||||
BitTorrent::Session::instance()->setUploadSpeedLimit(limit);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TransferController::setDownloadLimitAction()
|
||||
|
@ -113,12 +115,16 @@ void TransferController::setDownloadLimitAction()
|
|||
if (limit == 0) limit = -1;
|
||||
|
||||
BitTorrent::Session::instance()->setDownloadSpeedLimit(limit);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TransferController::toggleSpeedLimitsModeAction()
|
||||
{
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
session->setAltGlobalSpeedLimitEnabled(!session->isAltGlobalSpeedLimitEnabled());
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TransferController::speedLimitsModeAction()
|
||||
|
@ -136,6 +142,8 @@ void TransferController::setSpeedLimitsModeAction()
|
|||
|
||||
// Any non-zero values are considered as alternative mode
|
||||
BitTorrent::Session::instance()->setAltGlobalSpeedLimitEnabled(mode != 0);
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TransferController::banPeersAction()
|
||||
|
@ -149,4 +157,6 @@ void TransferController::banPeersAction()
|
|||
if (!addr.ip.isNull())
|
||||
BitTorrent::Session::instance()->banIP(addr.ip.toString());
|
||||
}
|
||||
|
||||
setResult(QString());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue