Browse Source

Merge pull request #9586 from Piccirello/webui-categories

Add categories WebAPI
adaptive-webui-19844
Vladimir Golovnev 6 years ago committed by GitHub
parent
commit
3e8f3d61fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/webui/api/torrentscontroller.cpp
  2. 1
      src/webui/api/torrentscontroller.h

15
src/webui/api/torrentscontroller.cpp

@ -856,3 +856,18 @@ void TorrentsController::removeCategoriesAction()
for (const QString &category : categories) for (const QString &category : categories)
BitTorrent::Session::instance()->removeCategory(category); 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
src/webui/api/torrentscontroller.h

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

Loading…
Cancel
Save