Skip to content

Commit

Permalink
Add categories WebAPI
Browse files Browse the repository at this point in the history
Closes #5330.
  • Loading branch information
Piccirello committed Oct 7, 2018
1 parent bdc788c commit 6d619e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/webui/api/torrentscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions src/webui/api/torrentscontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private slots:
void createCategoryAction();
void editCategoryAction();
void removeCategoriesAction();
void categoriesAction();
void addAction();
void deleteAction();
void addTrackersAction();
Expand Down

0 comments on commit 6d619e9

Please sign in to comment.