UI: Rpc: Minor refactor of lambdas

This commit is contained in:
Nodir Temirkhodjaev 2024-04-23 17:08:41 +03:00
parent 62e3d3a507
commit 45420e2c5c
10 changed files with 23 additions and 22 deletions

View File

@ -37,7 +37,7 @@ void AppInfoManagerRpc::setupServerSignals(RpcManager *rpcManager)
auto appInfoManager = IoC<AppInfoManager>(); auto appInfoManager = IoC<AppInfoManager>();
connect(appInfoManager, &AppInfoManager::lookupInfoFinished, rpcManager, connect(appInfoManager, &AppInfoManager::lookupInfoFinished, rpcManager,
[&](const QString &appPath, const AppInfo & /*appInfo*/) { [=](const QString &appPath, const AppInfo & /*appInfo*/) {
rpcManager->invokeOnClients( rpcManager->invokeOnClients(
Control::Rpc_AppInfoManager_checkLookupInfoFinished, { appPath }); Control::Rpc_AppInfoManager_checkLookupInfoFinished, { appPath });
}); });

View File

@ -205,9 +205,9 @@ void ConfAppManagerRpc::setupServerSignals(RpcManager *rpcManager)
auto confAppManager = IoC<ConfAppManager>(); auto confAppManager = IoC<ConfAppManager>();
connect(confAppManager, &ConfAppManager::appAlerted, rpcManager, connect(confAppManager, &ConfAppManager::appAlerted, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appAlerted); }); [=] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appAlerted); });
connect(confAppManager, &ConfAppManager::appsChanged, rpcManager, connect(confAppManager, &ConfAppManager::appsChanged, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appsChanged); }); [=] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appsChanged); });
connect(confAppManager, &ConfAppManager::appUpdated, rpcManager, connect(confAppManager, &ConfAppManager::appUpdated, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appUpdated); }); [=] { rpcManager->invokeOnClients(Control::Rpc_ConfAppManager_appUpdated); });
} }

View File

@ -160,7 +160,7 @@ void ConfManagerRpc::setupServerSignals(RpcManager *rpcManager)
{ {
auto confManager = IoC<ConfManager>(); auto confManager = IoC<ConfManager>();
connect(confManager, &ConfManager::confChanged, rpcManager, [&](bool onlyFlags) { connect(confManager, &ConfManager::confChanged, rpcManager, [=](bool onlyFlags) {
const QVariant confVar = IoC<ConfManager>()->toPatchVariant(onlyFlags); const QVariant confVar = IoC<ConfManager>()->toPatchVariant(onlyFlags);
rpcManager->invokeOnClients(Control::Rpc_ConfManager_confChanged, { confVar }); rpcManager->invokeOnClients(Control::Rpc_ConfManager_confChanged, { confVar });
}); });

View File

@ -147,10 +147,10 @@ void ConfRuleManagerRpc::setupServerSignals(RpcManager *rpcManager)
auto confRuleManager = IoC<ConfRuleManager>(); auto confRuleManager = IoC<ConfRuleManager>();
connect(confRuleManager, &ConfRuleManager::ruleAdded, rpcManager, connect(confRuleManager, &ConfRuleManager::ruleAdded, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleAdded); }); [=] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleAdded); });
connect(confRuleManager, &ConfRuleManager::ruleRemoved, rpcManager, [&](int ruleId) { connect(confRuleManager, &ConfRuleManager::ruleRemoved, rpcManager, [=](int ruleId) {
rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleRemoved, { ruleId }); rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleRemoved, { ruleId });
}); });
connect(confRuleManager, &ConfRuleManager::ruleUpdated, rpcManager, connect(confRuleManager, &ConfRuleManager::ruleUpdated, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleUpdated); }); [=] { rpcManager->invokeOnClients(Control::Rpc_ConfRuleManager_ruleUpdated); });
} }

View File

@ -138,10 +138,10 @@ void ConfZoneManagerRpc::setupServerSignals(RpcManager *rpcManager)
auto confZoneManager = IoC<ConfZoneManager>(); auto confZoneManager = IoC<ConfZoneManager>();
connect(confZoneManager, &ConfZoneManager::zoneAdded, rpcManager, connect(confZoneManager, &ConfZoneManager::zoneAdded, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneAdded); }); [=] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneAdded); });
connect(confZoneManager, &ConfZoneManager::zoneRemoved, rpcManager, [&](int zoneId) { connect(confZoneManager, &ConfZoneManager::zoneRemoved, rpcManager, [=](int zoneId) {
rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneRemoved, { zoneId }); rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneRemoved, { zoneId });
}); });
connect(confZoneManager, &ConfZoneManager::zoneUpdated, rpcManager, connect(confZoneManager, &ConfZoneManager::zoneUpdated, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneUpdated); }); [=] { rpcManager->invokeOnClients(Control::Rpc_ConfZoneManager_zoneUpdated); });
} }

View File

@ -62,6 +62,7 @@ void DriverManagerRpc::setupServerSignals(RpcManager *rpcManager)
rpcManager->invokeOnClients( rpcManager->invokeOnClients(
Control::Rpc_DriverManager_updateState, DriverManagerRpc::updateState_args()); Control::Rpc_DriverManager_updateState, DriverManagerRpc::updateState_args());
}; };
connect(driverManager, &DriverManager::errorCodeChanged, rpcManager, updateClientStates); connect(driverManager, &DriverManager::errorCodeChanged, rpcManager, updateClientStates);
connect(driverManager, &DriverManager::isDeviceOpenedChanged, rpcManager, updateClientStates); connect(driverManager, &DriverManager::isDeviceOpenedChanged, rpcManager, updateClientStates);
} }

