From 35a99ff13a6b656362b61dc37ddba40dd9be1927 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, 17 Jun 2021 21:47:32 +0800 Subject: Conform to updated libicclient login interfaces --- admin.cxx | 6 ++---- client.cxx | 8 ++------ member.cxx | 6 ++---- qicclient/admin.hxx | 6 ++---- qicclient/member.hxx | 3 +-- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/admin.cxx b/admin.cxx index 6fad89f..c15b3c5 100644 --- a/admin.cxx +++ b/admin.cxx @@ -5,11 +5,9 @@ namespace QICClient { - std::shared_ptr Admin::logIn(QString const& username, QString const& password, void (*handler)(icclient_fetch_t *)) + void Admin::logIn(QString const& username, QString const& password) { - auto admin = new Admin{}; - admin->setData(icclient_admin_login(username.toLatin1().constData(), password.toLatin1().constData(), handler)); - return std::shared_ptr{admin}; + icclient_admin_login(username.toLatin1().constData(), password.toLatin1().constData(), nullptr, nullptr); } void Admin::setUserName(QString const& userName) diff --git a/client.cxx b/client.cxx index a37ba01..5b1858e 100644 --- a/client.cxx +++ b/client.cxx @@ -32,9 +32,7 @@ namespace QICClient { void Client::results(QString const& prodGroup) { - icclient_results(prodGroup.toLatin1().constData(), handleResults, [](icclient_catalog* catalog) { - icclient_free_catalog(catalog); - }); + icclient_results(prodGroup.toLatin1().constData(), handleResults, nullptr); } /* void Client::results(QString const& prodGroup, void (*handler)(icclient_fetch_t*)) @@ -44,9 +42,7 @@ namespace QICClient { */ void Client::allProducts() { - icclient_allproducts(handleResults, [](icclient_catalog* catalog) { - icclient_free_catalog(catalog); - }); + icclient_allproducts(handleResults, nullptr); } void Client::allproducts(void (*handler)(icclient_fetch_t* fetch)) diff --git a/member.cxx b/member.cxx index 545d77d..4498bcc 100644 --- a/member.cxx +++ b/member.cxx @@ -5,11 +5,9 @@ namespace QICClient { - std::shared_ptr Member::logIn(QString const& username, QString const& password, void (*handler)(icclient_fetch_t *)) + void Member::logIn(QString const& username, QString const& password) { - auto member = new Member{}; - member->setData(icclient_member_login(username.toLatin1().constData(), password.toLatin1().constData(), handler)); - return std::shared_ptr{member}; + icclient_member_login(username.toLatin1().constData(), password.toLatin1().constData(), nullptr, nullptr); } void Member::setUserName(QString const& userName) diff --git a/qicclient/admin.hxx b/qicclient/admin.hxx index b93ea2a..b9bf428 100644 --- a/qicclient/admin.hxx +++ b/qicclient/admin.hxx @@ -27,9 +27,6 @@ namespace QICClient { m_data{nullptr} {} ~Admin() {} - static std::shared_ptr logIn(QString const& username, QString const& password, - void (*handler)(icclient_fetch_t *) = nullptr); - QString const& userName() const { return m_userName; } QString const& password() const { return m_password; } QString const& name() const { return m_name; } @@ -41,6 +38,7 @@ namespace QICClient { void setSuper(bool super); public slots: + void logIn(QString const& username, QString const& password); void newAdmin(QString const& userName, QString const& password, QString const& name, bool super, enum icclient_admin_group group); void newItem(QString const& description, QString const& comment, QString const& price, @@ -64,4 +62,4 @@ namespace QICClient { } -#endif // QICCLIENT_ADMIN_HXX +#endif diff --git a/qicclient/member.hxx b/qicclient/member.hxx index b5e1f5b..6382434 100644 --- a/qicclient/member.hxx +++ b/qicclient/member.hxx @@ -57,8 +57,6 @@ namespace QICClient { m_data{nullptr} {} ~Member() {} - static std::shared_ptr logIn(QString const& username, QString const& password, - void (*handler)(icclient_fetch_t *) = nullptr); QString const& userName() const { return m_userName; } QString const& userNick() const { return m_userNick; } @@ -102,6 +100,7 @@ namespace QICClient { void setEmail(QString const& email); public slots: + void logIn(QString const& username, QString const& password); void account(QString const& firstName, QString const& lastName, QString const& address1, QString const& address2, QString const& city, QString const& state, -- cgit v1.2.3