mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Add getters to ScriptStatusRequest
This commit is contained in:
parent
7ba14a5f09
commit
465f5c6789
3 changed files with 15 additions and 10 deletions
|
@ -681,7 +681,7 @@ bool EntityScriptingInterface::getServerScriptStatus(QUuid entityID, QScriptValu
|
|||
auto request = client->createScriptStatusRequest(entityID);
|
||||
connect(request, &GetScriptStatusRequest::finished, callback.engine(), [callback](GetScriptStatusRequest* request) mutable {
|
||||
QString statusString;
|
||||
switch (request->status) {
|
||||
switch (request->getStatus()) {
|
||||
case RUNNING:
|
||||
statusString = "running";
|
||||
break;
|
||||
|
@ -695,7 +695,7 @@ bool EntityScriptingInterface::getServerScriptStatus(QUuid entityID, QScriptValu
|
|||
statusString = "";
|
||||
break;
|
||||
}
|
||||
QScriptValueList args { request->responseReceived, request->isRunning, statusString, request->errorInfo };
|
||||
QScriptValueList args { request->getResponseReceived(), request->getIsRunning(), statusString, request->getErrorInfo() };
|
||||
callback.call(QScriptValue(), args);
|
||||
request->deleteLater();
|
||||
});
|
||||
|
|
|
@ -17,10 +17,10 @@ GetScriptStatusRequest::~GetScriptStatusRequest() {
|
|||
void GetScriptStatusRequest::start() {
|
||||
auto client = DependencyManager::get<EntityScriptClient>();
|
||||
client->getEntityServerScriptStatus(_entityID, [this](bool responseReceived, bool isRunning, EntityScriptStatus status, QString errorInfo) {
|
||||
this->responseReceived = responseReceived;
|
||||
this->isRunning = isRunning;
|
||||
this->status = status;
|
||||
this->errorInfo = errorInfo;
|
||||
responseReceived = responseReceived;
|
||||
isRunning = isRunning;
|
||||
status = status;
|
||||
errorInfo = errorInfo;
|
||||
|
||||
emit finished(this);
|
||||
});
|
||||
|
|
|
@ -32,10 +32,10 @@ public:
|
|||
|
||||
Q_INVOKABLE void start();
|
||||
|
||||
bool responseReceived;
|
||||
bool isRunning;
|
||||
EntityScriptStatus status;
|
||||
QString errorInfo;
|
||||
bool getResponseReceived() const { return _responseReceived; }
|
||||
bool getIsRunning() const { return _isRunning; }
|
||||
EntityScriptStatus getStatus() const { return _status; }
|
||||
QString getErrorInfo() const { return _errorInfo; }
|
||||
|
||||
signals:
|
||||
void finished(GetScriptStatusRequest* request);
|
||||
|
@ -43,6 +43,11 @@ signals:
|
|||
private:
|
||||
QUuid _entityID;
|
||||
MessageID _messageID;
|
||||
|
||||
bool _responseReceived;
|
||||
bool _isRunning;
|
||||
EntityScriptStatus _status;
|
||||
QString _errorInfo;
|
||||
};
|
||||
|
||||
class EntityScriptClient : public QObject, public Dependency {
|
||||
|
|
Loading…
Reference in a new issue