From c8668c0c247d6d6bbcfbb02b5a12d5bafeb74cc9 Mon Sep 17 00:00:00 2001 From: konrad Date: Wed, 20 Oct 2010 20:19:34 +0000 Subject: [PATCH] started to use scriptability start of wizard class git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@604 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- debian/control | 5 +- debian/gencl | 34 +++++++++++++++- src/dialogs/dialogs.pri | 6 ++- src/dialogs/wizard.cpp | 94 +++++++++++++++++++++++++++++++++++++++++++++ src/dialogs/wizard.h | 36 +++++++++++++++++ src/iface/msinterface.h | 13 +++++- src/mwin/overview.cpp | 23 ++++++++++- src/mwin/overview.h | 4 ++ src/script/jsengine.cpp | 62 +++++++++++++++++++++++++++++ src/script/jsengine.h | 34 ++++++++++++++++ src/script/script.pri | 7 +++ src/smoke.pro | 3 +- src/wext/address.cpp | 8 +++- src/wext/address.h | 8 +++- src/wext/customer.cpp | 8 ++++ src/wext/customer.h | 8 +++- src/wext/customerinfo.cpp | 7 +++ src/wext/customerinfo.h | 8 +++- src/wext/event.cpp | 7 +++ src/wext/event.h | 8 +++- src/wext/order.cpp | 14 +++++++ src/wext/order.h | 13 +++--- src/wext/orderinfo.h | 10 +++- src/wext/role.h | 11 +++++- src/wext/ticket.cpp | 10 +++++ src/wext/ticket.h | 8 +++- src/wext/voucher.h | 8 +++- src/wext/wext.pri | 1 + wob/db/basics.wolf | 1 + wob/magicsmoke.wolf | 2 +- 30 files changed, 431 insertions(+), 30 deletions(-) create mode 100644 src/dialogs/wizard.cpp create mode 100644 src/dialogs/wizard.h create mode 100644 src/script/jsengine.cpp create mode 100644 src/script/jsengine.h create mode 100644 src/script/script.pri diff --git a/debian/control b/debian/control index 44f37cc..05ab75c 100644 --- a/debian/control +++ b/debian/control @@ -35,5 +35,6 @@ Description: MagicSmoke Ticket Sale System - Server incompatible with old databases. . This package makes MagicSmoke available on your system, but it does not - create a database or install it into the web server directory, please - refer to the documentation files for details. \ No newline at end of file + create a database or install it into the web server directory, please + refer to the documentation files for details on how to finalize the + installation process. \ No newline at end of file diff --git a/debian/gencl b/debian/gencl index ce963ac..b150b9c 100755 --- a/debian/gencl +++ b/debian/gencl @@ -2,6 +2,29 @@ cl=debian/changelog +test -x "`which svn`" || { + echo 'Warning: cannot find svn - do you have package subversion installed?' 2>&1 + test -f $cl && { + echo cannot find svn, but $cl exists - accepting it + exit 0 + } || { + echo 'Error: cannot find svn and' $cl 'does not exist - cannot proceed.' 1>&2 + exit 1 + } +} +test -d .svn || { + echo 'Warning: this is not a SVN checkout, building in non-dev mode...' 2>&1 + test -f $cl && { + echo 'Info:' $cl 'does exist, accepting it for now' + exit 0 + } || { + echo 'Error:' $cl 'does not exist, cannot proceed.' 2>&1 + exit 1 + } +} + +echo Generating $cl ... + REV="$(svn info|grep Revision:|cut -d " " -f 2)" REV="2$(echo -n $REV|wc -c|tr 0-9 c-l)$REV" @@ -11,9 +34,16 @@ fi echo "magicsmoke2 ($REV) unstable; urgency=low" >$cl echo >>$cl -echo " Package Generated by" `whoami`@`hostname` `date -R`>>$cl +echo " Package Generated by" `whoami`@`hostname -f` `date -R`>>$cl echo >>$cl -svn2cl --stdout -i --group-by-day | sed 's/^/ /' | sed 's/\t/ /' >>$cl +test -x "`which svn2cl`" && { + svn2cl --stdout -i --group-by-day | sed 's/^/ /' | sed 's/\t/ /' >>$cl +} || { + echo 'Warning: cannot find svn2cl - do you have subversion-tools installed?' 2>&1 + echo 'Warning:' $cl 'will have an empty body, this may not be what you wanted.' 2>&1 + echo ' ' `date +%Y-%m-%d` `whoami` >>$cl + echo ' * built package without subversion info available, sorry.' >>$cl +} echo >>$cl echo -n ' -- konrad ' >>$cl date -R >>$cl diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri index be7790b..6d9abe6 100644 --- a/src/dialogs/dialogs.pri +++ b/src/dialogs/dialogs.pri @@ -10,7 +10,8 @@ HEADERS += \ dialogs/passwdchg.h \ dialogs/pricecatdlg.h \ dialogs/aclwin.h \ - dialogs/flagedit.h + dialogs/flagedit.h \ + dialogs/wizard.h SOURCES += \ dialogs/configdialog.cpp \ @@ -24,6 +25,7 @@ SOURCES += \ dialogs/passwdchg.cpp \ dialogs/pricecatdlg.cpp \ dialogs/aclwin.cpp \ - dialogs/flagedit.cpp + dialogs/flagedit.cpp \ + dialogs/wizard.cpp INCLUDEPATH += ./dialogs \ No newline at end of file diff --git a/src/dialogs/wizard.cpp b/src/dialogs/wizard.cpp new file mode 100644 index 0000000..c3cf986 --- /dev/null +++ b/src/dialogs/wizard.cpp @@ -0,0 +1,94 @@ +// +// C++ Implementation: order wizard +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2010 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include "wizard.h" +#include "overview.h" +#include "msinterface.h" +#include "jsengine.h" + +#include +#include +#include +#include + +MWizard::MWizard(MOverview* parent, Qt::WindowFlags f) + :QDialog(parent, f),m_parent(parent) +{ + //main layout + QVBoxLayout*vl; + QStackedLayout*stack; + QHBoxLayout*hl; + setLayout(vl=new QVBoxLayout); + vl->addLayout(stack=new QStackedLayout,1); + //bottom buttons + vl->addLayout(hl=new QHBoxLayout); + hl->addStretch(1); + QPushButton*p; + hl->addWidget(p=new QPushButton(tr("Close Wizard"))); + connect(p,SIGNAL(clicked()),this,SLOT(accept())); + hl->addWidget(p=new QPushButton(tr("Exit"))); + connect(p,SIGNAL(clicked()),this,SLOT(accept())); + connect(p,SIGNAL(clicked()),parent,SLOT(close())); + + //paging + QSignalMapper*map=new QSignalMapper(this); + connect(map,SIGNAL(mapped(int)),stack,SLOT(setCurrentIndex(int))); + QWidget*w; + int istart,ivou,ievt,icust,iexec; + + //page: start + istart=stack->addWidget(w=new QWidget); + w->setLayout(vl=new QVBoxLayout); + vl->addStretch(1); + vl->addWidget(p=new QPushButton(tr("Sell Tickets"))); + p->setEnabled(req->hasRight(req->PCreateOrder_CanSell)); + connect(p,SIGNAL(clicked()),map,SLOT(map())); + connect(p,SIGNAL(clicked()),this,SLOT(saleMode())); + map->setMapping(p,ievt); + vl->addWidget(p=new QPushButton(tr("Order Tickets"))); + p->setEnabled(req->hasRight(req->PCreateOrder_CanSell)); + connect(p,SIGNAL(clicked()),map,SLOT(map())); + connect(p,SIGNAL(clicked()),this,SLOT(orderMode())); + map->setMapping(p,ievt); + vl->addWidget(p=new QPushButton(tr("Sell Voucher"))); + p->setEnabled(req->hasRight(req->PCreateOrder_CanOrder)); + connect(p,SIGNAL(clicked()),map,SLOT(map())); + connect(p,SIGNAL(clicked()),this,SLOT(saleMode())); + map->setMapping(p,ivou); + vl->addWidget(p=new QPushButton(tr("Order Voucher"))); + p->setEnabled(req->hasRight(req->PCreateOrder_CanOrder)); + connect(p,SIGNAL(clicked()),map,SLOT(map())); + connect(p,SIGNAL(clicked()),this,SLOT(orderMode())); + map->setMapping(p,ivou); + vl->addStretch(1); + + //page: events + m_jseng=new MScriptEngine(parent); + m_jseng->addObject("Wizard",this); + m_jseng->evaluate("debugger"); +} + +MWizard::~MWizard() +{ + delete m_jseng; +} + + +void MWizard::orderMode() +{ + m_mode=OrderMode; +} + +void MWizard::saleMode() +{ + m_mode=SaleMode; +} diff --git a/src/dialogs/wizard.h b/src/dialogs/wizard.h new file mode 100644 index 0000000..d9451f4 --- /dev/null +++ b/src/dialogs/wizard.h @@ -0,0 +1,36 @@ +// +// C++ Interface: order wizard +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2010 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef MAGICSMOKE_WIZARD_H +#define MAGICSMOKE_WIZARD_H + +#include + +class MScriptEngine; +class MOverview; +class MWizard:public QDialog +{ + Q_OBJECT + public: + MWizard(MOverview* parent = 0, Qt::WindowFlags f = 0); + virtual ~MWizard(); + private slots: + void saleMode(); + void orderMode(); + private: + MOverview*m_parent; + enum Mode {SaleMode,OrderMode}; + Mode m_mode; + MScriptEngine*m_jseng; +}; + +#endif diff --git a/src/iface/msinterface.h b/src/iface/msinterface.h index 9f5abf0..db18893 100644 --- a/src/iface/msinterface.h +++ b/src/iface/msinterface.h @@ -25,6 +25,13 @@ class MTemplateStore; class MSInterface:public MInterface { Q_OBJECT + Q_PROPERTY(QString currentUser READ currentUser) + Q_PROPERTY(QString hostName READ hostName) + Q_PROPERTY(QString dataDir READ dataDir) + Q_PROPERTY(QString settingsGroup READ settingsGroup) + Q_PROPERTY(QString sessionId READ sessionId) + Q_PROPERTY(QString repoPart READ repoPart) + Q_PROPERTY(QString profileId READ profileId) public: /**creates the interface object, expects the profile ID as parameter*/ MSInterface(QString); @@ -41,10 +48,10 @@ class MSInterface:public MInterface QString hostName()const{return m_host;} /**returns whether the user is part of this role*/ - bool hasRole(QString s)const{return userroles.contains(s);} + Q_INVOKABLE bool hasRole(QString s)const{return userroles.contains(s);} /**returns whether the user has a particular right*/ - bool hasRight(Right)const; + Q_INVOKABLE bool hasRight(Right)const; /**returns the directory where to store data retrieved from the server*/ QString dataDir()const; @@ -67,7 +74,7 @@ class MSInterface:public MInterface void initialize(); /**returns a pointer to the template storage engine*/ - MTemplateStore* templateStore(){return temp;} + Q_INVOKABLE MTemplateStore* templateStore(){return temp;} /**returns the profile ID of this session*/ QString profileId()const{return profileid;} diff --git a/src/mwin/overview.cpp b/src/mwin/overview.cpp index 365f2e9..f9ac0c5 100644 --- a/src/mwin/overview.cpp +++ b/src/mwin/overview.cpp @@ -4,7 +4,7 @@ // Description: // // -// Author: Konrad Rosenbaum , (C) 2007 +// Author: Konrad Rosenbaum , (C) 2007-2010 // // Copyright: See README/COPYING files that come with this distribution // @@ -16,6 +16,7 @@ #include "passwdchg.h" #include "shipping.h" #include "templatedlg.h" +#include "wizard.h" #include "aclwin.h" #include "carttab.h" @@ -27,6 +28,8 @@ #include "centbox.h" #include "sclock.h" +#include "jsengine.h" + #include #include @@ -75,6 +78,8 @@ MOverview::MOverview(QString pk) m->addAction(tr("Change my &Password"),this,SLOT(setMyPassword())) ->setEnabled(req->hasRight(req->RChangeMyPassword)); m->addSeparator(); + m->addAction(tr("Switch to Wizard..."),this,SLOT(wizardMode())); + m->addSeparator(); m->addAction(tr("&Edit Templates..."),this,SLOT(editTemplates())); m->addAction(tr("&Update Templates Now"),req,SLOT(updateTemplates())); m->addSeparator(); @@ -422,6 +427,12 @@ void MOverview::displaySettings() gl->addWidget(oage=new QSpinBox,cl,1); oage->setRange(0,99999); oage->setValue(maxageo); + gl->setRowMinimumHeight(++cl,5); + QComboBox*udeb; + gl->addWidget(new QLabel(tr("Show script debugger:")),++cl,0); + gl->addWidget(udeb=new QComboBox,cl,1); + udeb->addItems(MScriptEngine::debugModes()); + udeb->setCurrentIndex(MScriptEngine::debugMode()); gl->setRowMinimumHeight(++cl,15); gl->addLayout(hl=new QHBoxLayout,++cl,0,1,2); hl->addStretch(10); @@ -436,6 +447,7 @@ void MOverview::displaySettings() maxageo=oage->value(); set.setValue("maxeventage",maxage); set.setValue("maxorderage",maxageo); + MScriptEngine::setDebugMode(udeb->currentIndex()); } @@ -509,6 +521,15 @@ void MOverview::editTemplates() te.exec(); } +void MOverview::wizardMode() +{ + MWizard wiz(this); + hide(); + wiz.exec(); + show(); +} + + /**********************************************/ MBackupDialog::MBackupDialog(QWidget*par,QString pk) diff --git a/src/mwin/overview.h b/src/mwin/overview.h index 86fdce7..8efba67 100644 --- a/src/mwin/overview.h +++ b/src/mwin/overview.h @@ -100,7 +100,11 @@ class MOverview:public QMainWindow /**open template editor*/ void editTemplates(); + /**switch to wizard mode*/ + void wizardMode(); + private: + friend class MWizard; //the profile associated with this session QString profilekey; //widgets diff --git a/src/script/jsengine.cpp b/src/script/jsengine.cpp new file mode 100644 index 0000000..91b2e31 --- /dev/null +++ b/src/script/jsengine.cpp @@ -0,0 +1,62 @@ +// +// C++ Implementation: JScript Engine for MSmoke +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2010 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include "jsengine.h" +#include "overview.h" +#include "msinterface.h" + +#include +#include +#include + +MScriptEngine::MScriptEngine(MOverview* par) + :QScriptEngine(par) +{ + addObject("MainWindow",par); + req->initScriptEngine(this); + int dm=debugMode(); + if(dm>0){ + QScriptEngineDebugger* deb=new QScriptEngineDebugger(this); + deb->attachTo(this); + if(dm>1) + deb->action(QScriptEngineDebugger::InterruptAction)->trigger(); + } +} +void MScriptEngine::addObject(QString name, QObject* object) +{ + if(name.size()==0)return; + QScriptValue gval=globalObject(); + name[0]=name[0].toUpper(); + gval.setProperty(name, newQMetaObject(object->metaObject())); + name[0]=name[0].toLower(); + gval.setProperty(name, newQObject(object, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater)); +} + +QStringList MScriptEngine::debugModes() +{ + //hint: the semantics of those entries must not change, because their indices are used + return QStringList() + <profileId()+"/JSdebugMode",0).toInt(); +} + +void MScriptEngine::setDebugMode(int v) +{ + if(v>=0 && vprofileId()+"/JSdebugMode",v); +} diff --git a/src/script/jsengine.h b/src/script/jsengine.h new file mode 100644 index 0000000..35ce06d --- /dev/null +++ b/src/script/jsengine.h @@ -0,0 +1,34 @@ +// +// C++ Interface: JScript Engine for MSmoke +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2010 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef MAGICSMOKE_JSENGINE_H +#define MAGICSMOKE_JSENGINE_H + +#include +#include + +class MOverview; + +class MScriptEngine:public QScriptEngine +{ + Q_OBJECT + public: + MScriptEngine(MOverview*); + + void addObject(QString name,QObject*object); + + static QStringList debugModes(); + static int debugMode(); + static void setDebugMode(int); +}; + +#endif diff --git a/src/script/script.pri b/src/script/script.pri new file mode 100644 index 0000000..d7bdab0 --- /dev/null +++ b/src/script/script.pri @@ -0,0 +1,7 @@ +SOURCES += \ + script/jsengine.cpp + +HEADERS += \ + script/jsengine.h + +INCLUDEPATH += ./script \ No newline at end of file diff --git a/src/smoke.pro b/src/smoke.pro index 95e15d9..a6e6474 100644 --- a/src/smoke.pro +++ b/src/smoke.pro @@ -6,7 +6,7 @@ TARGET = ../src/msmoke CONFIG += debug CONFIG += qt thread link_prl -QT += xml network +QT += xml network script scripttools win32-* { #RC-File containing the icon: @@ -40,6 +40,7 @@ include(misc/misc.pri) include(crypto/crypto.pri) include(dialogs/dialogs.pri) include(mwin/mwin.pri) +include(script/script.pri) #build generated stuff last include(wext/wext.pri) diff --git a/src/wext/address.cpp b/src/wext/address.cpp index e136c13..8c00da7 100644 --- a/src/wext/address.cpp +++ b/src/wext/address.cpp @@ -13,8 +13,14 @@ #include "MOAddress" #include +#include -static int moaid=qRegisterMetaType("MOAddress"); +WOSCRIPT_IMP(MOAddress) + +static int moaid= + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >(); QString MOAddress::fullAddress(QString nm)const { diff --git a/src/wext/address.h b/src/wext/address.h index 2555ac9..9405639 100644 --- a/src/wext/address.h +++ b/src/wext/address.h @@ -19,7 +19,9 @@ class MOAddress:public MOAddressAbstract { - WOBJECT(MOAddress); + Q_OBJECT + WOBJECT(MOAddress) + WOSCRIPT(MOAddress) public: /**returns the full address, if name is given and the address does not have its own name, it is included as top line*/ QString fullAddress(QString name=QString())const; @@ -28,6 +30,8 @@ class MOAddress:public MOAddressAbstract bool isValid()const{return !addressid().isNull() && addressid().value()>=0;} }; -Q_DECLARE_METATYPE(MOAddress); +Q_DECLARE_METATYPE(MOAddress) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) #endif diff --git a/src/wext/customer.cpp b/src/wext/customer.cpp index ea62427..b9e3d4f 100644 --- a/src/wext/customer.cpp +++ b/src/wext/customer.cpp @@ -13,6 +13,14 @@ #include "MOCustomer" #include "MOCustomerInfo" #include "msinterface.h" +#include + +static int mymeta= + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >(); + +WOSCRIPT_IMP(MOCustomer) MOCustomer::MOCustomer(qint64 i) { diff --git a/src/wext/customer.h b/src/wext/customer.h index c671e90..fbc7e9b 100644 --- a/src/wext/customer.h +++ b/src/wext/customer.h @@ -19,7 +19,9 @@ class MOCustomerInfo; class MOCustomer:public MOCustomerAbstract { - WOBJECT(MOCustomer); + Q_OBJECT + WOBJECT(MOCustomer) + WOSCRIPT(MOCustomer) public: /**shortcut: gets the customer from the DB*/ MOCustomer(qint64); @@ -39,4 +41,8 @@ class MOCustomer:public MOCustomerAbstract }; +Q_DECLARE_METATYPE(MOCustomer) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) + #endif diff --git a/src/wext/customerinfo.cpp b/src/wext/customerinfo.cpp index 1640591..6937f41 100644 --- a/src/wext/customerinfo.cpp +++ b/src/wext/customerinfo.cpp @@ -11,6 +11,13 @@ // #include "MOCustomerInfo" +#include + +static int mymeta= + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >(); +WOSCRIPT_IMP(MOCustomerInfo) QString MOCustomerInfo::fullName()const { diff --git a/src/wext/customerinfo.h b/src/wext/customerinfo.h index 9f2199d..200899d 100644 --- a/src/wext/customerinfo.h +++ b/src/wext/customerinfo.h @@ -16,7 +16,9 @@ #include "MOCustomerInfoAbstract" class MOCustomerInfo:public MOCustomerInfoAbstract { - WOBJECT(MOCustomerInfo); + Q_OBJECT + WOBJECT(MOCustomerInfo) + WOSCRIPT(MOCustomerInfo) public: /**returns the full name (incl. title)*/ QString fullName()const; @@ -25,4 +27,8 @@ class MOCustomerInfo:public MOCustomerInfoAbstract Nullable id()const{return customerid();} }; +Q_DECLARE_METATYPE(MOCustomerInfo) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) + #endif diff --git a/src/wext/event.cpp b/src/wext/event.cpp index f24f234..044ac2f 100644 --- a/src/wext/event.cpp +++ b/src/wext/event.cpp @@ -15,9 +15,16 @@ #include #include #include +#include #include "msinterface.h" +static int mymeta= + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >(); +WOSCRIPT_IMP(MOEvent) + MOEvent::MOEvent(qint64 i) { MTGetEvent ge=MSInterface::instance()->queryGetEvent(i); diff --git a/src/wext/event.h b/src/wext/event.h index 8b00584..58bc418 100644 --- a/src/wext/event.h +++ b/src/wext/event.h @@ -19,7 +19,9 @@ /**encapsulation of an event, this class wraps the auto-generated event class to provide some convenience methods*/ class MOEvent:public MOEventAbstract { - WOBJECT(MOEvent); + Q_OBJECT + WOBJECT(MOEvent) + WOSCRIPT(MOEvent) public: /**get event directly from server*/ MOEvent(qint64); @@ -44,4 +46,8 @@ class MOEvent:public MOEventAbstract bool isValid()const{return !eventid().isNull() && eventid().value()>0;} }; +Q_DECLARE_METATYPE(MOEvent) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) + #endif diff --git a/src/wext/order.cpp b/src/wext/order.cpp index 7a3c32e..55ec7e7 100644 --- a/src/wext/order.cpp +++ b/src/wext/order.cpp @@ -11,8 +11,22 @@ // #include "MOOrder" +#include "MOOrderInfo" +#include "MORole" #include "msinterface.h" +#include + +static int mymeta= + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >()+ + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >()+ + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >(); MOOrder::MOOrder(qint64 id) { diff --git a/src/wext/order.h b/src/wext/order.h index af0b3b9..384634a 100644 --- a/src/wext/order.h +++ b/src/wext/order.h @@ -21,15 +21,12 @@ /**this class represents a complete order*/ class MOOrder:public MOOrderAbstract { + Q_OBJECT + WOBJECT(MOOrder) + WOSCRIPT(MOOrder) public: - /**creates an invalid/empty order object*/ - MOOrder():MOOrderAbstract(){} /**create order by id, retrieves it automatically from the database*/ MOOrder(qint64); - /**copy constructor*/ - MOOrder(const MOOrder&o):MOOrderAbstract(o){} - /**used by transactions to create order from xml*/ - MOOrder(const QDomElement&e):MOOrderAbstract(e){} /**returns whether the order is valid (it comes from the DB and it has been understood by the parser)*/ bool isValid()const{return !orderid().isNull();} @@ -91,4 +88,8 @@ class MOOrder:public MOOrderAbstract QString fullDeliveryAddress(bool allowfallback=true)const; }; +Q_DECLARE_METATYPE(MOOrder) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) + #endif diff --git a/src/wext/orderinfo.h b/src/wext/orderinfo.h index 6b658d5..76c411c 100644 --- a/src/wext/orderinfo.h +++ b/src/wext/orderinfo.h @@ -18,10 +18,10 @@ class MOOrderInfo:public MOOrderInfoAbstract { + Q_OBJECT + WOBJECT(MOOrderInfo) + WOSCRIPT(MOOrderInfo) public: - MOOrderInfo(const MOOrderInfo&o):MOOrderInfoAbstract(o){} - MOOrderInfo(const QDomElement&e):MOOrderInfoAbstract(e){} - QString totalPriceString()const{return cent2str(totalprice());} QString amountPaidString()const{return cent2str(amountpaid());} QString orderStatusString()const{return OrderState2str(status());} @@ -33,4 +33,8 @@ class MOOrderInfo:public MOOrderInfoAbstract bool isCancelled()const{return status()==Cancelled;} }; +Q_DECLARE_METATYPE(MOOrderInfo) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) + #endif \ No newline at end of file diff --git a/src/wext/role.h b/src/wext/role.h index 6c5e012..e0c99ca 100644 --- a/src/wext/role.h +++ b/src/wext/role.h @@ -14,6 +14,15 @@ #define MAGICSMOKE_MOROLE_H #include "MORoleAbstract" -typedef MORoleAbstract MORole; +class MORole:public MORoleAbstract +{ + Q_OBJECT + WOBJECT(MORole) + WOSCRIPT(MORole) +}; + +Q_DECLARE_METATYPE(MORole) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) #endif \ No newline at end of file diff --git a/src/wext/ticket.cpp b/src/wext/ticket.cpp index 1bf75e3..d442698 100644 --- a/src/wext/ticket.cpp +++ b/src/wext/ticket.cpp @@ -11,7 +11,17 @@ // #include "MOTicket" +#include "MOVoucher" #include "msinterface.h" +#include + +static int mymeta= + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >()+ + qRegisterMetaType()+ + qRegisterMetaType >()+ + qRegisterMetaType >(); MOEvent MOTicket::event()const { diff --git a/src/wext/ticket.h b/src/wext/ticket.h index 34ab3bd..be9d99a 100644 --- a/src/wext/ticket.h +++ b/src/wext/ticket.h @@ -19,7 +19,9 @@ class MOTicket:public MOTicketAbstract { - WOBJECT(MOTicket); + Q_OBJECT + WOBJECT(MOTicket) + WOSCRIPT(MOTicket) public: /**returns the amount to be paid for this ticket; this may be 0 even if there is a price attached*/ int amountToPay()const{if(status()&MaskPay)return price();else return 0;} @@ -42,4 +44,8 @@ class MOTicket:public MOTicketAbstract mutable MOEvent m_event; }; +Q_DECLARE_METATYPE(MOTicket) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) + #endif diff --git a/src/wext/voucher.h b/src/wext/voucher.h index 620684d..908ad84 100644 --- a/src/wext/voucher.h +++ b/src/wext/voucher.h @@ -18,7 +18,9 @@ class MOVoucher:public MOVoucherAbstract { - WOBJECT(MOVoucher); + Q_OBJECT + WOBJECT(MOVoucher) + WOSCRIPT(MOVoucher) public: /**returns whether this is a valid voucher object (ie. it has a voucher ID)*/ bool isValid()const{return !voucherid().isNull();} @@ -30,4 +32,8 @@ class MOVoucher:public MOVoucherAbstract QString priceString()const{return cent2str(price());} }; +Q_DECLARE_METATYPE(MOVoucher) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(Nullable) + #endif diff --git a/src/wext/wext.pri b/src/wext/wext.pri index 2e5b9a3..95b4de0 100644 --- a/src/wext/wext.pri +++ b/src/wext/wext.pri @@ -6,6 +6,7 @@ HEADERS += \ wext/orderinfo.h \ wext/role.h \ wext/ticket.h \ + wext/voucher.h \ wext/address.h \ wext/event.h \ wext/customer.h \ diff --git a/wob/db/basics.wolf b/wob/db/basics.wolf index 0f4e0a2..25bfd32 100644 --- a/wob/db/basics.wolf +++ b/wob/db/basics.wolf @@ -19,5 +19,6 @@ + diff --git a/wob/magicsmoke.wolf b/wob/magicsmoke.wolf index 30e3b7b..3a98892 100644 --- a/wob/magicsmoke.wolf +++ b/wob/magicsmoke.wolf @@ -15,7 +15,7 @@ - + -- 1.7.2.5