summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-14 10:36:56 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-14 10:36:56 +0800
commitc7437e1a93fc9ee7ab466aafe393daf967f3771c (patch)
tree7c1ef25ce7e1701dac8f5c71f55cd1ec4ab1a8b5
parenteaee50219505ff98d8758c0ef3d3c26b4593728b (diff)
Requested path on flypage signal
as flypage is generic, so the caller will need to know the context.
-rw-r--r--interchange.cxx10
-rw-r--r--interchange.hxx6
2 files changed, 11 insertions, 5 deletions
diff --git a/interchange.cxx b/interchange.cxx
index c9faf1f..ead53ce 100644
--- a/interchange.cxx
+++ b/interchange.cxx
@@ -4,6 +4,7 @@
namespace QInterchange {
static Interchange* interchange;
+ static const QString* currentPath;
Interchange::Interchange(const char* sampleURL, const char* image_Dir,
const QString& cookie, const QString& certificate)
@@ -23,9 +24,11 @@ namespace QInterchange {
void Interchange::flypage(QString const& path)
{
+ currentPath = &path;
interchange_flypage(path.toLatin1().constData(),
[](interchange_response* response) {
- interchange->emitFlypage(QString{response->data});
+ interchange->emitFlypage(*currentPath,
+ QString{response->data});
interchange_free_response(response);
});
}
@@ -63,9 +66,10 @@ namespace QInterchange {
defaultCatalog("All-Products");
}
- void Interchange::emitFlypage(QString const& response)
+ void Interchange::emitFlypage(QString const& path,
+ QString const& response)
{
- emit gotFlypage(response);
+ emit gotFlypage(path, response);
}
void Interchange::emitCatalog(QString const& response)
diff --git a/interchange.hxx b/interchange.hxx
index ae5d5e8..10e3ad5 100644
--- a/interchange.hxx
+++ b/interchange.hxx
@@ -66,13 +66,15 @@ namespace QInterchange {
void order(QString const& sku);
signals:
- void gotFlypage(QString const& response);
+ void gotFlypage(QString const& path,
+ QString const& response);
void gotCatalog(QString const& response);
void gotProduct(QString const& response);
void gotOrder(QString const& response);
protected:
- void emitFlypage(QString const& response);
+ void emitFlypage(QString const& path,
+ QString const& response);
void emitCatalog(QString const& response);
void emitProduct(QString const& response);
void emitOrder(QString const& response);