Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp-qt-client] Qt progress info #18950

Merged
merged 24 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1afbc5e
Update HttpRequest.cpp.mustache
Jazzco Jun 10, 2024
1d4e78a
add generated files
Jazzco Jun 11, 2024
edcf3d5
Revert "add generated files"
Jazzco Jun 13, 2024
3f60155
catch download progress in HttpRequest and pass it to api
Jazzco Jun 13, 2024
538022e
Update HttpRequest.cpp.mustache - clean mixed in changes
Jazzco Jun 18, 2024
6a8fc09
Update HttpRequest.cpp.mustache - replaced tabs by spaces
Jazzco Jun 18, 2024
b6eb56e
Update api-header.mustache - replaced tabs by spaces
Jazzco Jun 18, 2024
914cfcf
Update HttpRequest.h.mustache - replaced tab by spaces
Jazzco Jun 18, 2024
f344685
Merge branch 'OpenAPITools:master' into qt-progress-info
Jazzco Jun 18, 2024
935d06e
ran step 3 from Linux
Jazzco Jun 18, 2024
647d932
changed downloadProgress to -nickname-DownloadProgress and added it t…
Jazzco Jun 18, 2024
bb00d13
ran step 3
Jazzco Jun 18, 2024
9e91bd6
replaced tab by spaces
Jazzco Jun 18, 2024
e71460e
ran step 3
Jazzco Jun 18, 2024
59075c1
activate tracing to detect link issue
Jazzco Jun 19, 2024
8d01f58
removed redundant connects and encapsulated changes in {{addDownloadP…
Jazzco Jun 20, 2024
901855b
added generated files from step 3
Jazzco Jun 20, 2024
431b98f
remove cli-option for httprequest - this should be always there
Jazzco Jun 20, 2024
d2afeec
added files from step 3
Jazzco Jun 20, 2024
1f0fee0
improved name
Jazzco Jun 20, 2024
ce15124
Update samples-cpp-qt-client.yaml - fix parameter order
Jazzco Jun 24, 2024
9410a41
Update samples-cpp-qt-client.yaml
Jazzco Jun 26, 2024
8488cd4
Merge branch 'OpenAPITools:master' into qt-progress-info
Jazzco Jul 16, 2024
96c9b9c
Merge branch 'OpenAPITools:master' into qt-progress-info
Jazzco Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/samples-cpp-qt-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
tools: ${{ matrix.tools }}
- name: Build
working-directory: "samples/client/petstore/cpp-qt"
run: cmake . && cmake --build .
run: cmake . && cmake --build --trace .
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public:

Q_SIGNALS:
void on_execution_finished({{prefix}}HttpRequestWorker *worker);
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);

private:
enum {{prefix}}CompressionType{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
}
#endif

{{#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]() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,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);
});
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXHttpRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class PFXHttpRequestWorker : public QObject {

Q_SIGNALS:
void on_execution_finished(PFXHttpRequestWorker *worker);
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);

private:
enum PFXCompressionType{
Expand Down
9 changes: 9 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXPetApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ void PFXPetApi::addPet(const PFXPet &pfx_pet) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::addPetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -366,6 +367,7 @@ void PFXPetApi::allPets() {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::allPetsCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -470,6 +472,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const ::test_namespace::Optional
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::deletePetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -670,6 +673,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByStatusCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -880,6 +884,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByTagsCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -1022,6 +1027,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::getPetByIdCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -1102,6 +1108,7 @@ void PFXPetApi::updatePet(const PFXPet &pfx_pet) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -1238,6 +1245,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const ::test_namespace::
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -1374,6 +1382,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const ::test_namespace::Optiona
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXPetApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class PFXPetApi : public QObject {
void updatePetWithFormSignal();
void uploadFileSignal(PFXApiResponse summary);


void addPetSignalFull(PFXHttpRequestWorker *worker);
void allPetsSignalFull(PFXHttpRequestWorker *worker, QSet<PFXPet> summary);
void deletePetSignalFull(PFXHttpRequestWorker *worker);
Expand Down
2 changes: 2 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ void PFXPrimitivesApi::primitivesIntegerPost(const ::test_namespace::OptionalPar
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesIntegerPostCallback);
connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -315,6 +316,7 @@ void PFXPrimitivesApi::primitivesNumberPut(const ::test_namespace::OptionalParam
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesNumberPutCallback);
connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class PFXPrimitivesApi : public QObject {
void primitivesIntegerPostSignal();
void primitivesNumberPutSignal();


void primitivesIntegerPostSignalFull(PFXHttpRequestWorker *worker);
void primitivesNumberPutSignalFull(PFXHttpRequestWorker *worker);

Expand Down
4 changes: 4 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::deleteOrderCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -329,6 +330,7 @@ void PFXStoreApi::getInventory() {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getInventoryCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -427,6 +429,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getOrderByIdCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -507,6 +510,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &pfx_order) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::placeOrderCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXStoreApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString, qint32> summary);
void getOrderByIdSignalFull(PFXHttpRequestWorker *worker, PFXOrder summary);
Expand Down
8 changes: 8 additions & 0 deletions samples/client/petstore/cpp-qt/client/PFXUserApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ void PFXUserApi::createUser(const PFXUser &pfx_user) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUserCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -328,6 +329,7 @@ void PFXUserApi::createUsersWithArrayInput(const QList<PFXUser> &pfx_user) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithArrayInputCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -406,6 +408,7 @@ void PFXUserApi::createUsersWithListInput(const QList<PFXUser> &pfx_user) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithListInputCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -494,6 +497,7 @@ void PFXUserApi::deleteUser(const QString &username) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::deleteUserCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -582,6 +586,7 @@ void PFXUserApi::getUserByName(const QString &username) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::getUserByNameCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -688,6 +693,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::loginUserCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -764,6 +770,7 @@ void PFXUserApi::logoutUser() {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::logoutUserCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down Expand Up @@ -857,6 +864,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &pfx_user) {
}
#endif


connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::updateUserCallback);
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/cpp-qt/client/PFXUserApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class PFXUserApi : public QObject {
void logoutUserSignal();
void updateUserSignal();


void createUserSignalFull(PFXHttpRequestWorker *worker);
void createUsersWithArrayInputSignalFull(PFXHttpRequestWorker *worker);
void createUsersWithListInputSignalFull(PFXHttpRequestWorker *worker);
Expand Down
Loading