From 5607c8dbc6ba69f17b12579f7aad8cb028e33ce4 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 30 Aug 2019 15:41:40 +0800 Subject: Made the user class members more straightforward using rtclient's rt_user members. --- user.hxx | 57 +++++++++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 38 deletions(-) (limited to 'user.hxx') diff --git a/user.hxx b/user.hxx index 1cac5fe..98d5f68 100644 --- a/user.hxx +++ b/user.hxx @@ -2,8 +2,7 @@ #define USER_HXX #include - -struct rt_user; +#include "rtuser.h" class User : public QObject { @@ -34,25 +33,23 @@ class User : public QObject {} ~User() {} - Q_INVOKABLE void update(rt_user* user); - - QString const& name() const { return m_name; } - QString const& emailAddress() const { return m_emailAddress; } - QString const& organization() const { return m_organization; } - QString const& realName() const { return m_realName; } - QString const& nickName() const { return m_nickName; } - QString const& lang() const { return m_lang; } - QString const& homePhone() const { return m_homePhone; } - QString const& workPhone() const { return m_workPhone; } - QString const& mobilePhone() const { return m_mobilePhone; } - QString const& pagerPhone() const { return m_pagerPhone; } - QString const& address1() const { return m_address1; } - QString const& address2() const { return m_address2; } - QString const& city() const { return m_city; } - QString const& state() const { return m_state; } - QString const& zip() const { return m_zip; } - QString const& country() const { return m_country; } - QString const& timeZone() const { return m_timeZone; } + QString const name() const { return QString{m_user.name}; } + QString const emailAddress() const { return QString{m_user.emailaddress}; } + QString const organization() const { return QString{m_user.organization}; } + QString const realName() const { return QString{m_user.realname}; } + QString const nickName() const { return QString{m_user.nickname}; } + QString const lang() const { return QString{m_user.lang}; } + QString const homePhone() const { return QString{m_user.homephone}; } + QString const workPhone() const { return QString{m_user.workphone}; } + QString const mobilePhone() const { return QString{m_user.mobilephone}; } + QString const pagerPhone() const { return QString{m_user.pagerphone}; } + QString const address1() const { return QString{m_user.address1}; } + QString const address2() const { return QString{m_user.address2}; } + QString const city() const { return QString{m_user.city}; } + QString const state() const { return QString{m_user.state}; } + QString const zip() const { return QString{m_user.zip}; } + QString const country() const { return QString{m_user.country}; } + QString const timeZone() const { return QString{m_user.timezone}; } bool isLoggedIn() const { return m_isLoggedIn; } void setName(QString const& name); @@ -95,23 +92,7 @@ class User : public QObject void loggedInChanged(); private: - QString m_name; - QString m_emailAddress; - QString m_organization; - QString m_realName; - QString m_nickName; - QString m_lang; - QString m_homePhone; - QString m_workPhone; - QString m_mobilePhone; - QString m_pagerPhone; - QString m_address1; - QString m_address2; - QString m_city; - QString m_state; - QString m_zip; - QString m_country; - QString m_timeZone; + rt_user m_user; bool m_isLoggedIn; }; -- cgit v1.2.3 From b4f44ef2d55f42764fb599e67680f5f45bf7f20c Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 30 Aug 2019 16:22:54 +0800 Subject: Revert "Made the user class members more straightforward" This reverts commit 5607c8dbc6ba69f17b12579f7aad8cb028e33ce4. On second thought, for now we don't need to use rtclient's user struct yet, to be more memory efficient with the members QString instantiations. --- user.hxx | 57 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'user.hxx') diff --git a/user.hxx b/user.hxx index 98d5f68..1cac5fe 100644 --- a/user.hxx +++ b/user.hxx @@ -2,7 +2,8 @@ #define USER_HXX #include -#include "rtuser.h" + +struct rt_user; class User : public QObject { @@ -33,23 +34,25 @@ class User : public QObject {} ~User() {} - QString const name() const { return QString{m_user.name}; } - QString const emailAddress() const { return QString{m_user.emailaddress}; } - QString const organization() const { return QString{m_user.organization}; } - QString const realName() const { return QString{m_user.realname}; } - QString const nickName() const { return QString{m_user.nickname}; } - QString const lang() const { return QString{m_user.lang}; } - QString const homePhone() const { return QString{m_user.homephone}; } - QString const workPhone() const { return QString{m_user.workphone}; } - QString const mobilePhone() const { return QString{m_user.mobilephone}; } - QString const pagerPhone() const { return QString{m_user.pagerphone}; } - QString const address1() const { return QString{m_user.address1}; } - QString const address2() const { return QString{m_user.address2}; } - QString const city() const { return QString{m_user.city}; } - QString const state() const { return QString{m_user.state}; } - QString const zip() const { return QString{m_user.zip}; } - QString const country() const { return QString{m_user.country}; } - QString const timeZone() const { return QString{m_user.timezone}; } + Q_INVOKABLE void update(rt_user* user); + + QString const& name() const { return m_name; } + QString const& emailAddress() const { return m_emailAddress; } + QString const& organization() const { return m_organization; } + QString const& realName() const { return m_realName; } + QString const& nickName() const { return m_nickName; } + QString const& lang() const { return m_lang; } + QString const& homePhone() const { return m_homePhone; } + QString const& workPhone() const { return m_workPhone; } + QString const& mobilePhone() const { return m_mobilePhone; } + QString const& pagerPhone() const { return m_pagerPhone; } + QString const& address1() const { return m_address1; } + QString const& address2() const { return m_address2; } + QString const& city() const { return m_city; } + QString const& state() const { return m_state; } + QString const& zip() const { return m_zip; } + QString const& country() const { return m_country; } + QString const& timeZone() const { return m_timeZone; } bool isLoggedIn() const { return m_isLoggedIn; } void setName(QString const& name); @@ -92,7 +95,23 @@ class User : public QObject void loggedInChanged(); private: - rt_user m_user; + QString m_name; + QString m_emailAddress; + QString m_organization; + QString m_realName; + QString m_nickName; + QString m_lang; + QString m_homePhone; + QString m_workPhone; + QString m_mobilePhone; + QString m_pagerPhone; + QString m_address1; + QString m_address2; + QString m_city; + QString m_state; + QString m_zip; + QString m_country; + QString m_timeZone; bool m_isLoggedIn; }; -- cgit v1.2.3 From b15e02739052557480bc272920f251cc4eed00b0 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 30 Aug 2019 16:26:03 +0800 Subject: Affirming the previous commit --- user.hxx | 4 ---- 1 file changed, 4 deletions(-) (limited to 'user.hxx') diff --git a/user.hxx b/user.hxx index 1cac5fe..36ade7e 100644 --- a/user.hxx +++ b/user.hxx @@ -3,8 +3,6 @@ #include -struct rt_user; - class User : public QObject { Q_OBJECT @@ -34,8 +32,6 @@ class User : public QObject {} ~User() {} - Q_INVOKABLE void update(rt_user* user); - QString const& name() const { return m_name; } QString const& emailAddress() const { return m_emailAddress; } QString const& organization() const { return m_organization; } -- cgit v1.2.3 From 014d9ca7e0cdc1ef4b633a28ba9befddb2951179 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 30 Aug 2019 16:43:48 +0800 Subject: User password member --- user.hxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'user.hxx') diff --git a/user.hxx b/user.hxx index 36ade7e..68abbc7 100644 --- a/user.hxx +++ b/user.hxx @@ -7,6 +7,7 @@ class User : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name) + Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) Q_PROPERTY(QString emailAddress READ emailAddress WRITE setEmailAddress NOTIFY emailAddressChanged) Q_PROPERTY(QString organization READ organization WRITE setOrganization NOTIFY organizationChanged) Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged) @@ -33,6 +34,7 @@ class User : public QObject ~User() {} QString const& name() const { return m_name; } + QString const& password() const { return m_password; } QString const& emailAddress() const { return m_emailAddress; } QString const& organization() const { return m_organization; } QString const& realName() const { return m_realName; } @@ -52,6 +54,7 @@ class User : public QObject bool isLoggedIn() const { return m_isLoggedIn; } void setName(QString const& name); + void setPassword(QString const& password); void setEmailAddress(QString const& emailAddress); void setOrganization(QString const& organization); void setRealName(QString const& realName); @@ -72,6 +75,7 @@ class User : public QObject signals: void nameChanged(); + void passwordChanged(); void emailAddressChanged(); void organizationChanged(); void realNameChanged(); @@ -92,6 +96,7 @@ class User : public QObject private: QString m_name; + QString m_password; QString m_emailAddress; QString m_organization; QString m_realName; -- cgit v1.2.3 From 2235e4736994ae902e6cff167c5550168c0a37bb Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 30 Aug 2019 16:44:05 +0800 Subject: Made user name editable --- user.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user.hxx') diff --git a/user.hxx b/user.hxx index 68abbc7..18dd176 100644 --- a/user.hxx +++ b/user.hxx @@ -6,7 +6,7 @@ class User : public QObject { Q_OBJECT - Q_PROPERTY(QString name READ name) + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) Q_PROPERTY(QString emailAddress READ emailAddress WRITE setEmailAddress NOTIFY emailAddressChanged) Q_PROPERTY(QString organization READ organization WRITE setOrganization NOTIFY organizationChanged) -- cgit v1.2.3