From cecbb44a031c96e8fce48f12eeddda47b9c85a27 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 + src/webui/webapplication.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 3dea5228c..0fe0a5466 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -234,6 +234,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(); diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index d149e8ac5..30bd3b80c 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -52,7 +52,7 @@ #include "base/utils/version.h" #include "api/isessionmanager.h" -inline const Utils::Version<3, 2> API_VERSION {2, 9, 6}; +inline const Utils::Version<3, 2> API_VERSION {2, 10, 0}; class APIController; class AuthController;