View File

@ -23,7 +23,7 @@ void QuotaManagerRpc::setupServerSignals(RpcManager *rpcManager)
{ {
auto quotaManager = IoC<QuotaManager>(); auto quotaManager = IoC<QuotaManager>();
connect(quotaManager, &QuotaManager::alert, rpcManager, [&](qint8 alertType) { connect(quotaManager, &QuotaManager::alert, rpcManager, [=](qint8 alertType) {
rpcManager->invokeOnClients(Control::Rpc_QuotaManager_alert, { alertType }); rpcManager->invokeOnClients(Control::Rpc_QuotaManager_alert, { alertType });
}); });
} }

View File

@ -53,5 +53,5 @@ void StatBlockManagerRpc::setupServerSignals(RpcManager *rpcManager)
auto statBlockManager = IoC<StatBlockManager>(); auto statBlockManager = IoC<StatBlockManager>();
connect(statBlockManager, &StatBlockManager::connChanged, rpcManager, connect(statBlockManager, &StatBlockManager::connChanged, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_StatBlockManager_connChanged); }); [=] { rpcManager->invokeOnClients(Control::Rpc_StatBlockManager_connChanged); });
} }

View File

@ -121,20 +121,20 @@ void StatManagerRpc::setupServerSignals(RpcManager *rpcManager)
auto statManager = IoC<StatManager>(); auto statManager = IoC<StatManager>();
connect(statManager, &StatManager::trafficCleared, rpcManager, connect(statManager, &StatManager::trafficCleared, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_StatManager_trafficCleared); }); [=] { rpcManager->invokeOnClients(Control::Rpc_StatManager_trafficCleared); });
connect(statManager, &StatManager::appStatRemoved, rpcManager, [&](qint64 appId) { connect(statManager, &StatManager::appStatRemoved, rpcManager, [=](qint64 appId) {
rpcManager->invokeOnClients(Control::Rpc_StatManager_appStatRemoved, { appId }); rpcManager->invokeOnClients(Control::Rpc_StatManager_appStatRemoved, { appId });
}); });
connect(statManager, &StatManager::appCreated, rpcManager, connect(statManager, &StatManager::appCreated, rpcManager,
[&](qint64 appId, const QString &appPath) { [=](qint64 appId, const QString &appPath) {
rpcManager->invokeOnClients( rpcManager->invokeOnClients(
Control::Rpc_StatManager_appCreated, { appId, appPath }); Control::Rpc_StatManager_appCreated, { appId, appPath });
}); });
connect(statManager, &StatManager::trafficAdded, rpcManager, connect(statManager, &StatManager::trafficAdded, rpcManager,
[&](qint64 unixTime, quint32 inBytes, quint32 outBytes) { [=](qint64 unixTime, quint32 inBytes, quint32 outBytes) {
rpcManager->invokeOnClients( rpcManager->invokeOnClients(
Control::Rpc_StatManager_trafficAdded, { unixTime, inBytes, outBytes }); Control::Rpc_StatManager_trafficAdded, { unixTime, inBytes, outBytes });
}); });
connect(statManager, &StatManager::appTrafTotalsResetted, rpcManager, connect(statManager, &StatManager::appTrafTotalsResetted, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_StatManager_appTrafTotalsResetted); }); [=] { rpcManager->invokeOnClients(Control::Rpc_StatManager_appTrafTotalsResetted); });
} }

View File

@ -101,20 +101,20 @@ void TaskManagerRpc::setupServerSignals(RpcManager *rpcManager)
{ {
auto taskManager = IoC<TaskManager>(); auto taskManager = IoC<TaskManager>();
connect(taskManager, &TaskManager::taskStarted, rpcManager, [&](qint8 taskType) { connect(taskManager, &TaskManager::taskStarted, rpcManager, [=](qint8 taskType) {
rpcManager->invokeOnClients(Control::Rpc_TaskManager_taskStarted, { 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 }); rpcManager->invokeOnClients(Control::Rpc_TaskManager_taskFinished, { taskType });
}); });
connect(taskManager, &TaskManager::appVersionDownloaded, rpcManager, connect(taskManager, &TaskManager::appVersionDownloaded, rpcManager,
[&](const QString &version) { [=](const QString &version) {
rpcManager->invokeOnClients( rpcManager->invokeOnClients(
Control::Rpc_TaskManager_appVersionDownloaded, { version }); Control::Rpc_TaskManager_appVersionDownloaded, { version });
}); });
connect(taskManager, &TaskManager::zonesDownloaded, rpcManager, connect(taskManager, &TaskManager::zonesDownloaded, rpcManager,
[&](const QStringList &zoneNames) { [=](const QStringList &zoneNames) {
rpcManager->invokeOnClients( rpcManager->invokeOnClients(
Control::Rpc_TaskManager_zonesDownloaded, { zoneNames }); Control::Rpc_TaskManager_zonesDownloaded, { zoneNames });
}); });