diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-01 06:52:42 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-01 06:52:42 +0800 |
commit | d82340151ce274930f42701f5a9a0c4db702cba4 (patch) | |
tree | ccae79c6970d5650768b22b88a37aa18510e4805 /qicclient | |
parent | 451437641aee7771b97ac5e54e1543a2510ce17a (diff) | |
parent | 0f63d288930a71e9705ce1b48a5e0036a9161b52 (diff) |
Merge branch 'master' into cmake
Diffstat (limited to 'qicclient')
-rw-r--r-- | qicclient/catalog.hxx | 6 | ||||
-rw-r--r-- | qicclient/client.hxx | 43 | ||||
-rw-r--r-- | qicclient/user.hxx | 147 |
3 files changed, 185 insertions, 11 deletions
diff --git a/qicclient/catalog.hxx b/qicclient/catalog.hxx index 27b4c8e..782c864 100644 --- a/qicclient/catalog.hxx +++ b/qicclient/catalog.hxx @@ -61,15 +61,15 @@ namespace ICClient { , int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE; + public slots: + void update(icclient_catalog* catalog); + signals: void updated(); protected: QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; - private slots: - void update(icclient_catalog* catalog); - private: QList<Product> products; void addProduct(Product const& product); diff --git a/qicclient/client.hxx b/qicclient/client.hxx index 27ba2af..bccd665 100644 --- a/qicclient/client.hxx +++ b/qicclient/client.hxx @@ -1,10 +1,11 @@ -#ifndef QRTCLIENT_CLIENT_HXX -#define QRTCLIENT_CLIENT_HXX +#ifndef QICCLIENT_CLIENT_HXX +#define QICCLIENT_CLIENT_HXX #include <QObject> #include <icclient/product.h> struct icclient_catalog; +struct icclient_order; namespace ICClient { @@ -16,21 +17,47 @@ namespace ICClient { Client(char const* url, char const* certificate = nullptr); ~Client(); - void productAll(icclient_catalog** catalogptr - , size_t (*callback)(void* contents + void allProducts(size_t (*handler)(void* contents , size_t size, size_t nmemb , void* userdata)); public slots: - void logIn(QString const& username, QString const& password); + /* + void order(QString const& sku); + void remove(unsigned int const& indices); + void checkout(); + */ + 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 + , QString const& zip + , QString const& email + , QString const& phoneDay); + void changePassword(QString const& passwordOld + , QString const& password + , QString const& verify); + */ void logOut(); + /* + void newItem(QString const& description + , QString const& comment, + QString const& price + , QString const& imagePath); + */ signals: - void gotProductAll(icclient_catalog* catalog); - void loggedIn(QString const& username); + void gotAllProducts(icclient_catalog* catalog); + void ordered(icclient_order* order); + void loggedIn(QString const& userName); void loggedOut(); }; } -#endif // QRTCLIENT_CLIENT_HXX +#endif // QICCLIENT_CLIENT_HXX diff --git a/qicclient/user.hxx b/qicclient/user.hxx new file mode 100644 index 0000000..b554cba --- /dev/null +++ b/qicclient/user.hxx @@ -0,0 +1,147 @@ +#ifndef QICCLIENT_USER_HXX +#define QICCLIENT_USER_HXX + +#include <QObject> +#include <icclient/member.h> + +struct icclient_user; + +namespace ICClient { + + class User : public QObject + { + Q_OBJECT + Q_PROPERTY(QString userName READ userName WRITE setUserName NOTIFY userNameChanged) + Q_PROPERTY(QString userNick READ userNick WRITE setUserNick NOTIFY userNickChanged) + Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) + Q_PROPERTY(QString expiration READ expiration WRITE setExpiration NOTIFY expirationChanged) + Q_PROPERTY(QString acl READ acl WRITE setAcl NOTIFY aclChanged) + Q_PROPERTY(QString modTime READ modTime WRITE setModTime NOTIFY modTimeChanged) + Q_PROPERTY(QString sNickName READ sNickName WRITE setSNickName NOTIFY sNickNameChanged) + Q_PROPERTY(QString company READ company WRITE setCompany NOTIFY companyChanged) + Q_PROPERTY(QString fName READ fName WRITE setFName NOTIFY fNameChanged) + Q_PROPERTY(QString lName READ lName WRITE setLName NOTIFY lNameChanged) + Q_PROPERTY(QString address1 READ address1 WRITE setAddress1 NOTIFY address1Changed) + Q_PROPERTY(QString address2 READ address2 WRITE setAddress2 NOTIFY address2Changed) + Q_PROPERTY(QString address3 READ address3 WRITE setAddress3 NOTIFY address3Changed) + Q_PROPERTY(QString city READ city WRITE setCity NOTIFY cityChanged) + Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) + Q_PROPERTY(QString zip READ zip WRITE setZip NOTIFY zipChanged) + Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged) + Q_PROPERTY(QString phoneDay READ phoneDay WRITE setPhoneDay NOTIFY phoneDayChanged) + Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged) + + public: + explicit User(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{""} + {} + ~User() {} + + QString const& userName() const { return m_userName; } + QString const& userNick() const { return m_userNick; } + QString const& password() const { return m_password; } + QString const& expiration() const { return m_expiration; } + QString const& acl() const { return m_acl; } + QString const& modTime() const { return m_modTime; } + QString const& sNickName() const { return m_sNickName; } + QString const& company() const { return m_company; } + QString const& fName() const { return m_fName; } + QString const& lName() const { return m_lName; } + QString const& address1() const { return m_address1; } + QString const& address2() const { return m_address2; } + QString const& address3() const { return m_address3; } + 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& phoneDay() const { return m_phoneDay; } + QString const& email() const { return m_email; } + + void setUserName(QString const& userName); + void setUserNick(QString const& userNick); + void setPassword(QString const& password); + void setExpiration(QString const& expiration); + void setAcl(QString const& acl); + void setModTime(QString const& modTime); + void setSNickName(QString const& sNickName); + void setCompany(QString const& company); + void setFName(QString const& fName); + void setLName(QString const& lName); + void setAddress1(QString const& address1); + void setAddress2(QString const& address2); + void setAddress3(QString const& address3); + void setCity(QString const& city); + void setState(QString const& state); + void setZip(QString const& zip); + void setCountry(QString const& country); + void setPhoneDay(QString const& phoneDay); + void setEmail(QString const& email); + + public slots: + void update(icclient_user* user); + + signals: + void userNameChanged(); + void userNickChanged(); + void passwordChanged(); + void expirationChanged(); + void aclChanged(); + void modTimeChanged(); + void sNickNameChanged(); + void companyChanged(); + void fNameChanged(); + void lNameChanged(); + void address1Changed(); + void address2Changed(); + void address3Changed(); + void cityChanged(); + void stateChanged(); + void zipChanged(); + void countryChanged(); + void phoneDayChanged(); + void emailChanged(); + + private: + QString m_userName; + QString m_userNick; + QString m_password; + QString m_expiration; + QString m_acl; + QString m_modTime; + QString m_sNickName; + QString m_company; + QString m_fName; + QString m_lName; + QString m_address1; + QString m_address2; + QString m_address3; + QString m_city; + QString m_state; + QString m_zip; + QString m_country; + QString m_phoneDay; + QString m_email; + }; + +} + +#endif // QICCLIENT_USER_HXX |