From c9a0b78d7eb89bd7683a129c8d30c495bf55d8f3 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 15 Mar 2009 23:24:10 +0000 Subject: [PATCH] some fixes git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@279 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/phpscan.pri | 11 ++++++++++- src/wbase/WInterface.cpp | 6 ++++++ src/wbase/WInterface.h | 4 ++++ woc/qtout.cpp | 38 ++++++++++++++++++++++++++------------ 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/phpscan.pri b/src/phpscan.pri index c5f4b00..c7adfe9 100644 --- a/src/phpscan.pri +++ b/src/phpscan.pri @@ -6,6 +6,7 @@ HEADERS += \ ../www/inc/db/db_mysql.php \ ../www/inc/db/db_scheme.php \ ../www/inc/db/db.php \ +../www/inc/db/autoload.php \ ../www/inc/wob/wt_cart_ticket.php \ ../www/inc/wob/wt_users.php \ ../www/inc/wob/wt_cart.php \ @@ -14,6 +15,7 @@ HEADERS += \ ../www/inc/wob/wt_room.php \ ../www/inc/wob/wt_moneylog.php \ ../www/inc/wob/wt_customer.php \ +../www/inc/wob/wtr_Login.php \ ../www/inc/wob/wo_CartVoucher.php \ ../www/inc/wob/wt_webuser.php \ ../www/inc/wob/wt_shipping.php \ @@ -25,6 +27,7 @@ HEADERS += \ ../www/inc/wob/autoload.php \ ../www/inc/wob/wt_session.php \ ../www/inc/wob/wo_Order.php \ +../www/inc/wob/transaction.php \ ../www/inc/wob/wt_template.php \ ../www/inc/wob/wt_userhosts.php \ ../www/inc/wob/wo_User.php \ @@ -32,12 +35,16 @@ HEADERS += \ ../www/inc/wob/wo_Ticket.php \ ../www/inc/wob/wo_CartTicket.php \ ../www/inc/wob/wt_cart_voucher.php \ +../www/inc/wob/wtr_GetMyRoles.php \ +../www/inc/wob/wtr_GetTicket.php \ +../www/inc/wob/wtr_ServerInfo.php \ ../www/inc/wob/wt_config.php \ ../www/inc/wob/schema.php \ ../www/inc/wob/wt_ticket.php \ ../www/inc/wbase/exception.php \ ../www/inc/wbase/object.php \ ../www/inc/wbase/autoload.php \ +../www/inc/wbase/transaction.php \ ../www/inc/wbase/table.php \ ../www/inc/wbase/schema.php \ ../www/inc/loader_nonadmin.php \ @@ -46,6 +53,7 @@ HEADERS += \ ../www/inc/machine/version.php \ ../www/inc/machine/host.php \ ../www/inc/machine/cauth_mhash.php \ +../www/inc/machine/autoload.php \ ../www/inc/machine/session.php \ ../www/inc/machine/template.php \ ../www/inc/machine/cauth_string.php \ @@ -68,6 +76,7 @@ HEADERS += \ ../www/inc/classes/cart.php \ ../www/inc/classes/room.php \ ../www/inc/classes/voucher.php \ +../www/inc/classes/autoload.php \ ../www/inc/classes/websession.php \ ../www/inc/classes/error.php \ ../www/test.php \ @@ -75,5 +84,5 @@ HEADERS += \ ../www/config.php \ ../www/machine.php \ ../www/index.php \ -../www/info.php \ +../www/wob.php \ diff --git a/src/wbase/WInterface.cpp b/src/wbase/WInterface.cpp index 4eb4f3a..04b191d 100644 --- a/src/wbase/WInterface.cpp +++ b/src/wbase/WInterface.cpp @@ -37,6 +37,12 @@ WInterface::WInterface(QString name) inst.insert(name,this); } +QString WInterface::name()const +{ + QMutexLocker ml(&mtx); + return inst.key((WInterface*)this); +} + WInterface::~WInterface() { } diff --git a/src/wbase/WInterface.h b/src/wbase/WInterface.h index 5bfe746..5c3625b 100644 --- a/src/wbase/WInterface.h +++ b/src/wbase/WInterface.h @@ -19,6 +19,7 @@ class WInterface:public QObject { + Q_OBJECT protected: WInterface(QString name); @@ -54,6 +55,9 @@ class WInterface:public QObject /**set timeout for page loads in seconds*/ void setWebTimeout(int t){if(t>0)m_wtimeout=t;} + /**get the name for this interface (returns empty string if not registered*/ + QString name()const; + /**returns the instance registered under that name*/ static WInterface*instance(QString); diff --git a/woc/qtout.cpp b/woc/qtout.cpp index f5965e0..fc4323c 100644 --- a/woc/qtout.cpp +++ b/woc/qtout.cpp @@ -63,6 +63,15 @@ WocQtClientOut::WocQtClientOut(QDomElement&el) //create interface class QString pn=WocProcessor::instance()->projectName(); + m_iface.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"Interface.cpp"); + if(!m_iface.open(QIODevice::WriteOnly|QIODevice::Truncate)){ + qDebug("Error: cannot create Qt interface file %s.",m_iface.fileName().toAscii().data()); + emit errorFound(); + return; + } + m_iface.write(QByteArray(SRCSTART).replace('%',m_prefix+"Interface")); + m_iface.write(SRCEND); + m_iface.close(); m_iface.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"Interface.h"); if(!m_iface.open(QIODevice::WriteOnly|QIODevice::Truncate)){ qDebug("Error: cannot create Qt interface file %s.",m_iface.fileName().toAscii().data()); @@ -71,9 +80,9 @@ WocQtClientOut::WocQtClientOut(QDomElement&el) } m_iface.write(QByteArray(HDRSTART).replace("%",m_prefix.toAscii()+"INTERFACE_H")); m_iface.write(QByteArray("#include \""+m_prefix.toAscii()+"Include.h\"\n#include \"WInterface.h\"\n")); - m_iface.write(QString("class "+m_prefix+"Interface:public WInterface\n{\n").toAscii()); + m_iface.write(QString("class "+m_prefix+"Interface:public WInterface\n{\n Q_OBJECT\n").toAscii()); m_iface.write(QString(" public:\n "+m_prefix+"Interface(QString name=\""+pn+"\"):WInterface(name){}\n").toAscii()); - m_iface.write(QString(" static "+pn+"Interface*instance(QString name=\""+pn+"\"){qobject_cast<"+m_prefix+"Interface*>(WInterface::instance(name));}\n").toAscii()); + m_iface.write(QString(" static "+m_prefix+"Interface*instance(QString name=\""+pn+"\")\n\t{return qobject_cast<"+m_prefix+"Interface*>(WInterface::instance(name));}\n\n").toAscii()); //create all includer m_hdr.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"Include.h"); @@ -83,8 +92,7 @@ WocQtClientOut::WocQtClientOut(QDomElement&el) return; } m_hdr.write(QByteArray(HDRSTART).replace("%",m_prefix.toAscii()+"INCLUDE_H")); - m_hdr.write(QByteArray("#include \""+m_prefix.toAscii()+"Interface.h\"\n")); - + addFile(m_prefix.toAscii()+"Interface"); } WocQtClientOut::~WocQtClientOut(){} @@ -455,15 +463,22 @@ void WocQtClientOut::newTransaction(const WocTransaction&trn) inlist+="const "+qttype(trn,in[i],In)+"&a"+in[i]; clist+="a"+in[i]; } - if(inlist!="")inlist+=","; - inlist+="QString iface"; - if(clist!="")clist+=","; - clist+="iface"; for(int i=0;iprojectName()+"\""; hcd="\t"+cn+"("+inlist+defparm+");\n"; scd+=cn+"::"+cn+"("+inlist+")\n\t:WTransaction(iface)\n{\n"; @@ -471,7 +486,6 @@ void WocQtClientOut::newTransaction(const WocTransaction&trn) scd+="\tin_"+in[i]+"=a"+in[i]+";\n"; } scd+="}\n\n"; - hcd+="\t"+cn+"(const "+cn+"&);\n"; scd+=cn+"::"+cn+"(const "+cn+"&t)\n\t:WTransaction(t)\n{\n"; for(int i=0;i