Implemented search in shop items on ShopForm. Prepare for favorite buttons.
							parent
							
								
									44c74a5cfe
								
							
						
					
					
						commit
						2eb1039f6f
					
				@ -0,0 +1,69 @@
 | 
			
		||||
#include "favorititem.h"
 | 
			
		||||
#include <define.h>
 | 
			
		||||
 | 
			
		||||
FavoritItem::FavoritItem()
 | 
			
		||||
{
 | 
			
		||||
    m_id = 0;
 | 
			
		||||
    m_vatType = Enums::NONE;
 | 
			
		||||
    m_unitPrice = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int FavoritItem::id()
 | 
			
		||||
{
 | 
			
		||||
    return m_id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FavoritItem::setId(int id)
 | 
			
		||||
{
 | 
			
		||||
    m_id = id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString FavoritItem::name()
 | 
			
		||||
{
 | 
			
		||||
    return m_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FavoritItem::setName(const QString &name)
 | 
			
		||||
{
 | 
			
		||||
    m_name = name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QDecDouble FavoritItem::unitPrice()
 | 
			
		||||
{
 | 
			
		||||
    return TO_DEC(m_unitPrice);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FavoritItem::setUnitPrice(QDecDouble unitPrice)
 | 
			
		||||
{
 | 
			
		||||
    m_unitPrice = FROM_DEC(unitPrice);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Enums::VatType FavoritItem::vatType()
 | 
			
		||||
{
 | 
			
		||||
    return m_vatType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FavoritItem::setVatType(const Enums::VatType &vatType)
 | 
			
		||||
{
 | 
			
		||||
    m_vatType = vatType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString FavoritItem::pluginId()
 | 
			
		||||
{
 | 
			
		||||
    return m_pluginId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FavoritItem::setPluginId(const QString &pluginId)
 | 
			
		||||
{
 | 
			
		||||
    m_pluginId = pluginId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString FavoritItem::favButtonName() const
 | 
			
		||||
{
 | 
			
		||||
    return m_favButtonName;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FavoritItem::setFavButtonName(const QString &favButtonName)
 | 
			
		||||
{
 | 
			
		||||
    m_favButtonName = favButtonName;
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,62 @@
 | 
			
		||||
#ifndef FAVORITITEM_H
 | 
			
		||||
#define FAVORITITEM_H
 | 
			
		||||
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QSharedPointer>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QDecDouble.hh>
 | 
			
		||||
#include <enums.h>
 | 
			
		||||
#include <ishopitem.h>
 | 
			
		||||
#include <odb/core.hxx>
 | 
			
		||||
 | 
			
		||||
class IShopItem;
 | 
			
		||||
 | 
			
		||||
#pragma db object
 | 
			
		||||
class FavoritItem : public QObject, public IShopItem
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
    Q_PROPERTY(int id READ id WRITE setId)
 | 
			
		||||
    Q_PROPERTY(QString name READ name WRITE setName)
 | 
			
		||||
    Q_PROPERTY(QDecDouble unitPrice READ unitPrice WRITE setUnitPrice)
 | 
			
		||||
    Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
 | 
			
		||||
    Q_PROPERTY(QString pluginId READ pluginId WRITE setPluginId)
 | 
			
		||||
    Q_PROPERTY(QString favButtonName READ favButtonName WRITE setFavButtonName)
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    FavoritItem();
 | 
			
		||||
 | 
			
		||||
    // IShopItem interface
 | 
			
		||||
public:
 | 
			
		||||
    int id() override;
 | 
			
		||||
    void setId(int id);
 | 
			
		||||
 | 
			
		||||
    QString name() override;
 | 
			
		||||
    void setName(const QString &name);
 | 
			
		||||
 | 
			
		||||
    QDecDouble unitPrice() override;
 | 
			
		||||
    void setUnitPrice(QDecDouble unitPrice);
 | 
			
		||||
 | 
			
		||||
    Enums::VatType vatType() override;
 | 
			
		||||
    void setVatType(const Enums::VatType &vatType);
 | 
			
		||||
 | 
			
		||||
    QString pluginId() override;
 | 
			
		||||
    void setPluginId(const QString &pluginId);
 | 
			
		||||
 | 
			
		||||
    QString favButtonName() const;
 | 
			
		||||
    void setFavButtonName(const QString &favButtonName);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    friend class odb::access;
 | 
			
		||||
#pragma db id auto
 | 
			
		||||
    int m_id;
 | 
			
		||||
    QString m_name;
 | 
			
		||||
    int m_unitPrice;
 | 
			
		||||
    Enums::VatType m_vatType;
 | 
			
		||||
    QString m_pluginId;
 | 
			
		||||
    QString m_favButtonName;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef QSharedPointer<FavoritItem> FavoritItemPtr;
 | 
			
		||||
 | 
			
		||||
#endif // FAVORITITEM_H
 | 
			
		||||
@ -0,0 +1,6 @@
 | 
			
		||||
#include "favoriteservice.h"
 | 
			
		||||
 | 
			
		||||
FavoriteService::FavoriteService()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,13 @@
 | 
			
		||||
#ifndef FAVORITESERVICE_H
 | 
			
		||||
#define FAVORITESERVICE_H
 | 
			
		||||
 | 
			
		||||
#include <core.h>
 | 
			
		||||
#include "data/favorititem.h"
 | 
			
		||||
 | 
			
		||||
class FavoriteService : public Service<FavoritItem>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    FavoriteService();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // FAVORITESERVICE_H
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue