diff --git a/.github/workflows/samples-cpp-qt-client.yaml b/.github/workflows/samples-cpp-qt-client.yaml index b885f4dbe7cd..44dacd8fe709 100644 --- a/.github/workflows/samples-cpp-qt-client.yaml +++ b/.github/workflows/samples-cpp-qt-client.yaml @@ -30,4 +30,4 @@ jobs: target: "desktop" - name: Build working-directory: "samples/client/petstore/cpp-qt" - run: cmake . && cmake --build . + run: cmake . && cmake --build . --verbose diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache index d5aa5f863e63..b6469763e2bd 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache @@ -372,6 +372,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { } if (reply != nullptr) { reply->setParent(this); + connect(reply, &QNetworkReply::downloadProgress, this, &{{prefix}}HttpRequestWorker::downloadProgress); connect(reply, &QNetworkReply::finished, [this, reply] { on_reply_finished(reply); }); diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache index 660ef7590503..1ec374f90f89 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache @@ -72,6 +72,7 @@ public: Q_SIGNALS: void on_execution_finished({{prefix}}HttpRequestWorker *worker); + void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); private: enum {{prefix}}CompressionType{ diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache index 56e90e5c4799..6e4bb4743fe1 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache @@ -660,6 +660,8 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} input.headers.insert(keyValueIt->first, keyValueIt->second); } +{{#addDownloadProgress}} + connect(worker, &{{prefix}}HttpRequestWorker::downloadProgress, this, &{{classname}}::{{nickname}}Progress);{{/addDownloadProgress}} connect(worker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback); connect(this, &{{classname}}::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-header.mustache index faa0bd472739..5391f6a6b057 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-header.mustache @@ -88,6 +88,8 @@ private: Q_SIGNALS: {{#operations}}{{#operation}} void {{nickname}}Signal({{#returnType}}{{{.}}} summary{{/returnType}});{{/operation}}{{/operations}} +{{#operations}}{{#operation}}{{#addDownloadProgress}} + void {{nickname}}Progress(qint64 bytesReceived, qint64 bytesTotal);{{/addDownloadProgress}}{{/operation}}{{/operations}} {{#operations}}{{#operation}} void {{nickname}}SignalFull({{prefix}}HttpRequestWorker *worker{{#returnType}}, {{{.}}} summary{{/returnType}});{{/operation}}{{/operations}} {{#operations}}{{#operation}} diff --git a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp index 40d869cfaf6a..4e36e7a596f0 100644 --- a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp @@ -379,6 +379,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { } if (reply != nullptr) { reply->setParent(this); + connect(reply, &QNetworkReply::downloadProgress, this, &PFXHttpRequestWorker::downloadProgress); connect(reply, &QNetworkReply::finished, [this, reply] { on_reply_finished(reply); }); diff --git a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h index 8d9656ed8675..e44027c91c14 100644 --- a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h +++ b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h @@ -80,6 +80,7 @@ class PFXHttpRequestWorker : public QObject { Q_SIGNALS: void on_execution_finished(PFXHttpRequestWorker *worker); + void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); private: enum PFXCompressionType{ diff --git a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp index 298c9458a8e7..5084e4f4deaf 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp @@ -240,6 +240,7 @@ void PFXPetApi::addPet(const PFXPet &pfx_pet) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::addPetCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -348,6 +349,7 @@ void PFXPetApi::allPets() { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::allPetsCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -446,6 +448,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const ::test_namespace::Optional input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::deletePetCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -640,6 +643,7 @@ void PFXPetApi::findPetsByStatus(const QList &status) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByStatusCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -844,6 +848,7 @@ void PFXPetApi::findPetsByTags(const QList &tags) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByTagsCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -980,6 +985,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::getPetByIdCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -1054,6 +1060,7 @@ void PFXPetApi::updatePet(const PFXPet &pfx_pet) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -1184,6 +1191,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const ::test_namespace:: input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -1314,6 +1322,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const ::test_namespace::Optiona input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { diff --git a/samples/client/petstore/cpp-qt/client/PFXPetApi.h b/samples/client/petstore/cpp-qt/client/PFXPetApi.h index ba85ac3b95e9..42d40f1735fd 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPetApi.h +++ b/samples/client/petstore/cpp-qt/client/PFXPetApi.h @@ -152,6 +152,7 @@ class PFXPetApi : public QObject { void updatePetWithFormSignal(); void uploadFileSignal(PFXApiResponse summary); + void addPetSignalFull(PFXHttpRequestWorker *worker); void allPetsSignalFull(PFXHttpRequestWorker *worker, QSet summary); void deletePetSignalFull(PFXHttpRequestWorker *worker); diff --git a/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp b/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp index 143ad71ca044..5836fc875527 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp @@ -225,6 +225,7 @@ void PFXPrimitivesApi::primitivesIntegerPost(const ::test_namespace::OptionalPar input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesIntegerPostCallback); connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -297,6 +298,7 @@ void PFXPrimitivesApi::primitivesNumberPut(const ::test_namespace::OptionalParam input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesNumberPutCallback); connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { diff --git a/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.h b/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.h index 7ecebdef01d9..64de9e41430b 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.h +++ b/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.h @@ -96,6 +96,7 @@ class PFXPrimitivesApi : public QObject { void primitivesIntegerPostSignal(); void primitivesNumberPutSignal(); + void primitivesIntegerPostSignalFull(PFXHttpRequestWorker *worker); void primitivesNumberPutSignalFull(PFXHttpRequestWorker *worker); diff --git a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp index 646715359362..b8f9698839b0 100644 --- a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp @@ -239,6 +239,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::deleteOrderCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -311,6 +312,7 @@ void PFXStoreApi::getInventory() { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getInventoryCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -403,6 +405,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getOrderByIdCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -477,6 +480,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &pfx_order) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::placeOrderCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { diff --git a/samples/client/petstore/cpp-qt/client/PFXStoreApi.h b/samples/client/petstore/cpp-qt/client/PFXStoreApi.h index a9ac689d36d0..0966e3f00d6c 100644 --- a/samples/client/petstore/cpp-qt/client/PFXStoreApi.h +++ b/samples/client/petstore/cpp-qt/client/PFXStoreApi.h @@ -110,6 +110,7 @@ class PFXStoreApi : public QObject { void getOrderByIdSignal(PFXOrder summary); void placeOrderSignal(PFXOrder summary); + void deleteOrderSignalFull(PFXHttpRequestWorker *worker); void getInventorySignalFull(PFXHttpRequestWorker *worker, QMap summary); void getOrderByIdSignalFull(PFXHttpRequestWorker *worker, PFXOrder summary); diff --git a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp index d404aeb17694..560da635bf00 100644 --- a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp @@ -238,6 +238,7 @@ void PFXUserApi::createUser(const PFXUser &pfx_user) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -310,6 +311,7 @@ void PFXUserApi::createUsersWithArrayInput(const QList &pfx_user) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithArrayInputCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -382,6 +384,7 @@ void PFXUserApi::createUsersWithListInput(const QList &pfx_user) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithListInputCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -464,6 +467,7 @@ void PFXUserApi::deleteUser(const QString &username) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::deleteUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -546,6 +550,7 @@ void PFXUserApi::getUserByName(const QString &username) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::getUserByNameCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -646,6 +651,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::loginUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -716,6 +722,7 @@ void PFXUserApi::logoutUser() { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::logoutUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { @@ -803,6 +810,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &pfx_user) { input.headers.insert(keyValueIt->first, keyValueIt->second); } + connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::updateUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); connect(worker, &QObject::destroyed, this, [this]() { diff --git a/samples/client/petstore/cpp-qt/client/PFXUserApi.h b/samples/client/petstore/cpp-qt/client/PFXUserApi.h index 552a683e142e..29bfe7159715 100644 --- a/samples/client/petstore/cpp-qt/client/PFXUserApi.h +++ b/samples/client/petstore/cpp-qt/client/PFXUserApi.h @@ -139,6 +139,7 @@ class PFXUserApi : public QObject { void logoutUserSignal(); void updateUserSignal(); + void createUserSignalFull(PFXHttpRequestWorker *worker); void createUsersWithArrayInputSignalFull(PFXHttpRequestWorker *worker); void createUsersWithListInputSignalFull(PFXHttpRequestWorker *worker);