From 18508ea004a66cc30c42c43d14afdc16b2267666 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: Sun, 25 Sep 2022 10:55:36 +0800 Subject: Rename project to qinterchange --- interchange/product.hxx | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 interchange/product.hxx (limited to 'interchange/product.hxx') diff --git a/interchange/product.hxx b/interchange/product.hxx new file mode 100644 index 0000000..a7f3587 --- /dev/null +++ b/interchange/product.hxx @@ -0,0 +1,63 @@ +#ifndef INTERCHANGE_PRODUCT_HXX +#define INTERCHANGE_PRODUCT_HXX + +#include + +namespace Interchange { + + struct Product + { + enum ProductRoles { + SkuRole = Qt::UserRole + 1, + DescriptionRole, + CommentRole, + ThumbRole, + ImageRole, + PriceRole, + ProdGroupRole, + WeightRole, + AuthorRole, + CrossSellRole + }; + + Product() {} + Product(struct interchange_product* product) : + price{product->price}, + weight{product->weight} + { + if (product->sku) + sku = QString{product->sku}; + if (product->description) + description = QString{product->description}; + if (product->comment) + comment = QString{product->comment}; + if (product->thumb) + thumb = QString{product->thumb}; + if (product->image) + image = QString{product->image}; + if (product->prod_group) + prodGroup = QString{product->prod_group}; + if (product->author) + author = QString{product->author}; + if (product->crosssell) { + auto crosssell = product->crosssell; + for (size_t i = 0; i < crosssell->length; i++) + crossSell << QString{crosssell->skus[i]}; + } + } + + QString sku; + QString description; + QString comment; + QString thumb; + QString image; + double price; + QString prodGroup; + double weight; + QString author; + QStringList crossSell; + }; + +} + +#endif -- cgit v1.2.3