diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2018-03-19 16:49:01 +0100 |
---|---|---|
committer | Antti Hölttä <ahoelttae@luxoft.com> | 2018-03-23 13:38:28 +0000 |
commit | 97ba455a6ba0e41aab384678ebf62c234d85a344 (patch) | |
tree | 84bba9ceaa15fa2b7ad8e95ea656a29d4c3c49fb /src/tools/ivigenerator/templates_frontend | |
parent | a3af38e5f6df4a452f2be22d480faaffe31af908 (diff) |
Use the new QIviPendingReply class in the autogenerator templates
Every method inside a qface file will now return a QIviPendingReply.
This also changes the signature of the QIviVehicleFunctions module
and its backend implementations.
Also updated the window_qml example to make use of the new returned
QIviPendingReplies from the open() and close() calls.
Task-number: QTAUTO-837
Change-Id: Icf8a31fcd94630254f71b0c4fb2e1ef4296591af
Reviewed-by: Antti Hölttä <ahoelttae@luxoft.com>
Diffstat (limited to 'src/tools/ivigenerator/templates_frontend')
4 files changed, 12 insertions, 6 deletions
diff --git a/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl b/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl index 637970e..55874ee 100644 --- a/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl +++ b/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl @@ -55,6 +55,7 @@ {% else %} #include <QtIviCore/QIviFeatureInterface> {% endif %} +#include <QtIviCore/QIviPendingReply> QT_BEGIN_NAMESPACE @@ -81,12 +82,12 @@ public: {% for operation in interface.operations %} {% if interface.tags.config.zoned %} {% if operation.parameters|length %} - virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}, const QString &zone){%if operation.const %} const{% endif %} = 0; + virtual QIviPendingReply<{{operation|return_type}}> {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}, const QString &zone){%if operation.const %} const{% endif %} = 0; {% else %} - virtual {{operation|return_type}} {{operation}}(const QString &zone){%if operation.const %} const{% endif %} = 0; + virtual QIviPendingReply<{{operation|return_type}}> {{operation}}(const QString &zone){%if operation.const %} const{% endif %} = 0; {% endif %} {% else %} - virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){%if operation.const %} const{% endif %} = 0; + virtual QIviPendingReply<{{operation|return_type}}> {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){%if operation.const %} const{% endif %} = 0; {% endif %} {% endfor %} diff --git a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl index f327da4..8dc6002 100644 --- a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl +++ b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl @@ -340,7 +340,7 @@ void {{class}}::{{property|setter_name}}({{ property|parameter_type }}) /*! {{ utils.format_comments(operation.comment) }} */ -{{operation|return_type}} {{class}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){% if operation.const %} const{% endif %} +QIviPendingReply<{{operation|return_type}}> {{class}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){% if operation.const %} const{% endif %} { if ({{class}}BackendInterface *backend = ({{class}}BackendInterface *) this->backend()) @@ -353,7 +353,7 @@ void {{class}}::{{property|setter_name}}({{ property|parameter_type }}) {% else %} return backend->{{operation}}({{operation.parameters|join(', ')}}); {% endif %} - return {{operation|default_type_value}}; + return QIviPendingReply<{{operation|return_type}}>::createFailedReply(); } {% endfor %} diff --git a/src/tools/ivigenerator/templates_frontend/interface.h.tpl b/src/tools/ivigenerator/templates_frontend/interface.h.tpl index 4b07044..9786210 100644 --- a/src/tools/ivigenerator/templates_frontend/interface.h.tpl +++ b/src/tools/ivigenerator/templates_frontend/interface.h.tpl @@ -55,6 +55,7 @@ {% else %} #include <QtIviCore/QIviAbstractFeature> {% endif %} +#include <QtIviCore/QIviPendingReply> QT_BEGIN_NAMESPACE @@ -90,7 +91,7 @@ public: public Q_SLOTS: {% for operation in interface.operations %} - {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){% if operation.const %} const{% endif %}; + QIviPendingReply<{{operation|return_type}}> {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){% if operation.const %} const{% endif %}; {% endfor %} {% for property in interface.properties %} {% if not property.readonly and not property.const %} diff --git a/src/tools/ivigenerator/templates_frontend/module.cpp.tpl b/src/tools/ivigenerator/templates_frontend/module.cpp.tpl index 2408691..ef6e112 100644 --- a/src/tools/ivigenerator/templates_frontend/module.cpp.tpl +++ b/src/tools/ivigenerator/templates_frontend/module.cpp.tpl @@ -48,6 +48,7 @@ {% for struct in module.structs %} #include "{{struct|lower}}model.h" {% endfor %} +#include <QtIviCore/QIviPendingReply> #include <QQmlEngine> #include <QDebug> #include <QDataStream> @@ -108,11 +109,14 @@ void {{class}}::registerTypes() {% for enum in module.enums %} qRegisterMetaType<{{class}}::{{enum|flag_type}}>(); qRegisterMetaTypeStreamOperators<{{class}}::{{enum|flag_type}}>(); + qIviRegisterPendingReplyType<{{class}}::{{enum|flag_type}}>(); {% endfor %} {% for struct in module.structs %} qRegisterMetaType<{{struct}}>(); qRegisterMetaType<{{struct}}Model*>(); qRegisterMetaTypeStreamOperators<{{struct}}>(); + qIviRegisterPendingReplyType<{{struct}}>(); + qIviRegisterPendingReplyType<{{struct}}Model*>(); {% endfor %} } |