1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-28 23:44:32 +00:00

Add categories WebAPI

Closes #5330.
This commit is contained in:
Thomas Piccirello 2018-09-22 18:42:05 -04:00
parent bdc788c824
commit 6d619e9491
2 changed files with 16 additions and 0 deletions

View File

@ -856,3 +856,18 @@ void TorrentsController::removeCategoriesAction()
for (const QString &category : categories)
BitTorrent::Session::instance()->removeCategory(category);
}
void TorrentsController::categoriesAction()
{
QJsonObject categories;
const auto categoriesList = BitTorrent::Session::instance()->categories();
for (auto it = categoriesList.cbegin(); it != categoriesList.cend(); ++it) {
const auto &key = it.key();
categories[key] = QJsonObject {
{"name", key},
{"savePath", it.value()}
};
}
setResult(categories);
}

View File

@ -55,6 +55,7 @@ private slots:
void createCategoryAction();
void editCategoryAction();
void removeCategoriesAction();
void categoriesAction();
void addAction();
void deleteAction();
void addTrackersAction();