From 5b569528392bf68e40817d917dbf3cf9f06622b1 Mon Sep 17 00:00:00 2001 From: konrad Date: Sat, 8 Aug 2009 20:55:57 +0000 Subject: [PATCH] *rights are enums now *can see the event tab again, no data there yet git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@323 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/files.qrc | 1 - src/mainwindow.cpp | 10 +++ src/mainwindow.h | 1 + src/msinterface.cpp | 22 +++++- src/msinterface.h | 3 + src/overview.cpp | 30 +++++--- src/phpscan.pri | 199 +++++++++++++++++++++++++------------------------- src/ticketrender.cpp | 58 ++++++++++++++- wob/user.wolf | 14 +++- woc/processor.cpp | 7 ++ woc/processor.h | 3 + woc/qtout.cpp | 50 +++++++++++-- woc/qtout.h | 4 +- 13 files changed, 276 insertions(+), 126 deletions(-) diff --git a/src/files.qrc b/src/files.qrc index df22d47..4462340 100644 --- a/src/files.qrc +++ b/src/files.qrc @@ -5,6 +5,5 @@ arrowright.png arrowdown.png arrowdiag.png - version.xml diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1ffa61c..6a61bf0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ MMainWindow::MMainWindow() m->addAction(tr("&Generate Host Key..."),this,SLOT(generateKey())); m->addSeparator(); m->addAction(tr("&OpenOffice.org Settings..."),this,SLOT(openOfficeCfg())); + m->addAction(tr("Set &Default Label Font..."),this,SLOT(setDefaultFont())); mb->addMenu(MApplication::helpMenu()); //create central widget @@ -342,3 +344,11 @@ void MMainWindow::openOfficeCfg() MOfficeConfig c(this); c.exec(); } + +void MMainWindow::setDefaultFont() +{ + QStringList fonts=QFontDatabase().families(); + QString df=QInputDialog::getItem(this,tr("Chose Default Font"),tr("Please chose a default font:"),fonts,fonts.indexOf(QSettings().value("defaultfont","").toString()),false); + if(df.isEmpty())return; + QSettings().setValue("defaultfont",df); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 256d153..f2b8d31 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -55,6 +55,7 @@ class MMainWindow:public QMainWindow void importKey(); void generateKey(); void openOfficeCfg(); + void setDefaultFont(); }; #endif diff --git a/src/msinterface.cpp b/src/msinterface.cpp index 4643cb5..70fb6de 100644 --- a/src/msinterface.cpp +++ b/src/msinterface.cpp @@ -35,7 +35,21 @@ bool MSInterface::login(QString username,QString passwd,QString hostname,QString QMessageBox::warning(0,tr("Warning"),tr("Login failed: %1").arg(tr(lg.errorString().toAscii()))); else setSessionId(lg.getsessionid()); - return lg.stage()==lg.Success; + if(lg.stage()!=lg.Success)return false; + //get rights + MTGetMyRights mrt=MTGetMyRights::query(); + QStringList rsl=mrt.getright(); + for(int i=0;i1)return l[1]; else return svnRepositoryUrl(); } + +bool MSInterface::hasRight(Right r)const +{ + if(userroles.contains("_admin"))return true; + return userrights.contains(r); +} diff --git a/src/msinterface.h b/src/msinterface.h index 9bdd16d..6733260 100644 --- a/src/msinterface.h +++ b/src/msinterface.h @@ -26,6 +26,7 @@ class MSInterface:public MInterface QString currentUser()const{return m_uname;} bool hasRole(QString)const{return false;} + bool hasRight(Right)const; QString dataDir()const; QString settingsGroup()const; /**returns the current session ID*/ @@ -45,6 +46,8 @@ class MSInterface:public MInterface private: QString profileid,m_sessid,m_uname,m_passwd,m_host,m_hostkey; + mutable QListuserrights; + mutable QStringList userroles; }; diff --git a/src/overview.cpp b/src/overview.cpp index f49be4d..80e6d79 100644 --- a/src/overview.cpp +++ b/src/overview.cpp @@ -86,7 +86,8 @@ MOverview::MOverview(QString pk) QMenu*m=mb->addMenu(tr("&Session")); m->addAction(tr("&Re-Login"),this,SLOT(relogin())); m->addAction(tr("&Offline mode"))->setEnabled(false); - m->addAction(tr("Change my &Password"),this,SLOT(setMyPassword())) ->setEnabled(req->hasRole("setmypasswd")); + m->addAction(tr("Change my &Password"),this,SLOT(setMyPassword())) + ->setEnabled(req->hasRight(req->RChangeMyPassword)); m->addSeparator(); m->addAction(tr("&Edit Templates..."),req,SLOT(editTemplates())); m->addAction(tr("&Update Templates Now"),req,SLOT(updateTemplates())); @@ -94,12 +95,14 @@ MOverview::MOverview(QString pk) m->addAction(tr("&Close Session"),this,SLOT(close())); m=mb->addMenu(tr("&Event")); - m->addAction(tr("&Update Event List"),this,SLOT(updateEvents())) ->setEnabled(req->hasRole("geteventlist")); - m->addAction(tr("&Show/Edit details..."),this,SLOT(editEvent())) ->setEnabled(req->hasRole("geteventdata")); + m->addAction(tr("&Update Event List"),this,SLOT(updateEvents())) + ->setEnabled(req->hasRight(req->RGetAllEvents)); + m->addAction(tr("&Show/Edit details..."),this,SLOT(editEvent())) + ->setEnabled(req->hasRight(req->RGetEvent)); m->addAction(tr("&New Event..."),this,SLOT(newEvent()))->setEnabled(req->hasRole("createevent")); m->addSeparator(); showoldevents=m->addAction(tr("Show &old Events"),this,SLOT(updateEvents())); - showoldevents->setEnabled(req->hasRole("geteventlist")); + showoldevents->setEnabled(req->hasRight(req->RGetAllEvents)); showoldevents->setCheckable(true); showoldevents->setChecked(QSettings().value("profiles/"+pk+"/showOldEvents",false).toBool()); @@ -273,6 +276,10 @@ MOverview::MOverview(QString pk) connect(entrancescan,SIGNAL(editingFinished()),this,SLOT(entranceValidate())); vl->addWidget(entrancelabel=new QLabel(" "),10); entrancelabel->setAutoFillBackground(true); + QFont fnt=entrancelabel->font(); + fnt.setBold(true);fnt.setPointSize(24); + entrancelabel->setFont(fnt); + entrancelabel->setAlignment(Qt::AlignCenter); //user tab tab->addTab(usertab=new QWidget,tr("Users")); @@ -340,7 +347,7 @@ MOverview::MOverview(QString pk) //make sure webrequest knows its settings webSettings(false); //fill tables - if(req->hasRole("geteventlist")){ + if(req->hasRight(req->RGetAllEvents)){ updateEvents(); }else{ eventtab->setEnabled(false); @@ -1078,21 +1085,24 @@ void MOverview::entranceValidate() int cev=entranceevent->itemData(ci).toInt(); //check content QString tid=entrancescan->text().trimmed(); + entrancescan->setText(""); //avoid spurious events if(tid=="")return; //avoid double scans QDateTime now=QDateTime::currentDateTime(); - if(tid==lastbarcode && lastbcscan.addSecs(20)>=now){ - entrancescan->setText(""); + if(tid==lastbarcode && lastbcscan.addSecs(20)>=now) return; - } lastbarcode=tid; lastbcscan=now; + //reset display + QPalette pal=entrancelabel->palette(); + QPalette::ColorRole rl=QPalette::Window; + pal.setColor(rl,Qt::lightGray); + entrancelabel->setPalette(pal); + entrancelabel->setText(tr("searching...","entrance control")); //ask the server MTicket tick(req,tid); //decide what to do - QPalette pal=entrancelabel->palette(); - QPalette::ColorRole rl=QPalette::Window; if(!tick.isValid()){ entrancelabel->setText(tr("Ticket \"%1\" Not Valid").arg(tid)); pal.setColor(rl,Qt::red); diff --git a/src/phpscan.pri b/src/phpscan.pri index d78279e..e50d607 100644 --- a/src/phpscan.pri +++ b/src/phpscan.pri @@ -3,131 +3,128 @@ #use genphpscan.sh to regenerate it! HEADERS += \ +../www/admin.php \ ../www/wob.php \ -../www/index.php \ ../www/machine.php \ -../www/admin.php \ -../www/test.php \ -../www/info.php \ -../www/inc/loader_nonadmin.php \ -../www/inc/listing.php \ -../www/inc/rendering/event_listing.php \ -../www/inc/rendering/cart_listing.php \ -../www/inc/rendering/submit.php \ -../www/inc/rendering/order_listing.php \ -../www/inc/loader.php \ -../www/inc/classes/websession.php \ -../www/inc/classes/customer.php \ -../www/inc/classes/voucher.php \ -../www/inc/classes/parser.php \ -../www/inc/classes/random.php \ -../www/inc/classes/error.php \ -../www/inc/classes/room.php \ -../www/inc/classes/ticket.php \ -../www/inc/classes/autoload.php \ -../www/inc/classes/cart.php \ -../www/inc/classes/event.php \ -../www/inc/classes/order.php \ -../www/inc/classes/language_manager.php \ -../www/inc/classes/config_manager.php \ ../www/inc/wbase/schema.php \ ../www/inc/wbase/table.php \ +../www/inc/wbase/exception.php \ ../www/inc/wbase/autoload.php \ ../www/inc/wbase/object.php \ ../www/inc/wbase/transaction.php \ -../www/inc/wbase/exception.php \ -../www/inc/db/db_mysql.php \ -../www/inc/db/db_scheme.php \ -../www/inc/db/autoload.php \ -../www/inc/db/db.php \ +../www/inc/global_variables.php \ +../www/inc/loader.php \ ../www/inc/tr.php \ -../www/inc/wob/wtr_GetAllCustomerNames.php \ -../www/inc/wob/wtr_CreateUser.php \ +../www/inc/loader_nonadmin.php \ ../www/inc/wob/schema.php \ -../www/inc/wob/wt_order.php \ -../www/inc/wob/wt_session.php \ -../www/inc/wob/wt_event.php \ -../www/inc/wob/wt_cart.php \ -../www/inc/wob/wo_User.php \ -../www/inc/wob/wtr_SetUserDescription.php \ -../www/inc/wob/wtr_GetAllHostNames.php \ -../www/inc/wob/wt_room.php \ +../www/inc/wob/wtr_CreateUser.php \ +../www/inc/wob/wtr_DeleteHost.php \ +../www/inc/wob/wtr_DeleteUser.php \ ../www/inc/wob/wt_item.php \ -../www/inc/wob/wt_eventprice.php \ -../www/inc/wob/wtr_GetAllShipping.php \ -../www/inc/wob/wt_customer.php \ -../www/inc/wob/wo_CartVoucher.php \ -../www/inc/wob/wo_Shipping.php \ -../www/inc/wob/wt_host.php \ -../www/inc/wob/wt_country.php \ -../www/inc/wob/wo_Country.php \ -../www/inc/wob/wo_CustomerShort.php \ -../www/inc/wob/wtr_Logout.php \ -../www/inc/wob/wtr_GetUserRoles.php \ -../www/inc/wob/wt_seatplan.php \ -../www/inc/wob/wo_Ticket.php \ -../www/inc/wob/wt_config.php \ -../www/inc/wob/wt_artist.php \ -../www/inc/wob/wtr_SetUserRoles.php \ -../www/inc/wob/wtr_ChangePassword.php \ ../www/inc/wob/wt_contact.php \ -../www/inc/wob/wtr_DeleteUser.php \ -../www/inc/wob/wo_Voucher.php \ -../www/inc/wob/wtr_GetTicket.php \ -../www/inc/wob/wtr_CancelEvent.php \ -../www/inc/wob/wo_Host.php \ -../www/inc/wob/wo_CartOrder.php \ -../www/inc/wob/wt_userhost.php \ -../www/inc/wob/wt_cart_voucher.php \ -../www/inc/wob/wt_voucher.php \ -../www/inc/wob/wo_CartTicket.php \ -../www/inc/wob/wt_ticket.php \ -../www/inc/wob/wtr_GetAllRooms.php \ -../www/inc/wob/wt_moneylog.php \ -../www/inc/wob/wtr_GetMyRights.php \ -../www/inc/wob/wtr_ServerInfo.php \ +../www/inc/wob/wt_cart_item.php \ +../www/inc/wob/wt_user.php \ ../www/inc/wob/wtr_Login.php \ -../www/inc/wob/wtr_GetVoucher.php \ +../www/inc/wob/wtr_GetAllHostNames.php \ +../www/inc/wob/wo_CartTicket.php \ +../www/inc/wob/wt_session.php \ +../www/inc/wob/wo_ContactType.php \ +../www/inc/wob/wo_Room.php \ +../www/inc/wob/wtr_GetMyRoles.php \ ../www/inc/wob/wt_documentlog.php \ -../www/inc/wob/wt_role.php \ -../www/inc/wob/wtr_GetAllHosts.php \ +../www/inc/wob/wtr_CancelEvent.php \ ../www/inc/wob/wtr_GetCustomer.php \ -../www/inc/wob/wo_ContactType.php \ -../www/inc/wob/wt_cart_ticket.php \ -../www/inc/wob/wt_product.php \ -../www/inc/wob/wtr_GetOrder.php \ +../www/inc/wob/wo_CartVoucher.php \ ../www/inc/wob/wtr_SetHost.php \ -../www/inc/wob/wt_template.php \ -../www/inc/wob/wo_Room.php \ +../www/inc/wob/wtr_GetAllUsers.php \ ../www/inc/wob/wtr_GetEvent.php \ +../www/inc/wob/wt_country.php \ +../www/inc/wob/wtr_ChangePassword.php \ +../www/inc/wob/wt_ticket.php \ +../www/inc/wob/wo_Host.php \ +../www/inc/wob/wt_host.php \ ../www/inc/wob/wt_shipping.php \ -../www/inc/wob/wt_user.php \ -../www/inc/wob/wt_contacttype.php \ -../www/inc/wob/wt_address.php \ -../www/inc/wob/wtr_GetMyRoles.php \ -../www/inc/wob/wtr_GetAllUsers.php \ -../www/inc/wob/autoload.php \ -../www/inc/wob/wt_cart_item.php \ -../www/inc/wob/wt_pricecategory.php \ -../www/inc/wob/wo_Address.php \ -../www/inc/wob/wo_Customer.php \ +../www/inc/wob/wo_Contact.php \ +../www/inc/wob/wtr_Logout.php \ ../www/inc/wob/wt_websession.php \ ../www/inc/wob/wtr_GetAllEvents.php \ +../www/inc/wob/wt_template.php \ +../www/inc/wob/wtr_GetTicket.php \ +../www/inc/wob/wt_artist.php \ +../www/inc/wob/wt_customer.php \ +../www/inc/wob/wt_cart_voucher.php \ +../www/inc/wob/wt_order.php \ +../www/inc/wob/wt_userhost.php \ +../www/inc/wob/wt_product.php \ +../www/inc/wob/wtr_SetUserDescription.php \ +../www/inc/wob/wtr_SetUserRoles.php \ +../www/inc/wob/wt_address.php \ +../www/inc/wob/wtr_GetUserRoles.php \ ../www/inc/wob/wo_Order.php \ -../www/inc/wob/transaction.php \ +../www/inc/wob/wt_room.php \ +../www/inc/wob/wo_User.php \ +../www/inc/wob/wtr_GetOrder.php \ ../www/inc/wob/wtr_SetUserHosts.php \ +../www/inc/wob/wtr_ServerInfo.php \ +../www/inc/wob/wt_voucher.php \ ../www/inc/wob/wt_roleright.php \ -../www/inc/wob/wo_Contact.php \ -../www/inc/wob/wtr_GetUserHosts.php \ +../www/inc/wob/wt_seatplan.php \ ../www/inc/wob/wt_userrole.php \ +../www/inc/wob/wtr_GetVoucher.php \ +../www/inc/wob/wtr_GetAllShipping.php \ +../www/inc/wob/wtr_GetAllCustomerNames.php \ +../www/inc/wob/wo_CustomerShort.php \ +../www/inc/wob/wt_event.php \ +../www/inc/wob/wtr_GetUserHosts.php \ +../www/inc/wob/autoload.php \ +../www/inc/wob/wt_config.php \ +../www/inc/wob/wo_Customer.php \ +../www/inc/wob/wt_eventprice.php \ +../www/inc/wob/wt_contacttype.php \ +../www/inc/wob/wo_Ticket.php \ +../www/inc/wob/wo_Country.php \ +../www/inc/wob/wt_pricecategory.php \ +../www/inc/wob/wtr_GetAllHosts.php \ +../www/inc/wob/wtr_GetMyRights.php \ +../www/inc/wob/wt_cart_ticket.php \ +../www/inc/wob/wt_moneylog.php \ +../www/inc/wob/wt_cart.php \ ../www/inc/wob/wo_Event.php \ -../www/inc/wob/wtr_DeleteHost.php \ -../www/inc/global_variables.php \ -../www/inc/global_functions.php \ -../www/inc/machine/host.php \ -../www/inc/machine/version.php \ -../www/inc/machine/template.php \ +../www/inc/wob/wo_Shipping.php \ +../www/inc/wob/wtr_GetAllRooms.php \ +../www/inc/wob/transaction.php \ +../www/inc/wob/wt_role.php \ +../www/inc/wob/wo_Address.php \ +../www/inc/wob/wo_CartOrder.php \ +../www/inc/wob/wo_Voucher.php \ +../www/inc/listing.php \ ../www/inc/machine/session.php \ +../www/inc/machine/version.php \ +../www/inc/machine/host.php \ ../www/inc/machine/autoload.php \ -../www/config.php \ +../www/inc/machine/template.php \ +../www/inc/global_functions.php \ +../www/inc/classes/parser.php \ +../www/inc/classes/config_manager.php \ +../www/inc/classes/ticket.php \ +../www/inc/classes/websession.php \ +../www/inc/classes/voucher.php \ +../www/inc/classes/event.php \ +../www/inc/classes/language_manager.php \ +../www/inc/classes/cart.php \ +../www/inc/classes/room.php \ +../www/inc/classes/random.php \ +../www/inc/classes/error.php \ +../www/inc/classes/customer.php \ +../www/inc/classes/autoload.php \ +../www/inc/classes/order.php \ +../www/inc/rendering/event_listing.php \ +../www/inc/rendering/submit.php \ +../www/inc/rendering/cart_listing.php \ +../www/inc/rendering/order_listing.php \ +../www/inc/db/db_scheme.php \ +../www/inc/db/db.php \ +../www/inc/db/autoload.php \ +../www/inc/db/db_mysql.php \ +../www/index.php \ diff --git a/src/ticketrender.cpp b/src/ticketrender.cpp index 37ec766..5fb3db8 100644 --- a/src/ticketrender.cpp +++ b/src/ticketrender.cpp @@ -12,6 +12,7 @@ #include "ticketrender.h" +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #include "../zip/qunzip.h" @@ -51,6 +53,8 @@ class MLabelRendererPrivate MLabelRenderer*parent; //internal font-IDs QList fdb; + QMapfdbl; + QMapgetfontdb; //image cache: QMap idb; //XML template cache (template.xml) @@ -79,6 +83,9 @@ class MLabelRendererPrivate //converts a size to "natural" coordinates QSizeF tonatural(const QPaintDevice&,QSizeF); + + //returns a system font name + QString getfont(QString); }; MLabelRenderer::MLabelRenderer(MTemplate file) @@ -153,12 +160,14 @@ void MLabelRendererPrivate::prepare(QUnZip&temp) QBuffer buffer; buffer.open(QBuffer::ReadWrite); temp.getCurrentFile(buffer); - int fid=QFontDatabase::addApplicationFontFromData(buffer.data()); + QByteArray fdata=buffer.data(); + int fid=QFontDatabase::addApplicationFontFromData(fdata); if(fid<0){ - qDebug("Label renderer warning: Font could not be loaded: %s",fn.toAscii().data()); + qDebug("Label renderer warning: Font could not be loaded: %s (size: %i, md5: %s)",fn.toAscii().data(),fdata.size(),QCryptographicHash::hash(fdata,QCryptographicHash::Md5).toHex().data()); continue; } fdb.append(fid); + fdbl.insert(fn,QFontDatabase::applicationFontFamilies(fid)); } //check for pictures nl=txml.elementsByTagName("Picture"); @@ -354,7 +363,7 @@ void MLabelRendererPrivate::render(QDomElement&sup, const MLabel&tick, QPaintDev //get text QString text=renderLine(tick,el.text().trimmed()); //get font; TODO: introduce weight and italic settings - QString font=el.attribute("font","Helvetica"); + QString font=getfont(el.attribute("font","%")); int size=el.attribute("fontsize","10").toInt(); if(size<1)size=10; paint->setFont(QFont(font,size)); @@ -370,6 +379,7 @@ void MLabelRendererPrivate::render(QDomElement&sup, const MLabel&tick, QPaintDev else flag|=Qt::AlignVCenter; //render paint->drawText(QRectF(tonatural(pdev,off)+noff,tonatural(pdev,sz)),flag,text); + qDebug("test %s",text.toLatin1().data()); }else if(enm=="Barcode"){ //get attributes @@ -396,6 +406,48 @@ void MLabelRendererPrivate::render(QDomElement&sup, const MLabel&tick, QPaintDev delete paint; } +QString MLabelRendererPrivate::getfont(QString fnt) +{ + QString dfont=QSettings().value("defaultfont","Helvetica").toString(); + //did we already answer this? + if(getfontdb.contains(fnt))return getfontdb[fnt]; + if(fnt=="%")return dfont; + //is it a file name? + if(fnt.size())if(fnt[0]=='@'){ + QString font; + QString fnt2=fnt.mid(1); + if(fdbl.contains(fnt2))if(fdbl[fnt2].size()) + font=fdbl[fnt2][0]; + if(font.isEmpty()){ + qDebug("Label renderer warning: font file %s did not contain font families, using %s instead.",fnt.toAscii().data(),dfont.toAscii().data()); + font=dfont; + } + getfontdb.insert(fnt,font); + } + if(!getfontdb.contains(fnt)){ + QStringList fonts=QFontDatabase().families(); + if(!fonts.contains(fnt)){ + qDebug("Label renderer warning: font %s not found, searching a close match...",fnt.toAscii().data()); + QString font; + for(int i=0;i - + - + - + + + + + + + + + diff --git a/woc/processor.cpp b/woc/processor.cpp index 59d211f..2a10684 100644 --- a/woc/processor.cpp +++ b/woc/processor.cpp @@ -260,6 +260,13 @@ void WocProcessor::errorFound() m_error=true; } +QStringList WocProcessor::transactionNames()const +{ + QStringList l; + for(int i=0;iprojectName(); - 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()); + m_ifacecpp.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"Interface.cpp"); + if(!m_ifacecpp.open(QIODevice::WriteOnly|QIODevice::Truncate)){ + qDebug("Error: cannot create Qt interface file %s.",m_ifacecpp.fileName().toAscii().data()); emit errorFound(); return; } - m_iface.write(QByteArray(SRCSTART).replace('%',m_prefix+"Interface")); - m_iface.write(SRCEND); - m_iface.close(); + m_ifacecpp.write(QByteArray(SRCSTART).replace('%',m_prefix+"Interface")); 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()); @@ -81,6 +79,7 @@ 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(QByteArray("#include \n")); 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 "+m_prefix+"Interface*instance(QString name=\""+pn+"\")\n\t{return qobject_cast<"+m_prefix+"Interface*>(WInterface::instance(name));}\n\n").toAscii()); @@ -106,6 +105,9 @@ WocQtClientOut::~WocQtClientOut(){} void WocQtClientOut::finalize() { + trnList(); + m_ifacecpp.write(SRCEND); + m_ifacecpp.close(); m_iface.write(QByteArray("};\n")+HDREND); m_iface.close(); m_pri.write(QByteArray("\n#END OF AUTOGENERATED PRI FILE\n")); @@ -659,6 +661,42 @@ QString WocQtClientOut::trnOutput(const WocTransaction&trn) return code; } +void WocQtClientOut::trnList() +{ + QString code; + //header + code+=" enum Right {\n NoRight"; + QStringList r=WocProcessor::instance()->transactionNames(); + for(int i=0;i "+m_prefix+"Interface::allKnownRights()\n{\n"; + code+="\tQList ret;ret"; + for(int i=0;i