From 54dffa10512400757a7f9d47317f3a2bb26dc2fd Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Thu, 2 Nov 2023 11:12:32 +0300 Subject: [PATCH] Allow to request torrents count via WebAPI PR #19831. Closes #19731. --- src/webui/api/torrentscontroller.cpp | 5 +++++ src/webui/api/torrentscontroller.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 57799f9e4..dfb6a378e 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -232,6 +232,11 @@ namespace } } +void TorrentsController::countAction() +{ + setResult(QString::number(BitTorrent::Session::instance()->torrents().count())); +} + // Returns all the torrents in JSON format. // The return value is a JSON-formatted list of dictionaries. // The dictionary keys are: diff --git a/src/webui/api/torrentscontroller.h b/src/webui/api/torrentscontroller.h index 779959ca4..e961505f8 100644 --- a/src/webui/api/torrentscontroller.h +++ b/src/webui/api/torrentscontroller.h @@ -39,6 +39,7 @@ public: using APIController::APIController; private slots: + void countAction(); void infoAction(); void propertiesAction(); void trackersAction();