MagicSmoke  $VERSION$
voucher.h
Go to the documentation of this file.
1 //
2 // C++ Interface: MOVoucher
3 //
4 // Description:
5 //
6 //
7 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2009-2011
8 //
9 // Copyright: See README/COPYING.GPL files that come with this distribution
10 //
11 //
12 
13 #ifndef MAGICSMOKE_MOVOUCHER_H
14 #define MAGICSMOKE_MOVOUCHER_H
15 
16 #include "MOVoucherAbstract"
17 #include "misc.h"
18 
19 #ifndef MSIFACE_EXPORT
20 #define MSIFACE_EXPORT Q_DECL_IMPORT
21 #endif
22 
23 
25 {
26  Q_GADGET
27  WOBJECT(MOVoucher)
28  Q_PROPERTY(QString valueString READ valueString)
29  Q_PROPERTY(QString statusString READ statusString)
30  Q_PROPERTY(QString priceString READ priceString)
31  public:
33  bool isValid()const{return !voucherid().isNull();}
35  QString valueString()const{return cent2str(value());}
37  QString statusString()const{return VoucherState2locstr(status());}
39  QString priceString()const{return cent2str(price());}
41  QString validDate()const{if(validtime().isNull())return tr("unlimited"); else return unix2date(validtime());}
42 };
43 
47 
48 #endif
virtual Nullable< qint64 > value() const
What the voucher is worth in cents.
Definition: srcMOVoucherAbstract.h:67
virtual Nullable< qint64 > validtime() const
Definition: srcMOVoucherAbstract.h:79
Definition: voucher.h:24
QString cent2str(qint64 c, bool localize)
converts a cent value into a (localized) string
Definition: misc.cpp:73
QString statusString() const
returns the status of the voucher as string
Definition: voucher.h:37
QString priceString() const
returns the price as string
Definition: voucher.h:39
virtual Nullable< QString > voucherid() const
Definition: srcMOVoucherAbstract.h:65
QString unix2date(qint64 tm, bool localize)
converts a unix timestamp into a date
Definition: misc.cpp:94
#define MSIFACE_EXPORT
Definition: voucher.h:20
virtual Nullable< qint64 > price() const
What the voucher costs in cents.
Definition: srcMOVoucherAbstract.h:69
virtual Nullable< VoucherState > status() const
Definition: srcMOVoucherAbstract.h:71
Q_DECLARE_METATYPE(QDomNode)
Definition: srcMOVoucherAbstract.h:14
QString valueString() const
returns the current value as string
Definition: voucher.h:35
QString validDate() const
returns the validity date
Definition: voucher.h:41
static QString VoucherState2locstr(VoucherState)
Converts enum VoucherState value into the corresponding localized string.
Definition: srcMOVoucherAbstract.cpp:37
bool isValid() const
returns whether this is a valid voucher object (ie.
Definition: voucher.h:33