summaryrefslogtreecommitdiff
path: root/qicclient/product.hxx
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-05 18:09:48 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-10-05 18:09:48 +0800
commit61e8ac95e621544b32ae324d7aec44b4e15bc81d (patch)
treef8526bf6e34f226c1bce1969a07b97903cffa258 /qicclient/product.hxx
parent5d36cbe8062af072958c37bb9c71b1e158074d3a (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.hxx40
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