diff options
| author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-02-07 15:32:40 +0800 |
|---|---|---|
| committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-02-07 15:32:40 +0800 |
| commit | 2fbcfe27235a0852dce3d0ace748c639495d6092 (patch) | |
| tree | b375181c5ada3888c7701ea3f0d8b94c2801f7db /ord.cxx | |
| parent | 5049587a34347abc57aba06c2a2641931eb173e3 (diff) | |
Send signal carrying possible transaction info
Diffstat (limited to 'ord.cxx')
| -rw-r--r-- | ord.cxx | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -1,9 +1,22 @@ #include <algorithm> #include <memory> +#include "interchange.hxx" #include "interchange/ord.hxx" namespace QInterchange { + static Ord* ord; + + Ord::Ord(QObject* parent) : + QAbstractListModel{parent}, + m_data{nullptr}, + m_subtotal{.0}, + m_shipping{.0}, + m_totalCost{.0} + { + ord = this; + } + int Ord::rowCount(QModelIndex const& parent) const { Q_UNUSED(parent) @@ -81,6 +94,15 @@ namespace QInterchange { void Ord::checkout(Member& member) { - interchange_ord_checkout(m_data, member.data()); + interchange_ord_checkout(m_data, member.data(), + [](interchange_response* response) { + ord->emitTransaction(QString{response->data}); + interchange_free_response(response); + }); + } + + void Ord::emitTransaction(QString const& response) + { + emit gotTransaction(response); } } |