From 18cd0a85f48ff6a7cf05311c42c7bb1a39f77988 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: Thu, 9 Mar 2023 12:11:02 +0800 Subject: Order signal --- interchange.cxx | 16 +++++++++++++--- interchange.hxx | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/interchange.cxx b/interchange.cxx index 5b39309..f0141d6 100644 --- a/interchange.cxx +++ b/interchange.cxx @@ -73,11 +73,21 @@ namespace QInterchange { emit gotPage(response); } - void Interchange::order(QString const& sku, Catalog const& catalog, Ord& order) + void Interchange::emitOrder(QString const& response) + { + emit gotOrder(response); + } + + void Interchange::order(QString const& sku, Catalog const& catalog, + Ord& order) { auto c_order = order.data(); - interchange_ord_order(sku.toLatin1().constData(), catalog.constData(), &c_order); + interchange_ord_order(sku.toLatin1().constData(), + catalog.constData(), &c_order, + [](interchange_response* response) { + interchange->emitOrder(QString{response->data}); + interchange_free_response(response); + }); order.setData(c_order); } - } diff --git a/interchange.hxx b/interchange.hxx index 4de1618..4b4f44c 100644 --- a/interchange.hxx +++ b/interchange.hxx @@ -70,11 +70,13 @@ namespace QInterchange { void gotCatalog(QString const& response); void gotProduct(QString const& response); void gotPage(QString const& response); + void gotOrder(QString const& response); protected: void emitCatalog(QString const& response); void emitProduct(QString const& response); void emitPage(QString const& response); + void emitOrder(QString const& response); }; } -- cgit v1.2.3