Added data entities for shop plugin.
This commit is contained in:
+59
-3
@@ -2,16 +2,72 @@
|
||||
#define VOUCHER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDecDouble.hh>
|
||||
#include <QString>
|
||||
#include <QSharedPointer>
|
||||
#include <addressbookdata.h>
|
||||
#include <odb/core.hxx>
|
||||
#include <odb/qt/list.hxx>
|
||||
|
||||
#include "voucheritem.h"
|
||||
|
||||
#pragma db object
|
||||
class Voucher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QString description READ description WRITE setDescription)
|
||||
Q_PROPERTY(QSharedPointer<QObject> contact READ contact WRITE setContact)
|
||||
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
|
||||
Q_ENUMS(VoucherStatus)
|
||||
Q_PROPERTY(VoucherStatus status READ status WRITE setStatus)
|
||||
|
||||
public:
|
||||
explicit Voucher(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
enum VoucherStatus
|
||||
{
|
||||
NEW,
|
||||
TEMPORARY,
|
||||
NOT_PAID,
|
||||
PAID
|
||||
};
|
||||
|
||||
public slots:
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
|
||||
QSharedPointer<QObject> contact() const;
|
||||
void setContact(const QSharedPointer<QObject> &contact);
|
||||
|
||||
VoucherStatus status() const;
|
||||
void setStatus(const VoucherStatus &status);
|
||||
|
||||
QDecDouble totalPrice() const;
|
||||
void setTotalPrice(QDecDouble totalPrice);
|
||||
|
||||
QList<QSharedPointer<VoucherItem> > items() const;
|
||||
void setItems(const QList<QSharedPointer<VoucherItem> > &items);
|
||||
|
||||
void addItem(QSharedPointer<VoucherItem> item);
|
||||
void clearItems();
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_name;
|
||||
QString m_description;
|
||||
QSharedPointer<AddressbookData> m_contact;
|
||||
int m_totalPrice;
|
||||
QOdbList<QSharedPointer<VoucherItem> > m_items;
|
||||
VoucherStatus m_status;
|
||||
};
|
||||
|
||||
#endif // VOUCHER_H
|
||||
#endif // VOUCHER_H
|
||||
|
||||
Reference in New Issue
Block a user