mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-30 12:18:05 -06:00
committed by
GitHub
parent
41a38428fc
commit
f8a304abdc
@@ -37,8 +37,9 @@
|
||||
|
||||
#include "apierror.h"
|
||||
|
||||
APIController::APIController(QObject *parent)
|
||||
: QObject {parent}
|
||||
APIController::APIController(IApplication *app, QObject *parent)
|
||||
: QObject(parent)
|
||||
, ApplicationComponent(app)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -32,18 +32,20 @@
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
#include "base/applicationcomponent.h"
|
||||
|
||||
class QString;
|
||||
|
||||
using DataMap = QHash<QString, QByteArray>;
|
||||
using StringMap = QHash<QString, QString>;
|
||||
|
||||
class APIController : public QObject
|
||||
class APIController : public QObject, public ApplicationComponent
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(APIController)
|
||||
|
||||
public:
|
||||
explicit APIController(QObject *parent = nullptr);
|
||||
explicit APIController(IApplication *app, QObject *parent = nullptr);
|
||||
|
||||
QVariant run(const QString &action, const StringMap ¶ms, const DataMap &data = {});
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ void AppController::preferencesAction()
|
||||
// Advanced settings
|
||||
// qBitorrent preferences
|
||||
// Physical memory (RAM) usage limit
|
||||
data[u"memory_working_set_limit"_qs] = dynamic_cast<IApplication *>(QCoreApplication::instance())->memoryWorkingSetLimit();
|
||||
data[u"memory_working_set_limit"_qs] = app()->memoryWorkingSetLimit();
|
||||
// Current network interface
|
||||
data[u"current_network_interface"_qs] = session->networkInterface();
|
||||
// Current network interface address
|
||||
@@ -758,7 +758,7 @@ void AppController::setPreferencesAction()
|
||||
// qBittorrent preferences
|
||||
// Physical memory (RAM) usage limit
|
||||
if (hasKey(u"memory_working_set_limit"_qs))
|
||||
dynamic_cast<IApplication *>(QCoreApplication::instance())->setMemoryWorkingSetLimit(it.value().toInt());
|
||||
app()->setMemoryWorkingSetLimit(it.value().toInt());
|
||||
// Current network interface
|
||||
if (hasKey(u"current_network_interface"_qs))
|
||||
{
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
#include "apierror.h"
|
||||
#include "isessionmanager.h"
|
||||
|
||||
AuthController::AuthController(ISessionManager *sessionManager, QObject *parent)
|
||||
: APIController {parent}
|
||||
AuthController::AuthController(ISessionManager *sessionManager, IApplication *app, QObject *parent)
|
||||
: APIController(app, parent)
|
||||
, m_sessionManager {sessionManager}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class AuthController : public APIController
|
||||
Q_DISABLE_COPY_MOVE(AuthController)
|
||||
|
||||
public:
|
||||
explicit AuthController(ISessionManager *sessionManager, QObject *parent = nullptr);
|
||||
explicit AuthController(ISessionManager *sessionManager, IApplication *app, QObject *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void loginAction();
|
||||
|
||||
@@ -366,8 +366,8 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
SyncController::SyncController(QObject *parent)
|
||||
: APIController(parent)
|
||||
SyncController::SyncController(IApplication *app, QObject *parent)
|
||||
: APIController(app, parent)
|
||||
{
|
||||
m_freeDiskSpaceThread = new QThread(this);
|
||||
m_freeDiskSpaceChecker = new FreeDiskSpaceChecker();
|
||||
|
||||
@@ -45,7 +45,7 @@ class SyncController : public APIController
|
||||
public:
|
||||
using APIController::APIController;
|
||||
|
||||
explicit SyncController(QObject *parent = nullptr);
|
||||
explicit SyncController(IApplication *app, QObject *parent = nullptr);
|
||||
~SyncController() override;
|
||||
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user