Implement gateway for adding new torrents

PR #19355.
This commit is contained in:
Vladimir Golovnev
2023-08-14 18:17:56 +03:00
committed by GitHub
parent e4313d6651
commit dcf3e97291
42 changed files with 933 additions and 639 deletions

View File

@@ -38,8 +38,7 @@
#include "apierror.h"
APIController::APIController(IApplication *app, QObject *parent)
: QObject(parent)
, ApplicationComponent(app)
: ApplicationComponent(app, parent)
{
}

View File

@@ -39,7 +39,7 @@ class QString;
using DataMap = QHash<QString, QByteArray>;
using StringMap = QHash<QString, QString>;
class APIController : public QObject, public ApplicationComponent
class APIController : public ApplicationComponent<QObject>
{
Q_OBJECT
Q_DISABLE_COPY_MOVE(APIController)

View File

@@ -47,6 +47,7 @@
#include "base/bittorrent/torrent.h"
#include "base/bittorrent/torrentdescriptor.h"
#include "base/bittorrent/trackerentry.h"
#include "base/interfaces/iapplication.h"
#include "base/global.h"
#include "base/logger.h"
#include "base/net/downloadmanager.h"
@@ -732,7 +733,7 @@ void TorrentsController::addAction()
if (!url.isEmpty())
{
Net::DownloadManager::instance()->setCookiesFromUrl(cookies, QUrl::fromEncoded(url.toUtf8()));
partialSuccess |= BitTorrent::Session::instance()->addTorrent(url, addTorrentParams);
partialSuccess |= app()->addTorrentManager()->addTorrent(url, addTorrentParams);
}
}