diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-07-16 08:19:39 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2020-07-16 08:19:39 +0800 |
commit | e790f72bdbea00c353709dc5a9920527121eb57c (patch) | |
tree | 622a65b4ee9b5e8bd7aa7a9fede9d47b69d82378 | |
parent | 4ba15985b35566a99e822673fb355a4f4efa09fc (diff) |
Rename basket to ord
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | client.cxx | 4 | ||||
-rw-r--r-- | ord.cxx (renamed from basket.cxx) | 12 | ||||
-rw-r--r-- | qicclient/client.hxx | 5 | ||||
-rw-r--r-- | qicclient/ord.hxx (renamed from qicclient/basket.hxx) | 10 |
5 files changed, 18 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a0aa505..2e4741a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,11 +9,11 @@ find_package(Qt5Core) add_library(${PROJECT_NAME} SHARED ${PROJECT_NAME}/member.hxx ${PROJECT_NAME}/catalog.hxx - ${PROJECT_NAME}/basket.hxx + ${PROJECT_NAME}/ord.hxx ${PROJECT_NAME}/client.hxx member.cxx catalog.cxx - basket.cxx + ord.cxx client.cxx ) @@ -29,7 +29,7 @@ install(FILES ${PROJECT_NAME}/member.hxx ${PROJECT_NAME}/product.hxx ${PROJECT_NAME}/catalog.hxx - ${PROJECT_NAME}/basket.hxx + ${PROJECT_NAME}/ord.hxx ${PROJECT_NAME}/client.hxx DESTINATION include/${PROJECT_NAME} ) @@ -4,7 +4,7 @@ #include <icclient/client.h> #include <icclient/member.h> #include "qicclient/catalog.hxx" -#include "qicclient/basket.hxx" +#include "qicclient/ord.hxx" #include "qicclient/client.hxx" namespace QICClient { @@ -42,7 +42,7 @@ namespace QICClient { if (product) emit gotFlyPage(shared_ptr<Product>{new Product{product}}); } - void Client::order(QString const& sku, Catalog const& catalog, Basket& order) + void Client::order(QString const& sku, Catalog const& catalog, Ord& order) { auto c_order = order.data(); icclient_ord_order(sku.toLatin1().constData(), catalog.constData(), @@ -1,16 +1,16 @@ #include <algorithm> #include <icclient/ord.h> -#include "qicclient/basket.hxx" +#include "qicclient/ord.hxx" namespace QICClient { - int Basket::rowCount(QModelIndex const& parent) const + int Ord::rowCount(QModelIndex const& parent) const { Q_UNUSED(parent) return items.count(); } - QVariant Basket::data(QModelIndex const& index, int role) const + QVariant Ord::data(QModelIndex const& index, int role) const { auto row = index.row(); @@ -31,7 +31,7 @@ namespace QICClient { } } - QHash<int, QByteArray> Basket::roleNames() const + QHash<int, QByteArray> Ord::roleNames() const { return QHash<int, QByteArray>{ {Product::SkuRole, "sku"} @@ -41,7 +41,7 @@ namespace QICClient { }; } - void Basket::addItem(Item const& item) + void Ord::addItem(Item const& item) { auto product = item.product; auto iterator = std::find_if(items.begin(), items.end() @@ -61,7 +61,7 @@ namespace QICClient { emit rowCountChanged(); } - void Basket::setData(struct icclient_ord_order* order) + void Ord::setData(struct icclient_ord_order* order) { if (order) { this->m_data = order; diff --git a/qicclient/client.hxx b/qicclient/client.hxx index c554dab..984996c 100644 --- a/qicclient/client.hxx +++ b/qicclient/client.hxx @@ -8,7 +8,7 @@ namespace QICClient { using std::shared_ptr; class Catalog; class Product; - class Basket; + class Ord; class Client : public QObject { @@ -51,8 +51,7 @@ namespace QICClient { * \param catalog The catalog from which the item is. * \param order The order. */ - void order(QString const& sku, Catalog const& catalog, - Basket& order); + void order(QString const& sku, Catalog const& catalog, Ord& order); public slots: /* diff --git a/qicclient/basket.hxx b/qicclient/ord.hxx index 8930821..a3be840 100644 --- a/qicclient/basket.hxx +++ b/qicclient/ord.hxx @@ -1,5 +1,5 @@ -#ifndef QICCLIENT_BASKET_HXX -#define QICCLIENT_BASKET_HXX +#ifndef QICCLIENT_ORD_HXX +#define QICCLIENT_ORD_HXX #include <QAbstractListModel> #include <icclient/ord.h> @@ -27,7 +27,7 @@ namespace QICClient { } }; - class Basket : public QAbstractListModel + class Ord : public QAbstractListModel { Q_OBJECT Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged) @@ -36,7 +36,7 @@ namespace QICClient { Q_PROPERTY(double totalCost READ totalCost NOTIFY totalCostChanged) public: - explicit Basket(QObject* parent = nullptr) : + explicit Ord(QObject* parent = nullptr) : QAbstractListModel{parent}, m_data{nullptr}, m_subtotal{.0}, @@ -76,4 +76,4 @@ namespace QICClient { } -#endif // QICCLIENT_BASKET_HXX +#endif // QICCLIENT_ORD_HXX |