UI: RpcManager: Add resultArgs().

This commit is contained in:
Nodir Temirkhodjaev 2021-05-11 15:04:56 +03:00
parent e578f2b562
commit e36a70f7c4
3 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;