From d6e1d66de6b539b6af4a7f517d84a07f17e75c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sun, 13 Jun 2021 17:49:57 +0800 Subject: gotResults now passes icclient_fetch_t* so the signal can be connected to some slot. --- qicclient.hxx | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'qicclient.hxx') diff --git a/qicclient.hxx b/qicclient.hxx index aa8bca9..a3cc6d0 100644 --- a/qicclient.hxx +++ b/qicclient.hxx @@ -1,5 +1,5 @@ -#ifndef QICCLIENT_CLIENT_HXX -#define QICCLIENT_CLIENT_HXX +#ifndef QICCLIENT_HXX +#define QICCLIENT_HXX #include #include @@ -8,7 +8,6 @@ namespace QICClient { using std::shared_ptr; - class Catalog; class Ord; class Client : public QObject @@ -23,29 +22,13 @@ namespace QICClient { */ Client(char const* url, char const* certificate = nullptr); ~Client(); - - /*! - * \brief For fetching products that belong a specific group. - * \param prodGroup The name of the product group. - * \param handler A pointer to a cURL write function callback. - */ - void results(QString const& prodGroup, icclient_handler handler = nullptr); - - /*! - * \brief For fetching data about all active products. - * \param handler A pointer to a cURL write function callback. - */ - void allProducts(icclient_handler handler = nullptr); - - void emitCatalog(icclient_catalog *catalog); - + void emitResults(icclient_fetch_t* fetch); /*! * \brief For fetching data about a specific product. * \param sku The SKU of the item to order. * \param handler A pointer to a cURL write function callback. */ - void flyPage(QString const& sku, icclient_handler handler); - + void flyPage(QString const& sku, void (*handler)(icclient_fetch_t*)); /*! * \brief For putting an item to a cart. * \param sku The SKU of the item to order. @@ -54,8 +37,19 @@ namespace QICClient { */ void order(QString const& sku, Catalog const& catalog, Ord& order); + public slots: + /*! + * \brief For fetching products that belong a specific group. + * \param prodGroup The name of the product group. + */ + void results(QString const& prodGroup); + /*! + * \brief For fetching data about all active products. + */ + void allProducts(); + signals: - void gotResults(Catalog* catalog); + void gotResults(icclient_fetch_t* fetch); void gotFlyPage(shared_ptr product); }; -- cgit v1.2.3