From e36a70f7c4ff03aa0f01e6a9aa297371c3cc699b Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Tue, 11 May 2021 15:04:56 +0300 Subject: [PATCH] UI: RpcManager: Add resultArgs(). --- src/ui/control/controlworker.h | 3 ++- src/ui/rpc/rpcmanager.cpp | 5 +++-- src/ui/rpc/rpcmanager.h | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ui/control/controlworker.h b/src/ui/control/controlworker.h index bc379231..0dc019a6 100644 --- a/src/ui/control/controlworker.h +++ b/src/ui/control/controlworker.h @@ -50,7 +50,7 @@ private: bool readRequestHeader(); -private: +protected: struct RequestHeader { RequestHeader(Control::Command command = Control::CommandNone, bool compressed = false, @@ -76,6 +76,7 @@ private: quint32 m_dataSize : 24; }; +private: bool m_isServiceClient : 1; bool m_isClientValidated : 1; diff --git a/src/ui/rpc/rpcmanager.cpp b/src/ui/rpc/rpcmanager.cpp index cace01d1..2303d336 100644 --- a/src/ui/rpc/rpcmanager.cpp +++ b/src/ui/rpc/rpcmanager.cpp @@ -154,9 +154,9 @@ bool RpcManager::waitResult() return true; } -void RpcManager::sendResult(ControlWorker *w, bool ok) +void RpcManager::sendResult(ControlWorker *w, bool ok, const QVariantList &args) { - w->sendCommand(ok ? Control::Rpc_Result_Ok : Control::Rpc_Result_Error); + w->sendCommand(ok ? Control::Rpc_Result_Ok : Control::Rpc_Result_Error, args); } void RpcManager::invokeOnClients(Control::Command cmd, const QVariantList &args) @@ -196,6 +196,7 @@ bool RpcManager::processCommandRpc( case Control::Rpc_Result_Ok: case Control::Rpc_Result_Error: m_resultCommand = cmd; + m_resultArgs = args; return true; case Control::Rpc_RpcManager_initClient: initClientOnServer(w); diff --git a/src/ui/rpc/rpcmanager.h b/src/ui/rpc/rpcmanager.h index c27f9d8f..e4134042 100644 --- a/src/ui/rpc/rpcmanager.h +++ b/src/ui/rpc/rpcmanager.h @@ -25,6 +25,7 @@ public: explicit RpcManager(FortManager *fortManager, QObject *parent = nullptr); Control::Command resultCommand() const { return m_resultCommand; } + QVariantList resultArgs() const { return m_resultArgs; } FortManager *fortManager() const { return m_fortManager; } FortSettings *settings() const; @@ -42,7 +43,7 @@ public: void invokeOnServer(Control::Command cmd, const QVariantList &args = {}); bool waitResult(); - void sendResult(ControlWorker *w, bool ok); + void sendResult(ControlWorker *w, bool ok, const QVariantList &args = {}); bool processCommandRpc(ControlWorker *w, Control::Command cmd, const QVariantList &args, QString &errorMessage); @@ -67,6 +68,7 @@ private: private: Control::Command m_resultCommand = Control::CommandNone; + QVariantList m_resultArgs; FortManager *m_fortManager = nullptr;