Added typedefs for QSharedPointer types

print
Josef Rokos 8 years ago
parent 0f397c4308
commit 707e2dbc0b

@ -11,7 +11,8 @@ class SHOPSHARED_EXPORT ISellableService
public:
ISellableService();
virtual QList<QSharedPointer<ShopItem> > shopItems() = 0;
virtual QList<ShopItemPtr> shopItems() = 0;
//virtual void addToReceipt()
};
#endif // ISELLABLESERVICE_H

@ -30,4 +30,6 @@ public:
virtual QString pluginId() override { return ""; }
};
typedef QSharedPointer<ShopItem> ShopItemPtr;
#endif // SHOPITEM_H

@ -7,14 +7,14 @@ ShopService::ShopService()
{
}
QSharedPointer<Voucher> ShopService::createVoucher()
VoucherPtr ShopService::createVoucher()
{
QSharedPointer<Voucher> voucher(new Voucher);
voucher->setStatus(Voucher::NEW);
return voucher;
}
void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IShopItem> item, int count)
void ShopService::addShopItem(VoucherPtr voucher, QSharedPointer<IShopItem> item, int count)
{
QSharedPointer<VoucherItem> vItem(new VoucherItem);
vItem->setName(item->name());
@ -27,7 +27,7 @@ void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IS
voucher->addItem(vItem);
}
void ShopService::calculate(QSharedPointer<Voucher> voucher)
void ShopService::calculate(VoucherPtr voucher)
{
QDecDouble total;
@ -66,7 +66,7 @@ void ShopService::calculate(QSharedPointer<Voucher> voucher)
voucher->setTotalPrice(total);
}
void ShopService::calculateItem(QSharedPointer<VoucherItem> item)
void ShopService::calculateItem(VoucherItemPtr item)
{
loadSettings();
if (m_gs->vatPayer())
@ -82,13 +82,13 @@ void ShopService::calculateItem(QSharedPointer<VoucherItem> item)
}
}
void ShopService::loadItems(QSharedPointer<Voucher> voucher)
void ShopService::loadItems(VoucherPtr voucher)
{
Service<VoucherItem> srv;
voucher->setItems(srv.all(QString("voucher = %1").arg(voucher->id())));
}
void ShopService::pay(QSharedPointer<Voucher> voucher)
void ShopService::pay(VoucherPtr voucher)
{
Transaction tx;
NumberSeriesService srvNs;
@ -106,22 +106,22 @@ void ShopService::pay(QSharedPointer<Voucher> voucher)
tx.commit();
}
QList<QSharedPointer<Voucher> > ShopService::savedVouchers()
QList<VoucherPtr> ShopService::savedVouchers()
{
return all(QString("status = %1").arg(QString::number(Voucher::NOT_PAID)));
}
QList<QSharedPointer<Voucher> > ShopService::tempVouchers()
QList<VoucherPtr> ShopService::tempVouchers()
{
return all(QString("status = %1").arg(QString::number(Voucher::TEMPORARY)));
}
QList<QSharedPointer<Voucher> > ShopService::paiedVouchers()
QList<VoucherPtr> ShopService::paiedVouchers()
{
return all(QString("status = %1").arg(QString::number(Voucher::PAID)));
}
QList<QSharedPointer<ShopItem> > ShopService::allSellableItems()
QList<ShopItemPtr> ShopService::allSellableItems()
{
QList<QSharedPointer<ShopItem> > items;
foreach (IPlugin *plugin, Context::instance().plugins()) {
@ -176,7 +176,7 @@ QDecDouble ShopService::vatRate(Enums::VatType vatType)
return vatRate;
}
void ShopService::saveVoucher(QSharedPointer<Voucher> entity)
void ShopService::saveVoucher(VoucherPtr entity)
{
Transaction tr;
odb::database *db = Context::instance().db();
@ -191,7 +191,7 @@ void ShopService::saveVoucher(QSharedPointer<Voucher> entity)
tr.commit();
}
void ShopService::updateVoucher(QSharedPointer<Voucher> entity)
void ShopService::updateVoucher(VoucherPtr entity)
{
Transaction tr;
odb::database *db = Context::instance().db();

@ -13,16 +13,16 @@ class ShopService : public Service<Voucher>
{
public:
ShopService();
QSharedPointer<Voucher> createVoucher();
void addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IShopItem> item, int count);
void calculate(QSharedPointer<Voucher> voucher);
void calculateItem(QSharedPointer<VoucherItem> item);
void loadItems(QSharedPointer<Voucher> voucher);
void pay(QSharedPointer<Voucher> voucher);
QList<QSharedPointer<Voucher> > savedVouchers();
QList<QSharedPointer<Voucher> > tempVouchers();
QList<QSharedPointer<Voucher> > paiedVouchers();
QList<QSharedPointer<ShopItem> > allSellableItems();
VoucherPtr createVoucher();
void addShopItem(VoucherPtr voucher, QSharedPointer<IShopItem> item, int count);
void calculate(VoucherPtr voucher);
void calculateItem(VoucherItemPtr item);
void loadItems(VoucherPtr voucher);
void pay(VoucherPtr voucher);
QList<VoucherPtr> savedVouchers();
QList<VoucherPtr> tempVouchers();
QList<VoucherPtr> paiedVouchers();
QList<ShopItemPtr> allSellableItems();
private:
QDecDouble includeVat(QDecDouble price, Enums::VatType vatType);
@ -32,8 +32,8 @@ private:
QDecDouble vatRate(Enums::VatType vatType);
public:
void saveVoucher(QSharedPointer<Voucher> entity);
void updateVoucher(QSharedPointer<Voucher> entity);
void saveVoucher(VoucherPtr entity);
void updateVoucher(VoucherPtr entity);
};
#endif // SHOPSERVICE_H

Loading…
Cancel
Save