diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-05 18:09:48 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-05 18:09:48 +0800 |
commit | 61e8ac95e621544b32ae324d7aec44b4e15bc81d (patch) | |
tree | f8526bf6e34f226c1bce1969a07b97903cffa258 /qicclient/product.hxx | |
parent | 5d36cbe8062af072958c37bb9c71b1e158074d3a (diff) |
Separate the product structure
so the catalog doesn't have to included when not needed.
Diffstat (limited to 'qicclient/product.hxx')
-rw-r--r-- | qicclient/product.hxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/qicclient/product.hxx b/qicclient/product.hxx new file mode 100644 index 0000000..7271fe9 --- /dev/null +++ b/qicclient/product.hxx @@ -0,0 +1,40 @@ +#ifndef QICCLIENT_PRODUCT_HXX +#define QICCLIENT_PRODUCT_HXX + +#include <icclient/product.h> + +namespace ICClient { + + struct Product + { + enum ProductRoles { + SkuRole = Qt::UserRole + 1, + DescriptionRole, + CommentRole, + ImageRole, + PriceRole + }; + + Product(icclient_product* product) + : sku{product->sku} + , price{product->price} + { + if (product->description) + description + = QString{product->description}; + if (product->comment) + comment = QString{product->comment}; + if (product->image) + image = QString{product->image}; + } + + QString sku; + QString description; + QString comment; + QString image; + double price; + }; + +} + +#endif // QICCLIENT_PRODUCT_HXX |