summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-09 12:11:02 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-09 12:11:02 +0800
commit18cd0a85f48ff6a7cf05311c42c7bb1a39f77988 (patch)
tree77df4f84dc6844511e15cd18380d7aa71fc88f84
parent97dc735de7a67e6be77c0cad5164267b2c39c4c1 (diff)
Order signal
-rw-r--r--interchange.cxx16
-rw-r--r--interchange.hxx2
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);
};
}