From 3b19e10342400cd26a8d60bc525a197c27b8514c 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: Mon, 16 Jan 2023 13:39:09 +0800 Subject: Emits response when attempting to log in --- interchange/member.hxx | 31 +++++++------------------------ member.cxx | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/interchange/member.hxx b/interchange/member.hxx index 2cd9c49..1760860 100644 --- a/interchange/member.hxx +++ b/interchange/member.hxx @@ -32,29 +32,7 @@ namespace QInterchange { Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged) public: - explicit Member(QObject* parent = nullptr) : - QObject{parent}, - m_userName{""}, - m_userNick{""}, - m_password{""}, - m_expiration{""}, - m_acl{""}, - m_modTime{""}, - m_sNickName{""}, - m_company{""}, - m_fName{""}, - m_lName{""}, - m_address1{""}, - m_address2{""}, - m_address3{""}, - m_city{""}, - m_state{""}, - m_zip{""}, - m_country{""}, - m_phoneDay{""}, - m_email{""}, - m_data{nullptr} - {} + Member(QObject* parent = nullptr); ~Member() {} QString const& userName() const { return m_userName; } @@ -97,6 +75,7 @@ namespace QInterchange { void setCountry(QString const& country); void setPhoneDay(QString const& phoneDay); void setEmail(QString const& email); + void setData(interchange_member* data); public slots: void newAccount(QString const& username, @@ -106,6 +85,7 @@ namespace QInterchange { void logIn(QString const& username, QString const& password, QString const& failPage = nullptr); + void account(QString const& firstName, QString const& lastName, QString const& address1, QString const& address2, QString const& city, QString const& state, @@ -116,6 +96,7 @@ namespace QInterchange { void logOut(); signals: + void loggedIn(QString const& response); void userNameChanged(); void userNickChanged(); void passwordChanged(); @@ -136,6 +117,9 @@ namespace QInterchange { void phoneDayChanged(); void emailChanged(); + protected: + void emitLogin(QString const& response); + private: QString m_userName; QString m_userNick; @@ -157,7 +141,6 @@ namespace QInterchange { QString m_phoneDay; QString m_email; interchange_member* m_data; - inline void setData(interchange_member* data); }; } diff --git a/member.cxx b/member.cxx index c38dc32..610d7f0 100644 --- a/member.cxx +++ b/member.cxx @@ -4,8 +4,35 @@ namespace QInterchange { + static Member* member; static char *unCopy, *pwCopy, *vCopy, *fpCopy; + Member::Member(QObject* parent) : + QObject{parent}, + m_userName{""}, + m_userNick{""}, + m_password{""}, + m_expiration{""}, + m_acl{""}, + m_modTime{""}, + m_sNickName{""}, + m_company{""}, + m_fName{""}, + m_lName{""}, + m_address1{""}, + m_address2{""}, + m_address3{""}, + m_city{""}, + m_state{""}, + m_zip{""}, + m_country{""}, + m_phoneDay{""}, + m_email{""}, + m_data{nullptr} + { + member = this; + } + void Member::newAccount(QString const& username, QString const& password, QString const& verify, QString const& failPage) @@ -49,6 +76,7 @@ namespace QInterchange { free(unCopy); free(pwCopy); free(fpCopy); + member->emitLogin(QString{response->data}); interchange_free_response(response); }, nullptr); } @@ -333,4 +361,9 @@ namespace QInterchange { setData(nullptr); } + void Member::emitLogin(QString const& response) + { + emit loggedIn(response); + } + } -- cgit v1.2.3