closes #4: Favorite buttons has been extended with category buttons.

This commit is contained in:
2023-05-17 21:31:32 +02:00
parent 5b5f31f64d
commit 5b77337b3f
33 changed files with 596 additions and 106 deletions
+4 -2
View File
@@ -1,11 +1,13 @@
#include "commodityservice.h"
QList<QSharedPointer<IShopItem> > CommodityService::shopItems()
QList<QSharedPointer<IShopItem> > CommodityService::shopItems(const QString& category/* = ""*/)
{
QList<QSharedPointer<IShopItem> > ret;
foreach (QSharedPointer<CommodityData> data, all()) {
ret.append(qSharedPointerDynamicCast<IShopItem, CommodityData>(data));
if (category.isEmpty() || (data->favorite() && data->category() == category)) {
ret.append(qSharedPointerDynamicCast<IShopItem, CommodityData>(data));
}
}
return ret;