MagicSmoke  $VERSION$
ticket.h
Go to the documentation of this file.
1 //
2 // C++ Interface: MOTicket
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_MOTICKET_H
14 #define MAGICSMOKE_MOTICKET_H
15 
16 #include "MOTicketAbstract"
17 #include "misc.h"
18 #include "MOEvent"
19 
20 #ifndef MSIFACE_EXPORT
21 #define MSIFACE_EXPORT Q_DECL_IMPORT
22 #endif
23 
24 
26 {
27  Q_GADGET
28  WOBJECT(MOTicket)
29  Q_PROPERTY(int amountToPay READ amountToPay)
30  Q_PROPERTY(QString priceString READ priceString)
31  Q_PROPERTY(QString statusString READ statusString)
32  Q_PROPERTY(QString priceCategoryName READ priceCategoryName)
33  Q_PROPERTY(QString priceCategoryShort READ priceCategoryShort)
34  public:
36  int amountToPay()const{if(status()&MaskPay)return price();else return 0;}
37 
39  QString priceString()const{return cent2str(price());}
40 
42  QString statusString()const{return TicketState2locstr(status());}
43 
45  QString priceCategoryName()const;
47  QString priceCategoryShort()const;
48 
50  MOEvent event()const;
51 
53  void setEvent(const MOEvent&e);
54  private:
55  //this must be mutable, since event() is semantically and technically const
56  mutable MOEvent m_event;
57 };
58 
62 
63 #endif
encapsulation of an event, this class wraps the auto-generated event class to provide some convenienc...
Definition: event.h:25
QString statusString() const
returns the ticket status as localized string
Definition: ticket.h:42
static QString TicketState2locstr(TicketState)
Converts enum TicketState value into the corresponding localized string.
Definition: srcMOTicketAbstract.cpp:55
QString cent2str(qint64 c, bool localize)
converts a cent value into a (localized) string
Definition: misc.cpp:73
Definition: ticket.h:25
int amountToPay() const
returns the amount to be paid for this ticket; this may be 0 even if there is a price attached ...
Definition: ticket.h:36
#define MSIFACE_EXPORT
Definition: boxwrapper.h:18
This class represents the data of a ticket as stored in the database.
Definition: srcMOTicketAbstract.h:16
Q_DECLARE_METATYPE(QDomNode)
QString priceString() const
returns the price as string
Definition: ticket.h:39
virtual Nullable< TicketState > status() const
Definition: srcMOTicketAbstract.h:88
virtual Nullable< qint64 > price() const
Definition: srcMOTicketAbstract.h:86