From 45420e2c5c3d3c83e64224856f6cfcab5425f4b6 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Tue, 23 Apr 2024 17:08:41 +0300 Subject: [PATCH] UI: Rpc: Minor refactor of lambdas --- src/ui/rpc/appinfomanagerrpc.cpp | 2 +- src/ui/rpc/confappmanagerrpc.cpp | 6 +++--- src/ui/rpc/confmanagerrpc.cpp | 2 +- src/ui/rpc/confrulemanagerrpc.cpp | 6 +++--- src/ui/rpc/confzonemanagerrpc.cpp | 6 +++--- src/ui/rpc/drivermanagerrpc.cpp | 1 + src/ui/rpc/quotamanagerrpc.cpp | 2 +- src/ui/rpc/statblockmanagerrpc.cpp | 2 +- src/ui/rpc/statmanagerrpc.cpp | 10 +++++----- src/ui/rpc/taskmanagerrpc.cpp | 8 ++++---- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/ui/rpc/appinfomanagerrpc.cpp b/src/ui/rpc/appinfomanagerrpc.cpp index 3fe6574d..83b0b2eb 100644 --- a/src/ui/rpc/appinfomanagerrpc.cpp +++ b/src/ui/rpc/appinfomanagerrpc.cpp @@ -37,7 +37,7 @@ void AppInfoManagerRpc::setupServerSignals(RpcManager *rpcManager) auto appInfoManager = IoC(); connect(appInfoManager, &AppInfoManager::lookupInfoFinished, rpcManager, - [&](const QString &appPath, const AppInfo & /*appInfo*/) { + [=](const QString &appPath, const AppInfo & /*appInfo*/) { rpcManager->invokeOnClients( Control::Rpc_AppInfoManager_checkLookupInfoFinished, { appPath }); }); diff --git a/src/ui/rpc/confappmanagerrpc.cpp b/src/ui/rpc/confappmanagerrpc.cpp index fd4bd61c..7c90e31d 100644 --- a/src/ui/rpc/confappmanagerrpc.cpp +++ b/src/ui/rpc/confappmanagerrpc.cpp @@ -205,9 +205,9 @@ void ConfAppManagerRpc::setupServerSignals(RpcManager *rpcManager) auto confAppManager = IoC(); connect(confAppManager, &ConfAppManager::appAlerted, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appAlerted); }); + [=] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appAlerted); }); connect(confAppManager, &ConfAppManager::appsChanged, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appsChanged); }); + [=] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appsChanged); }); connect(confAppManager, &ConfAppManager::appUpdated, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appUpdated); }); + [=] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appUpdated); }); } diff --git a/src/ui/rpc/confmanagerrpc.cpp b/src/ui/rpc/confmanagerrpc.cpp index 49027cea..8d3cb1f9 100644 --- a/src/ui/rpc/confmanagerrpc.cpp +++ b/src/ui/rpc/confmanagerrpc.cpp @@ -160,7 +160,7 @@ void ConfManagerRpc::setupServerSignals(RpcManager *rpcManager) { auto confManager = IoC(); - connect(confManager, &ConfManager::confChanged, rpcManager, [&](bool onlyFlags) { + connect(confManager, &ConfManager::confChanged, rpcManager, [=](bool onlyFlags) { const QVariant confVar = IoC()->toPatchVariant(onlyFlags); rpcManager->invokeOnClients(Control::Rpc_ConfManager_confChanged, { confVar }); }); diff --git a/src/ui/rpc/confrulemanagerrpc.cpp b/src/ui/rpc/confrulemanagerrpc.cpp index 0e8b75df..13cf1c53 100644 --- a/src/ui/rpc/confrulemanagerrpc.cpp +++ b/src/ui/rpc/confrulemanagerrpc.cpp @@ -147,10 +147,10 @@ void ConfRuleManagerRpc::setupServerSignals(RpcManager *rpcManager) auto confRuleManager = IoC(); connect(confRuleManager, &ConfRuleManager::ruleAdded, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleAdded); }); - connect(confRuleManager, &ConfRuleManager::ruleRemoved, rpcManager, [&](int ruleId) { + [=] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleAdded); }); + connect(confRuleManager, &ConfRuleManager::ruleRemoved, rpcManager, [=](int ruleId) { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleRemoved, { ruleId }); }); connect(confRuleManager, &ConfRuleManager::ruleUpdated, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleUpdated); }); + [=] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleUpdated); }); } diff --git a/src/ui/rpc/confzonemanagerrpc.cpp b/src/ui/rpc/confzonemanagerrpc.cpp index 33413a01..47ab9ba8 100644 --- a/src/ui/rpc/confzonemanagerrpc.cpp +++ b/src/ui/rpc/confzonemanagerrpc.cpp @@ -138,10 +138,10 @@ void ConfZoneManagerRpc::setupServerSignals(RpcManager *rpcManager) auto confZoneManager = IoC(); connect(confZoneManager, &ConfZoneManager::zoneAdded, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneAdded); }); - connect(confZoneManager, &ConfZoneManager::zoneRemoved, rpcManager, [&](int zoneId) { + [=] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneAdded); }); + connect(confZoneManager, &ConfZoneManager::zoneRemoved, rpcManager, [=](int zoneId) { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneRemoved, { zoneId }); }); connect(confZoneManager, &ConfZoneManager::zoneUpdated, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneUpdated); }); + [=] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneUpdated); }); } diff --git a/src/ui/rpc/drivermanagerrpc.cpp b/src/ui/rpc/drivermanagerrpc.cpp index 40d9d43a..f7fd238a 100644 --- a/src/ui/rpc/drivermanagerrpc.cpp +++ b/src/ui/rpc/drivermanagerrpc.cpp @@ -62,6 +62,7 @@ void DriverManagerRpc::setupServerSignals(RpcManager *rpcManager) rpcManager->invokeOnClients( Control::Rpc_DriverManager_updateState, DriverManagerRpc::updateState_args()); }; + connect(driverManager, &DriverManager::errorCodeChanged, rpcManager, updateClientStates); connect(driverManager, &DriverManager::isDeviceOpenedChanged, rpcManager, updateClientStates); } diff --git a/src/ui/rpc/quotamanagerrpc.cpp b/src/ui/rpc/quotamanagerrpc.cpp index 368fb5cd..1720706f 100644 --- a/src/ui/rpc/quotamanagerrpc.cpp +++ b/src/ui/rpc/quotamanagerrpc.cpp @@ -23,7 +23,7 @@ void QuotaManagerRpc::setupServerSignals(RpcManager *rpcManager) { auto quotaManager = IoC(); - connect(quotaManager, &QuotaManager::alert, rpcManager, [&](qint8 alertType) { + connect(quotaManager, &QuotaManager::alert, rpcManager, [=](qint8 alertType) { rpcManager->invokeOnClients(Control::Rpc_QuotaManager_alert, { alertType }); }); } diff --git a/src/ui/rpc/statblockmanagerrpc.cpp b/src/ui/rpc/statblockmanagerrpc.cpp index 3e9f2fb0..b739ee07 100644 --- a/src/ui/rpc/statblockmanagerrpc.cpp +++ b/src/ui/rpc/statblockmanagerrpc.cpp @@ -53,5 +53,5 @@ void StatBlockManagerRpc::setupServerSignals(RpcManager *rpcManager) auto statBlockManager = IoC(); connect(statBlockManager, &StatBlockManager::connChanged, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_StatBlockManager_connChanged); }); + [=] { rpcManager->invokeOnClients(Control::Rpc_StatBlockManager_connChanged); }); } diff --git a/src/ui/rpc/statmanagerrpc.cpp b/src/ui/rpc/statmanagerrpc.cpp index aa18cdfa..73027f78 100644 --- a/src/ui/rpc/statmanagerrpc.cpp +++ b/src/ui/rpc/statmanagerrpc.cpp @@ -121,20 +121,20 @@ void StatManagerRpc::setupServerSignals(RpcManager *rpcManager) auto statManager = IoC(); connect(statManager, &StatManager::trafficCleared, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_StatManager_trafficCleared); }); - connect(statManager, &StatManager::appStatRemoved, rpcManager, [&](qint64 appId) { + [=] { rpcManager->invokeOnClients(Control::Rpc_StatManager_trafficCleared); }); + connect(statManager, &StatManager::appStatRemoved, rpcManager, [=](qint64 appId) { rpcManager->invokeOnClients(Control::Rpc_StatManager_appStatRemoved, { appId }); }); connect(statManager, &StatManager::appCreated, rpcManager, - [&](qint64 appId, const QString &appPath) { + [=](qint64 appId, const QString &appPath) { rpcManager->invokeOnClients( Control::Rpc_StatManager_appCreated, { appId, appPath }); }); connect(statManager, &StatManager::trafficAdded, rpcManager, - [&](qint64 unixTime, quint32 inBytes, quint32 outBytes) { + [=](qint64 unixTime, quint32 inBytes, quint32 outBytes) { rpcManager->invokeOnClients( Control::Rpc_StatManager_trafficAdded, { unixTime, inBytes, outBytes }); }); connect(statManager, &StatManager::appTrafTotalsResetted, rpcManager, - [&] { rpcManager->invokeOnClients(Control::Rpc_StatManager_appTrafTotalsResetted); }); + [=] { rpcManager->invokeOnClients(Control::Rpc_StatManager_appTrafTotalsResetted); }); } diff --git a/src/ui/rpc/taskmanagerrpc.cpp b/src/ui/rpc/taskmanagerrpc.cpp index d313a0f2..dd10222c 100644 --- a/src/ui/rpc/taskmanagerrpc.cpp +++ b/src/ui/rpc/taskmanagerrpc.cpp @@ -101,20 +101,20 @@ void TaskManagerRpc::setupServerSignals(RpcManager *rpcManager) { auto taskManager = IoC(); - connect(taskManager, &TaskManager::taskStarted, rpcManager, [&](qint8 taskType) { + connect(taskManager, &TaskManager::taskStarted, rpcManager, [=](qint8 taskType) { rpcManager->invokeOnClients(Control::Rpc_TaskManager_taskStarted, { taskType }); }); - connect(taskManager, &TaskManager::taskFinished, rpcManager, [&](qint8 taskType) { + connect(taskManager, &TaskManager::taskFinished, rpcManager, [=](qint8 taskType) { rpcManager->invokeOnClients(Control::Rpc_TaskManager_taskFinished, { taskType }); }); connect(taskManager, &TaskManager::appVersionDownloaded, rpcManager, - [&](const QString &version) { + [=](const QString &version) { rpcManager->invokeOnClients( Control::Rpc_TaskManager_appVersionDownloaded, { version }); }); connect(taskManager, &TaskManager::zonesDownloaded, rpcManager, - [&](const QStringList &zoneNames) { + [=](const QStringList &zoneNames) { rpcManager->invokeOnClients( Control::Rpc_TaskManager_zonesDownloaded, { zoneNames }); });