From 552b14eeda6fc65c6246224425a03a4bf1b31154 Mon Sep 17 00:00:00 2001 From: ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ Date: Fri, 27 Sep 2019 08:55:15 +0800 Subject: Adjust with the new allproducts function name --- client.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'client.cxx') diff --git a/client.cxx b/client.cxx index 0443ce3..8e169a2 100644 --- a/client.cxx +++ b/client.cxx @@ -1,3 +1,4 @@ +#include #include #include "qicclient/client.hxx" @@ -13,11 +14,11 @@ namespace ICClient { icclient_cleanup(); } - void Client::productAll(icclient_catalog** catalogptr + void Client::allProducts(icclient_catalog** catalogptr , size_t (*callback)(void*, size_t, size_t, void*)) { - icclient_product_all(catalogptr, callback); - emit gotProductAll(*catalogptr); + icclient_allproducts(catalogptr, callback); + emit gotAllProducts(*catalogptr); } void Client::logIn(QString const& username, QString const& password) -- cgit v1.3 From bffd7c68508f793fc00c7453850668f7c654e1d0 Mon Sep 17 00:00:00 2001 From: ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ Date: Sat, 28 Sep 2019 13:05:03 +0800 Subject: The app should be able to accept the catalog in QICClient's form --- client.cxx | 8 ++++---- qicclient/client.hxx | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'client.cxx') diff --git a/client.cxx b/client.cxx index 8e169a2..4e832ce 100644 --- a/client.cxx +++ b/client.cxx @@ -14,11 +14,11 @@ namespace ICClient { icclient_cleanup(); } - void Client::allProducts(icclient_catalog** catalogptr - , size_t (*callback)(void*, size_t, size_t, void*)) + void Client::allProducts(size_t (*handler)(void*, size_t, size_t, void*)) { - icclient_allproducts(catalogptr, callback); - emit gotAllProducts(*catalogptr); + icclient_catalog* catalog = nullptr; + icclient_allproducts(&catalog, handler); + emit gotAllProducts(catalog); } void Client::logIn(QString const& username, QString const& password) diff --git a/qicclient/client.hxx b/qicclient/client.hxx index a8b50f4..bccd665 100644 --- a/qicclient/client.hxx +++ b/qicclient/client.hxx @@ -17,8 +17,7 @@ namespace ICClient { Client(char const* url, char const* certificate = nullptr); ~Client(); - void allProducts(icclient_catalog** catalogptr - , size_t (*callback)(void* contents + void allProducts(size_t (*handler)(void* contents , size_t size, size_t nmemb , void* userdata)); -- cgit v1.3 From 73851e44295b0a1e1963689036a0f60c4cbb8330 Mon Sep 17 00:00:00 2001 From: ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ Date: Sat, 28 Sep 2019 15:54:09 +0800 Subject: Client triggers catalog to update directly since getting all products would only be good for catalog. Besides, emitting there seems to cause crash somehow. --- client.cxx | 6 ++++-- qicclient/client.hxx | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'client.cxx') diff --git a/client.cxx b/client.cxx index 4e832ce..168a0fc 100644 --- a/client.cxx +++ b/client.cxx @@ -14,11 +14,13 @@ namespace ICClient { icclient_cleanup(); } - void Client::allProducts(size_t (*handler)(void*, size_t, size_t, void*)) + void Client::allProducts(Catalog* qCatalog, size_t (*handler)(void*, size_t + , size_t, void*)) { icclient_catalog* catalog = nullptr; icclient_allproducts(&catalog, handler); - emit gotAllProducts(catalog); + if (catalog) qCatalog->update(catalog); + icclient_product_freecatalog(catalog); } void Client::logIn(QString const& username, QString const& password) diff --git a/qicclient/client.hxx b/qicclient/client.hxx index bccd665..5531d53 100644 --- a/qicclient/client.hxx +++ b/qicclient/client.hxx @@ -3,8 +3,8 @@ #include #include +#include "catalog.hxx" -struct icclient_catalog; struct icclient_order; namespace ICClient { @@ -17,7 +17,8 @@ namespace ICClient { Client(char const* url, char const* certificate = nullptr); ~Client(); - void allProducts(size_t (*handler)(void* contents + void allProducts(Catalog* catalog + , size_t (*handler)(void* contents , size_t size, size_t nmemb , void* userdata)); @@ -52,7 +53,6 @@ namespace ICClient { */ signals: - void gotAllProducts(icclient_catalog* catalog); void ordered(icclient_order* order); void loggedIn(QString const& userName); void loggedOut(); -- cgit v1.3 From 0640cec9e13edd30b85c50da9943f6fb56aec0df Mon Sep 17 00:00:00 2001 From: ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ Date: Sun, 29 Sep 2019 07:40:23 +0800 Subject: Revert "Client triggers catalog to update directly" This reverts commit 73851e44295b0a1e1963689036a0f60c4cbb8330. --- client.cxx | 6 ++---- qicclient/client.hxx | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'client.cxx') diff --git a/client.cxx b/client.cxx index 168a0fc..4e832ce 100644 --- a/client.cxx +++ b/client.cxx @@ -14,13 +14,11 @@ namespace ICClient { icclient_cleanup(); } - void Client::allProducts(Catalog* qCatalog, size_t (*handler)(void*, size_t - , size_t, void*)) + void Client::allProducts(size_t (*handler)(void*, size_t, size_t, void*)) { icclient_catalog* catalog = nullptr; icclient_allproducts(&catalog, handler); - if (catalog) qCatalog->update(catalog); - icclient_product_freecatalog(catalog); + emit gotAllProducts(catalog); } void Client::logIn(QString const& username, QString const& password) diff --git a/qicclient/client.hxx b/qicclient/client.hxx index 5531d53..bccd665 100644 --- a/qicclient/client.hxx +++ b/qicclient/client.hxx @@ -3,8 +3,8 @@ #include #include -#include "catalog.hxx" +struct icclient_catalog; struct icclient_order; namespace ICClient { @@ -17,8 +17,7 @@ namespace ICClient { Client(char const* url, char const* certificate = nullptr); ~Client(); - void allProducts(Catalog* catalog - , size_t (*handler)(void* contents + void allProducts(size_t (*handler)(void* contents , size_t size, size_t nmemb , void* userdata)); @@ -53,6 +52,7 @@ namespace ICClient { */ signals: + void gotAllProducts(icclient_catalog* catalog); void ordered(icclient_order* order); void loggedIn(QString const& userName); void loggedOut(); -- cgit v1.3 From 0f63d288930a71e9705ce1b48a5e0036a9161b52 Mon Sep 17 00:00:00 2001 From: ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ Date: Sun, 29 Sep 2019 08:51:06 +0800 Subject: Swap allproducts arguments --- client.cxx | 2 +- libicclient | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'client.cxx') diff --git a/client.cxx b/client.cxx index 4e832ce..7ffe780 100644 --- a/client.cxx +++ b/client.cxx @@ -17,7 +17,7 @@ namespace ICClient { void Client::allProducts(size_t (*handler)(void*, size_t, size_t, void*)) { icclient_catalog* catalog = nullptr; - icclient_allproducts(&catalog, handler); + icclient_allproducts(handler, &catalog); emit gotAllProducts(catalog); } diff --git a/libicclient b/libicclient index 7a7ad88..685d975 160000 --- a/libicclient +++ b/libicclient @@ -1 +1 @@ -Subproject commit 7a7ad88f83b343c8185006182ff2a8ebf8a94b5c +Subproject commit 685d975434d9311e5afebe9f933509f8bb2ad619 -- cgit v1.3