diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-01-11 11:27:08 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-01-11 11:27:08 +0800 |
commit | 64ea94aad7253df25798263d6bd1c8c49ceb393d (patch) | |
tree | fe52659a09601112e10a2f0998f55419b391f9b6 /controller.cxx | |
parent | ebaf4cf23f8ccdbf020309eacc2f9d9129c05f83 (diff) |
Diffstat (limited to 'controller.cxx')
-rw-r--r-- | controller.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/controller.cxx b/controller.cxx index 5bf63e3..877c163 100644 --- a/controller.cxx +++ b/controller.cxx @@ -1,18 +1,18 @@ #include <QtQml> -#include <icclient.h> -#include <qicclient.hxx> +#include <interchange.h> +#include <interchange.hxx> #include "controller.hxx" static QQmlApplicationEngine* engine; static QString* certFile = nullptr; static Controller* controller; -using namespace QICClient; -static Client* shop = nullptr; +using namespace QInterchange; +static Interchange* shop = nullptr; static Catalog* allProducts = nullptr; extern "C" { - void sign_up(char const*, char const*, void (*)(icclient_response*)); - struct icclient_catalog* catalog(char const*, char const*); + void sign_up(char const*, char const*, void (*)(interchange_response*)); + struct interchange_catalog* catalog(char const*, char const*); } Controller::Controller(QObject* parent) : QObject{parent} @@ -38,11 +38,11 @@ void Controller::signUp(QString const& brand) #endif controller = this; sign_up(brand.toLatin1().constData(), certFile ? certFile->toLatin1().constData() : nullptr, - [](icclient_response* response) { + [](interchange_response* response) { const_cast<char*>(response->data)[response->numBytes] = '\0'; QString brand{response->data}; - icclient_free_response(response); - shop = new Client{QString{QString{SECURE_SERVER} % "/" % brand}.toLatin1().constData(), + interchange_free_response(response); + shop = new Interchange{QString{QString{SECURE_SERVER} % "/" % brand}.toLatin1().constData(), QString{"/" % brand % "/images"}.toLatin1().constData(), certFile ? certFile->toLatin1().constData() : nullptr}; if (certFile) delete certFile; @@ -63,7 +63,7 @@ void Controller::link(QString const& brand) void Controller::allProducts(QString const& brand) { - connect(shop, &Client::gotCatalog, [brand](QString const& response) { + connect(shop, &Interchange::gotCatalog, [brand](QString const& response) { ::allProducts = new Catalog{catalog(response.toLatin1().constData(), QString{"/" % brand % "/images"}.toLatin1().constData())}; engine->rootContext()->setContextProperty("catalog", ::allProducts); |