MagicSmoke  $VERSION$
carttab.h
Go to the documentation of this file.
1 //
2 // C++ Interface: overview
3 //
4 // Description:
5 //
6 //
7 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2011
8 //
9 // Copyright: See README/COPYING.GPL files that come with this distribution
10 //
11 //
12 
13 #ifndef MAGICSMOKE_CARTTAB_H
14 #define MAGICSMOKE_CARTTAB_H
15 
16 #include <QDateTime>
17 #include <QDialog>
18 #include <QItemDelegate>
19 #include <QMainWindow>
20 #include <QTimer>
21 
22 #include "MOCustomer"
23 #include "MOCoupon"
24 
25 class QAction;
26 class QCheckBox;
27 class QComboBox;
28 class QLabel;
29 class QLineEdit;
30 class QPushButton;
31 class QSpinBox;
32 class QStandardItemModel;
33 class QTabWidget;
34 class QTableView;
35 class QTextEdit;
36 
37 class MSInterface;
38 
39 class MOCartOrder;
40 class MOCartItem;
41 class MOCartTicket;
42 class MOCartVoucher;
43 class MOOrder;
44 class MOVoucher;
45 
47 class MCartTab:public QWidget
48 {
49  Q_OBJECT
50  public:
52  MCartTab(QString);
53 
55  QList<QMenu*>menu();
56 
58  ~MCartTab();
59 
60  signals:
62  int currentEventId();
64  QString currentEventTitle();
66  QString currentEventStart();
67 
69  void requestFocus();
70 
72  void getEventId(int&,bool&);
73 
74  public slots:
76  void eventOrderTicket();
78  void eventOrderTicket(qint64,qint64);
79 
81  void updateShipping();
82 
83  private slots:
85  void setCustomer();
87  void setDeliveryAddr();
89  void setInvoiceAddr();
91  void initCart();
93  void cartAddTicket();
95  void cartAddVoucher();
97  void cartAddItem();
99  void cartRemoveItem();
101  void cartOrder(bool isreserve=false,bool issale=false);
103  void cartReserve();
105  void cartSell();
107  void resetColor(bool addronly=false);
109  void updatePrice();
111  void changeVoucher(QString url);
112 
113  private:
114  //the profile associated with this session
115  QString profilekey;
116  //widgets
117  QTableView*carttable;
118  QStandardItemModel*cartmodel;
119  QLabel*cartcustomer,*deliveryaddr,*invoiceaddr,*price,*coupon,*vouchers,*priceremain;
120  QTextEdit *cartcomment;
121  QComboBox*cartship;
122  //cart
123  MOCustomer customer;
124  qint64 deliveryaddrid,invoiceaddrid;
125  MOCoupon couponinfo;
126  QList<QPair<QString,int>> vouchersforpay;
127 
129  bool canorder(bool isreserve);
131  void cartTableToOrder(MOCartOrder&);
133  bool orderExecute(MOCartOrder&cart,MOOrder&order,bool isreserve,bool issale);
135  void verifyOrderCustomer(MOCartOrder&);
137  void verifyOrderTickets(const QList<MOCartTicket>&);
139  void verifyOrderVouchers(const QList<MOCartVoucher>&);
141  void verifyOrderItems(const QList<MOCartItem>&);
142 
144  void addTicketForEvent(qint64,qint64 prcid=-1);
145 
147  void applyCoupon();
148 
150  void displayUsedVouchers(const QList<MOVoucher>&,int paidcash);
151 };
152 
154 class MCartTableDelegate:public QItemDelegate
155 {
156  public:
157  MCartTableDelegate(QObject *parent = 0);
158 
159  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
160  const QModelIndex &index) const;
161 
162  void setEditorData(QWidget *editor, const QModelIndex &index) const;
163  void setModelData(QWidget *editor, QAbstractItemModel *model,
164  const QModelIndex &index) const;
165 };
166 
167 #endif
This class represents a coupon.
Definition: srcMOCoupon.h:16
Definition: srcMOCartItem.h:14
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: carttab.cpp:1017
void setEditorData(QWidget *editor, const QModelIndex &index) const
Definition: carttab.cpp:1030
Encapsulates tickets for a specific event in a specific price category as they are stored in the cart...
Definition: srcMOCartTicket.h:18
void requestFocus()
emitted when the cart tab wants focus because something important changed
Definition: customer.h:24
QList< QMenu * > menu()
creates the menu for this tab
Definition: carttab.cpp:165
Main Overview Window: cart tab.
Definition: carttab.h:47
Encapsulates vouchers as they are stored in the cart. Used by the client to tell the server about new...
Definition: srcMOCartVoucher.h:15
Definition: voucher.h:24
MCartTableDelegate(QObject *parent=0)
Definition: carttab.cpp:1012
The cart as used from the remote (non-web) system, this is a transaction object, it has no equivalent...
Definition: srcMOCartOrder.h:18
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: carttab.cpp:1038
~MCartTab()
destructs the tab
Definition: carttab.cpp:180
MCartTab(QString)
construct the window with QSettings-key for current profile
Definition: carttab.cpp:52
void eventOrderTicket()
order ticket from event tab
Definition: carttab.cpp:391
void getEventId(int &, bool &)
select an event
this class represents a complete order
Definition: order.h:27
void updateShipping()
update shipping info
Definition: carttab.cpp:187
int currentEventId()
must be connected to the slot in the event tab: returns the currently selected event ID ...
QString currentEventStart()
must be connected to the slot in the event tab: returns the currently selected event start time (as s...
the MagicSmoke specific interface class - enhances the basic interface by some functionality needed i...
Definition: msinterface.h:29
QString currentEventTitle()
must be connected to the slot in the event tab: returns the currently selected event title ...
Helper class for shopping cart: allow editing amount, but nothing else.
Definition: carttab.h:154