UI: AutoUpdateManager: Installer will be started only from UI

This commit is contained in:
Nodir Temirkhodjaev 2024-04-23 16:17:08 +03:00
parent a545d1ba71
commit 8dcd489fb2
3 changed files with 22 additions and 2 deletions

View File

@ -99,7 +99,7 @@ bool AutoUpdateManager::runInstaller()
if (!settings->hasService()) { if (!settings->hasService()) {
args << "/AUTORUN"; args << "/AUTORUN";
} else if (settings->isService()) { } else {
emit restartClients(); emit restartClients();
} }

View File

@ -9,6 +9,13 @@ AutoUpdateManagerRpc::AutoUpdateManagerRpc(const QString &cachePath, QObject *pa
{ {
} }
void AutoUpdateManagerRpc::setUp()
{
AutoUpdateManager::setUp();
setupClientSignals();
}
bool AutoUpdateManagerRpc::processServerCommand(const ProcessCommandArgs &p, bool AutoUpdateManagerRpc::processServerCommand(const ProcessCommandArgs &p,
QVariantList & /*resArgs*/, bool & /*ok*/, bool & /*isSendResult*/) QVariantList & /*resArgs*/, bool & /*ok*/, bool & /*isSendResult*/)
{ {
@ -29,5 +36,13 @@ void AutoUpdateManagerRpc::setupServerSignals(RpcManager *rpcManager)
auto autoUpdateManager = IoC<AutoUpdateManager>(); auto autoUpdateManager = IoC<AutoUpdateManager>();
connect(autoUpdateManager, &AutoUpdateManager::restartClients, rpcManager, connect(autoUpdateManager, &AutoUpdateManager::restartClients, rpcManager,
[&] { rpcManager->invokeOnClients(Control::Rpc_AutoUpdateManager_restartClients); }); [=] { rpcManager->invokeOnClients(Control::Rpc_AutoUpdateManager_restartClients); });
}
void AutoUpdateManagerRpc::setupClientSignals()
{
auto rpcManager = IoCDependency<RpcManager>();
connect(this, &AutoUpdateManager::restartClients, rpcManager,
[=] { rpcManager->invokeOnServer(Control::Rpc_AutoUpdateManager_restartClients); });
} }

View File

@ -14,10 +14,15 @@ class AutoUpdateManagerRpc : public AutoUpdateManager
public: public:
explicit AutoUpdateManagerRpc(const QString &cachePath, QObject *parent = nullptr); explicit AutoUpdateManagerRpc(const QString &cachePath, QObject *parent = nullptr);
void setUp() override;
static bool processServerCommand( static bool processServerCommand(
const ProcessCommandArgs &p, QVariantList &resArgs, bool &ok, bool &isSendResult); const ProcessCommandArgs &p, QVariantList &resArgs, bool &ok, bool &isSendResult);
static void setupServerSignals(RpcManager *rpcManager); static void setupServerSignals(RpcManager *rpcManager);
private:
void setupClientSignals();
}; };
#endif // AUTOUPDATEMANAGERRPC_H #endif // AUTOUPDATEMANAGERRPC_H