From 0f2d6348e07e4e8f606d35a06779af515ff7eee8 Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Wed, 26 Dec 2012 15:47:34 +0100 Subject: [PATCH] update sources for Qt 5; restrict to GCC 4.7 (C++11 support); remove lambda wrappers and restrict to Qt 5.x --- aurora | 2 +- elam | 2 +- pack | 2 +- src/dialogs/configdialog.cpp | 12 ++-- src/dialogs/customerdlg.cpp | 14 ++-- src/dialogs/eventsummary.cpp | 2 +- src/dialogs/orderauditdlg_p.h | 10 +- src/dialogs/orderwin.cpp | 2 +- src/dialogs/payedit.cpp | 2 +- src/iface/msinterface.cpp | 18 ++-- src/iface/sslexception.cpp | 2 +- src/libs.pri | 5 +- src/main.cpp | 4 +- src/misc/cleanup.h | 33 ++++++++ src/misc/code39.cpp | 12 ++-- src/misc/debug.cpp | 12 ++-- src/misc/lambda.h | 57 ------------- src/misc/misc.pri | 4 - src/misc/vlambda.cpp | 105 ------------------------ src/misc/vlambda.h | 129 ------------------------------ src/misc/vlambda_p.h | 172 ---------------------------------------- src/mwin/acltabs.cpp | 14 ++-- src/mwin/carttab.cpp | 6 +- src/mwin/eventstab.cpp | 2 +- src/mwin/orderstab.cpp | 2 +- src/mwin/overview.cpp | 2 +- src/script/jsengine.cpp | 2 +- src/smoke.pro | 10 ++- src/templates/labeldlg.cpp | 13 ++-- src/templates/odfedit.cpp | 26 +++--- src/templates/odtrender.cpp | 2 +- src/templates/templates.cpp | 4 +- src/templates/ticketrender.cpp | 28 +++--- tzone | 2 +- zip/src/qunzip.cpp | 2 +- 35 files changed, 143 insertions(+), 573 deletions(-) create mode 100644 src/misc/cleanup.h delete mode 100644 src/misc/lambda.h delete mode 100644 src/misc/vlambda.cpp delete mode 100644 src/misc/vlambda.h delete mode 100644 src/misc/vlambda_p.h diff --git a/aurora b/aurora index 83e078e..b25f4db 160000 --- a/aurora +++ b/aurora @@ -1 +1 @@ -Subproject commit 83e078e50120072b6800377a8cbf8479c44ec839 +Subproject commit b25f4db535f14b366431f27a6fb9ccaa29a977fa diff --git a/elam b/elam index 533122d..a49453f 160000 --- a/elam +++ b/elam @@ -1 +1 @@ -Subproject commit 533122de7a6e48191f7785fc2d167125eeb342dd +Subproject commit a49453f1414ea094eb5fbd67865659b7d1a65c04 diff --git a/pack b/pack index 53c34c1..6925562 160000 --- a/pack +++ b/pack @@ -1 +1 @@ -Subproject commit 53c34c16932383dcd020fb3ec899820fc093fcd3 +Subproject commit 692556212a82a27a2563852923b89b83faebbb3d diff --git a/src/dialogs/configdialog.cpp b/src/dialogs/configdialog.cpp index 8e8121f..afecf02 100644 --- a/src/dialogs/configdialog.cpp +++ b/src/dialogs/configdialog.cpp @@ -452,9 +452,9 @@ void MConfigDialog::saveKey(QString host,QString key) QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for writing: %2").arg(fn[0]).arg(fd.errorString())); return; } - QString chk=QCryptographicHash::hash(key.toAscii(),QCryptographicHash::Md5).toHex(); + QString chk=QCryptographicHash::hash(key.toLatin1(),QCryptographicHash::Md5).toHex(); QString out="MagicSmokeHostKey\n"+host+"\n"+key+"\n"+chk; - fd.write(out.toAscii()); + fd.write(out.toLatin1()); fd.close(); } @@ -482,7 +482,7 @@ void MConfigDialog::importKey() return; } //read content (max: 10k to limit potential damage) - QStringList fc=QString::fromAscii(fd.read(10240)).split("\n",QString::SkipEmptyParts); + QStringList fc=QString::fromLatin1(fd.read(10240)).split("\n",QString::SkipEmptyParts); fd.close(); //check content if(fc.size()<3){ @@ -503,7 +503,7 @@ void MConfigDialog::importKey() QMessageBox::warning(this,tr("Warning"),tr("This host key file does not contain a valid key.")); return; } - QString chk=QCryptographicHash::hash(key.toAscii(),QCryptographicHash::Md5).toHex(); + QString chk=QCryptographicHash::hash(key.toLatin1(),QCryptographicHash::Md5).toHex(); if(chk!=fc[3].trimmed()){ QMessageBox::warning(this,tr("Warning"),tr("The key check sum did not match. Please get a clean copy of the host key file.")); return; @@ -588,7 +588,7 @@ void MConfigDialog::sslErrors(QNetworkReply*rp,QListerrs) .value(0) #endif ) - .arg(QString::fromAscii(c.digest(QCryptographicHash::Sha1).toHex())) + .arg(QString::fromLatin1(c.digest(QCryptographicHash::Sha1).toHex())) .arg(errs[i].errorString()); } err+=tr("Accept connection anyway?"); @@ -615,7 +615,7 @@ void MConfigDialog::sslFillModel() sslmodel->insertRows(0,lst.size()); for(int i=0;isetData(sslmodel->index(i,0),lst[i].first.subjectInfo(QSslCertificate::CommonName)); - sslmodel->setData(sslmodel->index(i,1),QString::fromAscii(lst[i].first.digest(QCryptographicHash::Sha1).toHex())); + sslmodel->setData(sslmodel->index(i,1),QString::fromLatin1(lst[i].first.digest(QCryptographicHash::Sha1).toHex())); sslmodel->setData(sslmodel->index(i,2),QSslError((QSslError::SslError)lst[i].second).errorString()); } } diff --git a/src/dialogs/customerdlg.cpp b/src/dialogs/customerdlg.cpp index f4587f1..272d72a 100644 --- a/src/dialogs/customerdlg.cpp +++ b/src/dialogs/customerdlg.cpp @@ -13,8 +13,6 @@ #include "customerdlg.h" #include "msinterface.h" #include "misc.h" -#include "lambda.h" -#include "vlambda.h" #include "MTChangeCustomer" #include "MTChangeCustomerMail" @@ -909,20 +907,20 @@ MNewCustomerWizard::MNewCustomerWizard(QWidget* parent, Qt::WindowFlags f): QDia connect(p,SIGNAL(clicked()),this,SLOT(reject())); hl->addWidget(pprev=p=new QPushButton(tr("Back"))); p->setIcon(QIcon(":/prev.png")); - connect(p,SIGNAL(clicked()),new MLambda([=](){sl->setCurrentIndex(sl->currentIndex()-1);},sl),SLOT(call())); + connect(p,&QPushButton::clicked,[=](){sl->setCurrentIndex(sl->currentIndex()-1);}); hl->addWidget(pnext=p=new QPushButton(tr("Next"))); p->setIcon(QIcon(":/next.png")); - connect(p,SIGNAL(clicked()),new MLambda([=](){sl->setCurrentIndex(sl->currentIndex()+1);},sl),SLOT(call())); + connect(p,&QPushButton::clicked,[=](){sl->setCurrentIndex(sl->currentIndex()+1);}); hl->addWidget(pdone=p=new QPushButton(tr("Finish"))); p->setIcon(QIcon(":/done.png")); connect(p,SIGNAL(clicked()),this,SLOT(save())); - auto pagechange=new MVLambda([=](int idx){ + auto pagechange=[=](int idx){ pprev->setEnabled(idx>0); int max=sl->count()-1; pnext->setEnabled(idxsetEnabled(idx>=max); - },sl); - connect(sl,SIGNAL(currentChanged(int)),pagechange,SLOT(call(int))); + }; + connect(sl,&QStackedLayout::currentChanged,pagechange); //get helper data MTGetCreateCustomerHints cch=req->queryGetCreateCustomerHints(); @@ -1006,7 +1004,7 @@ MNewCustomerWizard::MNewCustomerWizard(QWidget* parent, Qt::WindowFlags f): QDia gl->setRowStretch(row,1); //make sure buttons are initialized - pagechange->call(sl->currentIndex()); + pagechange(sl->currentIndex()); //make size changeable setSizeGripEnabled(true); } diff --git a/src/dialogs/eventsummary.cpp b/src/dialogs/eventsummary.cpp index c71ec44..bed6b5d 100644 --- a/src/dialogs/eventsummary.cpp +++ b/src/dialogs/eventsummary.cpp @@ -206,7 +206,7 @@ void MEventSummary::saveas() fd.setAcceptMode(QFileDialog::AcceptSave); fd.setFileMode(QFileDialog::AnyFile); fd.setConfirmOverwrite(true); - fd.setFilter(tr("Open Document File (*.%1)").arg(tf.targetExtension())); + fd.setNameFilter(tr("Open Document File (*.%1)").arg(tf.targetExtension())); fd.setDefaultSuffix(tf.targetExtension()); fd.setDirectory(currentDir()); QString fname; diff --git a/src/dialogs/orderauditdlg_p.h b/src/dialogs/orderauditdlg_p.h index 1f3c441..a82a5b2 100644 --- a/src/dialogs/orderauditdlg_p.h +++ b/src/dialogs/orderauditdlg_p.h @@ -23,10 +23,10 @@ static bool hasMetaValue(QObject*obj,QString n) { const QMetaObject*mobj=obj->metaObject(); //look for property - int id=mobj->indexOfProperty(n.toAscii().data()); + int id=mobj->indexOfProperty(n.toLatin1().data()); if(id>=0)return true; //look for method - id=mobj->indexOfMethod(n.toAscii().data()); + id=mobj->indexOfMethod(n.toLatin1().data()); if(id<0)return false; QMetaMethod mm=mobj->method(id); if(mm.parameterNames().size()!=0)return false; @@ -38,17 +38,17 @@ static QVariant getMetaValue(QObject*obj,QString n) { const QMetaObject*mobj=obj->metaObject(); //look for property - int id=mobj->indexOfProperty(n.toAscii().data()); + int id=mobj->indexOfProperty(n.toLatin1().data()); if(id>=0)return mobj->property(id).read(obj); //look for method - id=mobj->indexOfMethod(n.toAscii().data()); + id=mobj->indexOfMethod(n.toLatin1().data()); if(id<0)return QVariant(); QMetaMethod mm=mobj->method(id); if(mm.parameterNames().size()!=0)return QVariant(); if(QString(mm.typeName()).isEmpty())return QVariant(); //try to invoke int dataid=QMetaType::type(mm.typeName()); - void *data=QMetaType::construct(dataid); + void *data=QMetaType::create(dataid); QVariant ret; if(mm.invoke(obj, Qt::DirectConnection, QGenericReturnArgument(mm.typeName(),data))) ret=QVariant(dataid,data); diff --git a/src/dialogs/orderwin.cpp b/src/dialogs/orderwin.cpp index d9d3875..78bfa5b 100644 --- a/src/dialogs/orderwin.cpp +++ b/src/dialogs/orderwin.cpp @@ -465,7 +465,7 @@ void MOrderWindow::saveBill() fd.setAcceptMode(QFileDialog::AcceptSave); fd.setFileMode(QFileDialog::AnyFile); fd.setConfirmOverwrite(true); - fd.setFilter(tr("Open Document File (*.%1)").arg(tf.targetExtension())); + fd.setNameFilter(tr("Open Document File (*.%1)").arg(tf.targetExtension())); fd.setDefaultSuffix(tf.targetExtension()); fd.setDirectory(currentDir()); QString fname; diff --git a/src/dialogs/payedit.cpp b/src/dialogs/payedit.cpp index 9d74d7b..7627efe 100644 --- a/src/dialogs/payedit.cpp +++ b/src/dialogs/payedit.cpp @@ -393,7 +393,7 @@ void MPaymentDialog::setPType() bool isperc=false; foreach(QChar c,dpat){ if(isperc){ - switch(c.toAscii()){ + switch(c.toLatin1()){ case '%':dtxt+='%';break; case 'Y':dtxt+=QString::number(QDate::currentDate().year());break; case 'M':dtxt+=QDate::currentDate().toString("MM");break; diff --git a/src/iface/msinterface.cpp b/src/iface/msinterface.cpp index 0980564..5df2fc1 100644 --- a/src/iface/msinterface.cpp +++ b/src/iface/msinterface.cpp @@ -71,7 +71,7 @@ bool MSInterface::login(QString username,QString passwd) m_uname=username;m_passwd=passwd; MTLogin lg=MTLogin::query(username,passwd,m_host,m_hostkey); if(lg.stage()==lg.Error) - QMessageBox::warning(0,tr("Warning"),tr("Login failed: %1").arg(tr(lg.errorString().toAscii()))); + QMessageBox::warning(0,tr("Warning"),tr("Login failed: %1").arg(tr(lg.errorString().toLatin1()))); else setSessionId(lg.getsessionid()); if(lg.stage()!=lg.Success)return false; @@ -86,14 +86,14 @@ bool MSInterface::login(QString username,QString passwd) WTransaction::WaitForAll()<load((const uchar*)servertranslation.data(),servertranslation.size()); qApp->installTranslator(trn); - qDebug("MSInterface: successfully loaded server language %s",lang.toAscii().data()); + qDebug("MSInterface: successfully loaded server language %s",lang.toLatin1().data()); MLocalFormat::setDefaultFormat(gl.getformats().value()); } } diff --git a/src/iface/sslexception.cpp b/src/iface/sslexception.cpp index 6b8340e..b806b8e 100644 --- a/src/iface/sslexception.cpp +++ b/src/iface/sslexception.cpp @@ -35,7 +35,7 @@ MSslExceptions::MSslExceptions(QString p) QDomElement el=nl.at(i).toElement(); int e=el.attribute("errorId",0).toInt(); if(e<=0)continue; - QSslCertificate c(el.text().toAscii()); + QSslCertificate c(el.text().toLatin1()); if(c.isNull())continue; sslexcept.append(QPair(c,e)); qDebug()<<"Note: will ignore SSL exception of type"<, (C) 2012 +// +// Copyright: See README/COPYING.GPL files that come with this distribution +// +// + +#ifndef MAGICSMOKE_LAMBDACLEAN_H +#define MAGICSMOKE_LAMBDACLEAN_H + +#include + +///clean-up function: executes a lambda expression when it is destructed (i.e. when the instance leaves its scope +class MCleanup +{ + std::functionm_ptr; + public: + ///instantiates a new cleanup object and remembers the given function for later execution + MCleanup(const std::function&f):m_ptr(f){} + + ///sets a new cleanup function, removing the old one + void setFunction(const std::function&f){m_ptr=f;} + + ///destructs the object and executes the cleanup function + ~MCleanup(){if(m_ptr)m_ptr();} +}; + +#endif diff --git a/src/misc/code39.cpp b/src/misc/code39.cpp index 4cd2238..d559742 100644 --- a/src/misc/code39.cpp +++ b/src/misc/code39.cpp @@ -78,7 +78,7 @@ static char code39mod(QString str) int sum=0; for(int i=0;i %c",str.toAscii().data(),code39mod(str)); +// qDebug("Code-39, encoding: %s -> %c",str.toLatin1().data(),code39mod(str)); //define xpm const char *xpm[4]; - QByteArray xpmsz=QString().sprintf("%i 1 2 1",rstr.size()).toAscii(); + QByteArray xpmsz=QString().sprintf("%i 1 2 1",rstr.size()).toLatin1(); xpm[0]=xpmsz.data(); xpm[1]="0\tg #000000"; xpm[2]="1\tg #FFFFFF"; - QByteArray xpmc=rstr.toAscii(); + QByteArray xpmc=rstr.toLatin1(); xpm[3]=xpmc.data(); //create pixmap return QImage(xpm); diff --git a/src/misc/debug.cpp b/src/misc/debug.cpp index 562ba9d..6d1aa49 100644 --- a/src/misc/debug.cpp +++ b/src/misc/debug.cpp @@ -4,7 +4,7 @@ // Description: // // -// Author: Konrad Rosenbaum , (C) 2008-2011 +// Author: Konrad Rosenbaum , (C) 2008-2012 // // Copyright: See README/COPYING.GPL files that come with this distribution // @@ -21,15 +21,15 @@ static QFile*mylogFile=0; -static void mymsghandler(QtMsgType, const char *msg) +static void mymsghandler(QtMsgType,const QMessageLogContext&, const QString&msg) { if(mylogFile){ - mylogFile->write(msg,strlen(msg)); + mylogFile->write(msg.toLatin1()); mylogFile->write("\n",1); mylogFile->flush(); } #ifdef Q_OS_UNIX - fprintf(stderr,"%s\n",msg); + fprintf(stderr,"%s\n",msg.toLatin1().data()); #endif } @@ -44,8 +44,8 @@ void initDebug() //...open it if(mylogFile->open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text)){ //install as default log - qDebug("Installing debuglog in %s",mylogFile->fileName().toAscii().data()); - qInstallMsgHandler(mymsghandler); + qDebug("Installing debuglog in %s",mylogFile->fileName().toLatin1().data()); + qInstallMessageHandler(mymsghandler); }else{ //hmm, failed to open, well hope that stderr is working... delete mylogFile; diff --git a/src/misc/lambda.h b/src/misc/lambda.h deleted file mode 100644 index 53f451d..0000000 --- a/src/misc/lambda.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// C++ Interface: misc -// -// Description: miscellaneous helper functions -// -// -// Author: Konrad Rosenbaum , (C) 2012 -// -// Copyright: See README/COPYING.GPL files that come with this distribution -// -// - -#ifndef MAGICSMOKE_LAMBDA_H -#define MAGICSMOKE_LAMBDA_H - -#include - -#include - -///wrapper for simple lambda expression, so it can be used with signals -class MLambda:public QObject -{ - Q_OBJECT - private: - std::functionm_ptr; - public: - ///instantiates the lambda object, e.g. - /// \code - ///int x=55; - ///QPushButton button("Push me!"); - ///MLambda lambda([&x](){qDebug()<<"x is"<l,QObject* parent = 0):QObject(parent),m_ptr(l){} - public slots: - ///generic slot that transparently executes the lambda expression - void call(){if(m_ptr)m_ptr();} -}; - -///clean-up function: executes a lambda expression when it is destructed (i.e. when the instance leaves its scope -class MCleanup -{ - std::functionm_ptr; - public: - ///instantiates a new cleanup object and remembers the given function for later execution - MCleanup(const std::function&f):m_ptr(f){} - - ///sets a new cleanup function, removing the old one - void setFunction(const std::function&f){m_ptr=f;} - - ///destructs the object and executes the cleanup function - ~MCleanup(){if(m_ptr)m_ptr();} -}; - -#endif diff --git a/src/misc/misc.pri b/src/misc/misc.pri index a641d8a..926a3c1 100644 --- a/src/misc/misc.pri +++ b/src/misc/misc.pri @@ -4,8 +4,6 @@ HEADERS += \ $$PWD/waitcursor.h \ $$PWD/sclock.h \ $$PWD/formula.h \ - $$PWD/lambda.h \ - $$PWD/vlambda.h \ $$PWD/msengine.h \ $$PWD/dommodel.h @@ -16,9 +14,7 @@ SOURCES += \ $$PWD/waitcursor.cpp \ $$PWD/sclock.cpp \ $$PWD/formula.cpp \ - $$PWD/vlambda.cpp \ $$PWD/msengine.cpp \ $$PWD/dommodel.cpp INCLUDEPATH += $$PWD -QMAKE_CXXFLAGS += -std=gnu++0x \ No newline at end of file diff --git a/src/misc/vlambda.cpp b/src/misc/vlambda.cpp deleted file mode 100644 index 6a7cab3..0000000 --- a/src/misc/vlambda.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// -// C++ Interface: misc -// -// Description: miscellaneous helper functions -// -// -// Author: Konrad Rosenbaum , (C) 2012 -// -// Copyright: See README/COPYING.GPL files that come with this distribution -// -// - -#include "vlambda.h" -// #include - -using namespace std; -using namespace MVLambdaNS; - - -//the static metacall was introduced in Qt 4.8 -#if QT_VERSION >= 0x040800 -//static -void MVLambdaBase::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) -{ - if (_c == QMetaObject::InvokeMetaMethod) { - //Q_ASSERT(staticMetaObject.cast(_o));//there is no static meta-object - MVLambdaBase *_t = static_cast(_o); - if(_id== 0 && _t != nullptr) _t->do_call(_a); - } -} - -//static -const QMetaObjectExtraData MVLambdaBase::staticMetaObjectExtraData = { - 0, MVLambdaBase::qt_static_metacall -}; - -static const short qtmetaversion=6; -#else -const QMetaObjectExtraData MVLambdaBase::staticMetaObjectExtraData = {0,0}; -static const short qtmetaversion=6; -#endif - -MVLambdaBase::MVLambdaBase(int cnt,QByteArray rt, QByteArray cn, QObject* parent) -:QObject(parent),m_count(cnt),m_callparm(cn),m_callret(rt), -qt_meta_data({ // content: - qtmetaversion, // revision - 0, // classname - 0, 0, // classinfo - 1, 14, // methods (14 is start of method info) - 0, 0, // properties - 0, 0, // enums/sets - 0, 0, // constructors - 0, // flags - 0, // signalCount - - // slots: signature, parameters, type, tag, flags - 10, 8, 8, 8, 0x0a, - 0 // eod -}) -{ -// qDebug()<<"instantiated "<= 0x040800 - &MVLambdaBase::staticMetaObjectExtraData -#else - 0 -#endif - }}); -} - -void* MVLambdaNS::MVLambdaBase::qt_metacast(const char* _clname) -{ - if (!_clname) return 0; - if (!strcmp(_clname, "MVLambda")) - return static_cast(this); - return QObject::qt_metacast(_clname); -} - -int MVLambdaBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a) -{ - _id = QObject::qt_metacall(_c, _id, _a); - if (_id < 0) - return _id; - if (_c == QMetaObject::InvokeMetaMethod) { - if (_id < 1) - do_call(_a); - _id -= 1; - } - return _id; -} diff --git a/src/misc/vlambda.h b/src/misc/vlambda.h deleted file mode 100644 index 14fbbea..0000000 --- a/src/misc/vlambda.h +++ /dev/null @@ -1,129 +0,0 @@ -// -// C++ Interface: variadic lambda class -// -// Description: a lambda to slot wrapper that can use arbitrary slot signatures -// -// -// Author: Konrad Rosenbaum , (C) 2012 -// -// Copyright: See README/COPYING.GPL files that come with this distribution -// -// - -#ifndef MAGICSMOKE_VLAMBDA_H -#define MAGICSMOKE_VLAMBDA_H - -#include -#include -#include "vlambda_p.h" - -/// @cond HIDDEN_CODE - -/// Namespace for functions and sub-templates that are internal to the variadic lambda wrapper MVLambda. -namespace MVLambdaNS { -/// workarout for missing "final" keyword in GCC 4.6 -//TODO: remove this as soon as "final" is available -class MVLFinal{protected:MVLFinal(){}}; - -/// abstract base class for variadic lambda wrapper, simulates most of the Q_OBJECT macro -/// you do not need to understand the details, unless you want to enhance it or fix bugs -class MVLambdaBase:public QObject -{ - ///amount of parameters - const int m_count; - ///store the call-signature - const QByteArray m_callparm,m_callret; - ///pointers into the meta data - uint qt_meta_data[20]; - ///the mata data of the artificial slot - QByteArray string_metadata; - ///the meta object of this instance, not static since it is calculated - QMetaObject meta_object; - ///overridden by the template to implement the actual call - virtual void do_call(void**)=0; - ///used by Qt to schedule a call - static void qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a); - ///simulated extra meta data of the lambda class in general - static const QMetaObjectExtraData staticMetaObjectExtraData; - protected: - ///instantiates the instance, used by the template - MVLambdaBase ( int c,QByteArray rt, QByteArray cn, QObject* parent); - - public: - ///returns a pointer to the meta object of this instance (never manipulate it!) - const QMetaObject *metaObject() const{return &meta_object;} - ///cast function, used by Qt - void *qt_metacast(const char *_clname); - ///used by Qt to deliver a call - int qt_metacall(QMetaObject::Call _c, int _id, void **_a); - - ///returns the parameter types of the call method - const QByteArray callParams()const{return m_callparm;} - ///returns the return type of the call method - const QByteArray callReturn()const{return m_callret;} -}; - -//end of namespace -}; -/// @endcond - -///forward declare the lambda wrapper template -templateclass MVLambda; - -/** \brief Wrapper for lambda expression, so it can be used with signals. - -This template allows to connect any lambda expression (or closure, function pointer, object method pointer or functor object) to a signal with compatible argument types by creating a slot with identical signature. - -In its simplest form the slot and lambda expression take no argument and return no values: -\code -int x=55; -QPushButton button("Push me!"); -MVLambda lambda([&x](){qDebug()<<"x is"< lambda([](double d,int i)->int{return d*i;}); -connect(&someobject,SIGNAL(mysig(double,int)),&lambda,SLOT(call(double,int))); -... -\endcode - -The wrapper object will automatically tell Qt about its virtual slot call(...) and will make sure it is called when a connected signal triggers. You can also request its meta object and inquire about its properties. Instances of this template are derived from QObject, so all functionality available in QObject is also available in lambda wrappers. - -\param Ret return type of the lambda being wrapped, also the return type of the generated slot -\param Args variadic list of types of the argument list of the lambda and slot -*/ -template -class MVLambda :public MVLambdaNS::MVLambdaBase,virtual private MVLambdaNS::MVLFinal -{ - private: - ///function pointer... - std::functionm_ptr; - /// interface for the Qt meta object system - virtual void do_call(void**a){ - MVLambdaNS::Call(a,[&](Args...args)->Ret{return this->call(args...);}); - } - public: - ///instantiates the lambda wrapper object - /// \param l the lambda, closure, functor, function or method pointer to execute as a slot - /// \param parent optional: the parent object of this wrapper, you can use this to limit the lifetime of the wrapper object - MVLambda(std::functionl,QObject* parent = 0) - :MVLambdaBase(MVLambdaNS::Count::count, MVLambdaNS::TypeStr::get(), MVLambdaNS::TypeStr::get(), parent), m_ptr(l){} - - ///overwrites the lambda/function that is executed as slot, this does - ///not alter signal-slot-connections - /// \param l new lambda, functor, function or method pointer - void setFunction(std::functionl) - {m_ptr=l;} - - ///Generic slot that transparently executes the lambda expression. - ///If the wrapper was initialized with a nullptr this slot will return a default constructed instance of the return type. - /// \param Args variadic list of arguments (depends on template parameters) - /// \returns an object of the configured return type - either the result of the lambda or a default constructed object - Ret call(Args...args){if(m_ptr)return m_ptr(args...);else return Ret();} -}; - -#endif diff --git a/src/misc/vlambda_p.h b/src/misc/vlambda_p.h deleted file mode 100644 index 7fa470b..0000000 --- a/src/misc/vlambda_p.h +++ /dev/null @@ -1,172 +0,0 @@ -// -// C++ Interface: variadic lambda -// -// Description: helpers for variadic lambda -// -// -// Author: Konrad Rosenbaum , (C) 2012 -// -// Copyright: See README/COPYING.GPL files that come with this distribution -// -// - -#ifndef MAGICSMOKE_VLAMBDA_P_H -#define MAGICSMOKE_VLAMBDA_P_H - -#include -#include -#include -#include - -/// @cond HIDDEN_CODE - -namespace MVLambdaNS { -/// helper for lambda template: determines the string representation of the functions type signature -templateclass TypeStr; - -///recursive version: determines all typenames for more than one type in an argument list -template -class TypeStr{ -public: -static const QByteArray get() -{return TypeStr::get()+","+TypeStr::get();} -}; - -///determines name of a simple type -template -class TypeStr{ -public: static const QByteArray get() -{T t;return QVariant::fromValue(t).typeName();} -}; - -///determines name of a reference type -template -class TypeStr{ -public: static const QByteArray get() -{T t;return QByteArray(QVariant::fromValue(t).typeName())+"&";} -}; -///determine name of a const reference type -template -class TypeStr{ -public: static const QByteArray get() -{T t;return QByteArray("const ")+QVariant::fromValue(t).typeName()+"&";} -}; -///determine name of a pointer type -template -class TypeStr{ -public: static const QByteArray get() -{T t;return QByteArray(QVariant::fromValue(t).typeName())+"*";} -}; -///determine name of a const pointer type -template -class TypeStr{ -public: static const QByteArray get() -{T t;return QByteArray("const ")+QVariant::fromValue(t).typeName()+"*";} -}; - -///fallback for no argument list: returns empty string -template<> -class TypeStr<>{ -public: static const QByteArray get() -{return QByteArray();} -}; - -///returns empty string for a void argument list -template<> -class TypeStr{ -public: static const QByteArray get() -{return QByteArray();} -}; - - - -////////////////////////////////////////////////////// -///template to count an argument list -templateclass Count; - -///recursive version to count a list with at least one element -template -class Count{public: static const int count=Count::count + 1;}; - -///fallback to count an empty argument list or to terminate a list -template<> -class Count<>{public: static const int count=0;}; - - - -/////////////////////////////////////////////////////// -///wrapper type to turn a Qt internal meta call into an actual method call - it turns a void** list into a typed argument list and a return argument -templateclass Call; - -///turns a Qt internal meta call into a method call with return type and multiple arguments -template -class Call -{ - public: - Call(void**vl,std::functioncb) - { - R r; - Call(vl+1,[&](Args...args){r=cb(*reinterpret_cast(vl[0]),args...);}); - if(vl[0])*reinterpret_cast(vl[0])=r; - } -}; -///turns a Qt internal meta call into a method call with return type and a single argument -template -class Call -{ - public: - Call(void**vl,std::functioncb) - { - R r=cb(*reinterpret_cast(vl[1])); - if(vl[0])*reinterpret_cast(vl[0])=r; - } -}; -///turns a Qt internal meta call into a method call with return type and no arguments -template -class Call -{ - public: - Call(void**vl,std::functioncb) - { - R r=cb(); - if(vl[0])*reinterpret_cast(vl[0])=r; - } -}; - -///turns a Qt internal meta call into a method call returning void and multiple arguments -template -class Call -{ - public: - Call(void**vl,std::functioncb) - { - Call(vl+1,[&](Args...args){cb(*reinterpret_cast(vl[1]),args...);}); - } -}; -///turns a Qt internal meta call into a method call returning void and a single argument -template -class Call -{ - public: - Call(void**vl,std::functioncb) - { - cb(*reinterpret_cast(vl[1])); - } -}; -///turns a Qt internal meta call into a method call returning void and no arguments -template<> -class Call -{ - public: - Call(void**,std::functioncb) - { - cb(); - } -}; - -//end of namespace -}; - -/// @endcond - -#endif diff --git a/src/mwin/acltabs.cpp b/src/mwin/acltabs.cpp index e433ead..6b46f8b 100644 --- a/src/mwin/acltabs.cpp +++ b/src/mwin/acltabs.cpp @@ -465,9 +465,9 @@ void MHostTab::changeHostKey() QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for writing: %2").arg(fn[0]).arg(fd.errorString())); return; } - QString chk=QCryptographicHash::hash(key.toAscii(),QCryptographicHash::Md5).toHex(); + QString chk=QCryptographicHash::hash(key.toLatin1(),QCryptographicHash::Md5).toHex(); QString out="MagicSmokeHostKey\n"+name+"\n"+key+"\n"+chk; - fd.write(out.toAscii()); + fd.write(out.toLatin1()); fd.close(); //convert key to hash key=key2hash(key); @@ -499,7 +499,7 @@ void MHostTab::importHost() return; } //read content (max: 10k to limit potential damage) - QStringList fc=QString::fromAscii(fd.read(10240)).split("\n",QString::SkipEmptyParts); + QStringList fc=QString::fromLatin1(fd.read(10240)).split("\n",QString::SkipEmptyParts); fd.close(); //check content if(fc.size()<3){ @@ -517,7 +517,7 @@ void MHostTab::importHost() return; } QString key=fc[2].trimmed(); - QString chk=QCryptographicHash::hash(key.toAscii(),QCryptographicHash::Md5).toHex(); + QString chk=QCryptographicHash::hash(key.toLatin1(),QCryptographicHash::Md5).toHex(); if(chk!=fc[3].trimmed()){ QMessageBox::warning(this,tr("Warning"),tr("The key check sum did not match. Please get a clean copy of the host key file.")); return; @@ -553,7 +553,7 @@ QString MHostTab::key2hash(QString key) if(mkg.exec()!=QDialog::Accepted) return key; salt=mkg.getKey(8); - return salt+" "+ QCryptographicHash::hash((salt+key).toAscii(),QCryptographicHash::Sha1).toHex(); + return salt+" "+ QCryptographicHash::hash((salt+key).toLatin1(),QCryptographicHash::Sha1).toHex(); } @@ -585,9 +585,9 @@ void MHostTab::exportHost() QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for writing: %2").arg(fn[0]).arg(fd.errorString())); return; } - QString chk=QCryptographicHash::hash(key.toAscii(),QCryptographicHash::Md5).toHex(); + QString chk=QCryptographicHash::hash(key.toLatin1(),QCryptographicHash::Md5).toHex(); QString out="MagicSmokeHostHash\n"+name+"\n"+key+"\n"+chk; - fd.write(out.toAscii()); + fd.write(out.toLatin1()); fd.close(); } diff --git a/src/mwin/carttab.cpp b/src/mwin/carttab.cpp index 68eddc8..17a9259 100644 --- a/src/mwin/carttab.cpp +++ b/src/mwin/carttab.cpp @@ -596,7 +596,7 @@ void MCartTab::verifyOrderTickets(const QList&ticks) QModelIndex idx0=cartmodel->index(j,0); if(cartmodel->data(idx0,CART_TYPEROLE).toInt() != CART_TICKET)continue; QModelIndex idx1=cartmodel->index(j,1); - cartmodel->setData(idx1,Qt::red,Qt::BackgroundRole); + cartmodel->setData(idx1,QColor(Qt::red),Qt::BackgroundRole); //check state, color it switch(ticks[i].status().value()){ case MOCartTicket::EventOver: @@ -606,7 +606,7 @@ void MCartTab::verifyOrderTickets(const QList&ticks) cartmodel->setData(idx1,tr("You cannot order tickets for this event anymore, ask a more privileged user."),Qt::ToolTipRole); break; case MOCartTicket::Exhausted:{ - cartmodel->setData(idx0,Qt::red,Qt::BackgroundRole); + cartmodel->setData(idx0,QColor(Qt::red),Qt::BackgroundRole); QString tt=tr("The event is (almost) sold out, there are %1 tickets left.").arg(ticks[i].maxamount()); cartmodel->setData(idx0,tt,Qt::ToolTipRole); cartmodel->setData(idx1,tt,Qt::ToolTipRole); @@ -630,7 +630,7 @@ void MCartTab::verifyOrderVouchers(const QList&voucs) QModelIndex idx0=cartmodel->index(j,0); if(cartmodel->data(idx0,CART_TYPEROLE).toInt() != CART_VOUCHER)continue; QModelIndex idx1=cartmodel->index(j,1); - cartmodel->setData(idx1,Qt::red,Qt::BackgroundRole); + cartmodel->setData(idx1,QColor(Qt::red),Qt::BackgroundRole); //check state, color it switch(voucs[i].status().value()){ case MOCartVoucher::InvalidValue: diff --git a/src/mwin/eventstab.cpp b/src/mwin/eventstab.cpp index ad00701..bf5f94a 100644 --- a/src/mwin/eventstab.cpp +++ b/src/mwin/eventstab.cpp @@ -116,7 +116,7 @@ void MEventsTab::updateEvents() //get events MTGetAllEvents gae=req->queryGetAllEvents(); if(gae.stage()!=gae.Success){ - qDebug("Error getting all events (%s): %s",gae.errorType().toAscii().data(),gae.errorString().toAscii().data()); + qDebug("Error getting all events (%s): %s",gae.errorType().toLatin1().data(),gae.errorString().toLatin1().data()); return; } QListevl=gae.getevents(); diff --git a/src/mwin/orderstab.cpp b/src/mwin/orderstab.cpp index 7d54c27..04090b2 100644 --- a/src/mwin/orderstab.cpp +++ b/src/mwin/orderstab.cpp @@ -343,7 +343,7 @@ void MOrdersTab::orderByOrder() { //ask for OrderID bool ok; - int oid=QInputDialog::getInteger(this,tr("Enter Order ID"),tr("Please enter the ID of the order you want to display:"),0,0,2147483647,1,&ok); + int oid=QInputDialog::getInt(this,tr("Enter Order ID"),tr("Please enter the ID of the order you want to display:"),0,0,2147483647,1,&ok); if(!ok)return; //display MTGetOrder go=req->queryGetOrder(oid); diff --git a/src/mwin/overview.cpp b/src/mwin/overview.cpp index de407d0..b455c5a 100644 --- a/src/mwin/overview.cpp +++ b/src/mwin/overview.cpp @@ -567,7 +567,7 @@ void MOverview::doBackup() //store new data QFile fd(path); if(fd.open(QIODevice::WriteOnly|QIODevice::Truncate)){ - fd.write(bc.getbackup().value().toAscii()); + fd.write(bc.getbackup().value().toLatin1()); fd.close(); set.setValue("backuptime",QDateTime::currentDateTime().toTime_t()); QMessageBox::information(this,tr("Backup"),tr("The backup was successful.")); diff --git a/src/script/jsengine.cpp b/src/script/jsengine.cpp index 2dc96fa..8bacc8e 100644 --- a/src/script/jsengine.cpp +++ b/src/script/jsengine.cpp @@ -140,7 +140,7 @@ class MScriptEngine_DebugHelper h+=QString::number(l,16); return *this; } - ~MScriptEngine_DebugHelper(){qDebug()<addWidget(t_prn=new QLabel(ticket.printerName()),1); hl->addWidget(p=new QToolButton); p->setText("..."); - MLambda settprn([&]{ + auto settprn=[&]{ QPrintDialog pd(&t_printer,&d); if(pd.exec()!=QDialog::Accepted)return; t_prn->setText(t_printer.printerName()); - }); - d.connect(p,SIGNAL(clicked()),&settprn,SLOT(call())); + }; + d.connect(p,&QToolButton::clicked,settprn); QFrame*frm; fl->addRow(frm=new QFrame); frm->setFrameStyle(QFrame::HLine|QFrame::Sunken); @@ -407,12 +406,12 @@ void MLabelConfig::configDialog(QWidget* parent) hl->addWidget(v_prn=new QLabel(voucher.printerName()),1); hl->addWidget(p=new QToolButton); p->setText("..."); - MLambda setvprn([&]{ + auto setvprn=[&]{ QPrintDialog pd(&v_printer,&d); if(pd.exec()!=QDialog::Accepted)return; v_prn->setText(pd.printer()->printerName()); - }); - d.connect(p,SIGNAL(clicked()),&setvprn,SLOT(call())); + }; + d.connect(p,&QToolButton::clicked,setvprn); //button... fl->addRow(new QLabel(" ")); fl->addRow(hl=new QHBoxLayout); diff --git a/src/templates/odfedit.cpp b/src/templates/odfedit.cpp index 4ac33d1..76cd766 100644 --- a/src/templates/odfedit.cpp +++ b/src/templates/odfedit.cpp @@ -15,8 +15,7 @@ #include "misc.h" #include "odtrender.h" #include "dommodel.h" -#include "lambda.h" -#include "vlambda.h" +#include "cleanup.h" #include "orderwin.h" #include "eventsummary.h" @@ -65,6 +64,8 @@ #include #include +#include + class DPTR_CLASS_NAME(MOdfEditor) { @@ -184,16 +185,15 @@ MOdfEditor::MOdfEditor(QWidget* parent, Qt::WindowFlags f): QMainWindow(parent, d->mDomTree->setSelectionMode(QAbstractItemView::ContiguousSelection); d->mDomTree->setSelectionBehavior(QAbstractItemView::SelectRows); d->mDomTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - d->mDomTree->header()->setResizeMode(0,QHeaderView::ResizeToContents); + d->mDomTree->header()->setSectionResizeMode(0,QHeaderView::ResizeToContents); d->mDomTree->header()->setStretchLastSection(false); connect(d->mDomTree->selectionModel(),SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this,SLOT(selectionChange())); - MVLambda *ml; - ml=new MVLambda([=](QPoint p){ + auto ml=[=](QPoint p){ QModelIndex idx=d->mDomTree->indexAt(p); if(idx.isValid()) medit->popup(d->mDomTree->mapToGlobal(p)); - },this); - connect(d->mDomTree,SIGNAL(customContextMenuRequested(QPoint)),ml,SLOT(call(QPoint))); + }; + connect(d->mDomTree,&QTreeView::customContextMenuRequested,ml); d->mDomTree->setContextMenuPolicy(Qt::CustomContextMenu); //the editors... @@ -231,18 +231,18 @@ MOdfEditor::MOdfEditor(QWidget* parent, Qt::WindowFlags f): QMainWindow(parent, connect(d->mTagAttrModel,SIGNAL(rowsRemoved(const QModelIndex&,int,int)), this,SLOT(setChanged())); connect(d->mTagAttrModel,SIGNAL(rowsInserted(const QModelIndex&,int,int)), this,SLOT(setChanged())); vl->addLayout(hl=new QHBoxLayout); - MLambda *btn;QPushButton*p; - btn=new MLambda([=](){d->mTagAttrModel->insertRow(d->mTagAttrModel->rowCount());},this); + QPushButton*p; + std::function btn=[=](){d->mTagAttrModel->insertRow(d->mTagAttrModel->rowCount());}; hl->addStretch(1); hl->addWidget(p=new QPushButton("Add")); - connect(p,SIGNAL(clicked()),btn,SLOT(call())); - btn=new MLambda([=](){ + connect(p,&QPushButton::clicked,btn); + btn=[=](){ QModelIndex idx=d->mTagAttrs->currentIndex(); if(idx.isValid()) d->mTagAttrModel->removeRow(idx.row(),idx.parent()); - },this); + }; hl->addWidget(p=new QPushButton("Remove")); - connect(p,SIGNAL(clicked()),btn,SLOT(call())); + connect(p,&QPushButton::clicked,btn); //loop editor d->st_loop=stack->addWidget(w=new QWidget); w->setLayout(vl=new QVBoxLayout); diff --git a/src/templates/odtrender.cpp b/src/templates/odtrender.cpp index b0a4fe2..5ef0f49 100644 --- a/src/templates/odtrender.cpp +++ b/src/templates/odtrender.cpp @@ -423,7 +423,7 @@ QByteArray MOdtRenderer::convertV1toV2(const QByteArray& old) //find the first real tag and insert the new start tag there if(st!="\n"; hstarted=true; } diff --git a/src/templates/templates.cpp b/src/templates/templates.cpp index a7ffcd9..5e10ea1 100644 --- a/src/templates/templates.cpp +++ b/src/templates/templates.cpp @@ -253,7 +253,7 @@ bool MTemplateStore::setTemplateDescription(QString n,QString d) QSettings set; set.beginGroup("templates/"+profileid+"/"+n); QString o=set.value("description").toString(); - qDebug("setting %s '%s' -> '%s'",n.toAscii().data(),o.toAscii().data(),d.toAscii().data()); + qDebug("setting %s '%s' -> '%s'",n.toLatin1().data(),o.toLatin1().data(),d.toLatin1().data()); if(o==d)return true; //send to server MTSetTemplateDescription std=req->querySetTemplateDescription(n,d); @@ -271,7 +271,7 @@ bool MTemplateStore::setTemplateFlags(QString n, QString flags) QSettings set; set.beginGroup("templates/"+profileid+"/"+n); QString o=set.value("flags").toString(); - qDebug("setting %s '%s' -> '%s'",n.toAscii().data(),o.toAscii().data(),flags.toAscii().data()); + qDebug("setting %s '%s' -> '%s'",n.toLatin1().data(),o.toLatin1().data(),flags.toLatin1().data()); if(o==flags)return true; //send to server MTSetTemplateFlags std=req->querySetTemplateFlags(n,flags); diff --git a/src/templates/ticketrender.cpp b/src/templates/ticketrender.cpp index 958a972..63c048b 100644 --- a/src/templates/ticketrender.cpp +++ b/src/templates/ticketrender.cpp @@ -151,7 +151,7 @@ void MLabelRendererPrivate::prepare(QUnZip&temp) continue; } if(fndb.contains(fn)){ - qDebug("Label renderer warning: Font file %s was loaded more than once. Line %i Column %i.",fn.toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer warning: Font file %s was loaded more than once. Line %i Column %i.",fn.toLatin1().data(),el.lineNumber(),el.columnNumber()); continue; } fndb.append(fn); @@ -165,7 +165,7 @@ void MLabelRendererPrivate::prepare(QUnZip&temp) QByteArray fdata=buffer.data(); int fid=QFontDatabase::addApplicationFontFromData(fdata); if(fid<0){ - 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()); + qDebug("Label renderer warning: Font could not be loaded: %s (size: %i, md5: %s)",fn.toLatin1().data(),fdata.size(),QCryptographicHash::hash(fdata,QCryptographicHash::Md5).toHex().data()); continue; } fdb.append(fid); @@ -195,7 +195,7 @@ void MLabelRendererPrivate::prepare(QUnZip&temp) temp.getCurrentFile(buffer); QImage img; if(!img.loadFromData(buffer.data())){ - qDebug("Label renderer error: Picture file %s could not be interpreted.",fn.toAscii().data()); + qDebug("Label renderer error: Picture file %s could not be interpreted.",fn.toLatin1().data()); //failed pictures are fatal canrender=false; return; @@ -240,7 +240,7 @@ QPointF MLabelRendererPrivate::getoffset(QDomElement&el,bool isfatal) QStringList off=el.attribute("offset").split(" "); if(off.size()!=2){ if(isfatal){ - qDebug("Label renderer error: Illegal offset in %s at line %i column %i.",el.tagName().toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer error: Illegal offset in %s at line %i column %i.",el.tagName().toLatin1().data(),el.lineNumber(),el.columnNumber()); canrender=false; } return QPointF(); @@ -250,7 +250,7 @@ QPointF MLabelRendererPrivate::getoffset(QDomElement&el,bool isfatal) ret.setX(off[0].toDouble(&b)); if(!b){ if(isfatal){ - qDebug("Label renderer error: Illegal offset in %s at line %i column %i.",el.tagName().toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer error: Illegal offset in %s at line %i column %i.",el.tagName().toLatin1().data(),el.lineNumber(),el.columnNumber()); canrender=false; } return QPointF(); @@ -258,7 +258,7 @@ QPointF MLabelRendererPrivate::getoffset(QDomElement&el,bool isfatal) ret.setY(off[1].toDouble(&b)); if(!b){ if(isfatal){ - qDebug("Label renderer error: Illegal offset in %s at line %i column %i.",el.tagName().toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer error: Illegal offset in %s at line %i column %i.",el.tagName().toLatin1().data(),el.lineNumber(),el.columnNumber()); canrender=false; } return QPointF(); @@ -271,7 +271,7 @@ QSizeF MLabelRendererPrivate::getsize(QDomElement&el,bool isfatal) QStringList lst=el.attribute("size").split(" "); if(lst.size()!=2){ if(isfatal){ - qDebug("Label renderer error: Illegal size (%i items) in %s at line %i column %i.",lst.size(),el.tagName().toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer error: Illegal size (%i items) in %s at line %i column %i.",lst.size(),el.tagName().toLatin1().data(),el.lineNumber(),el.columnNumber()); canrender=false; } return QSizeF(); @@ -281,7 +281,7 @@ QSizeF MLabelRendererPrivate::getsize(QDomElement&el,bool isfatal) ret.setWidth(lst[0].toDouble(&b)); if(!b){ if(isfatal){ - qDebug("Label renderer error: Illegal size (invalid width) in %s at line %i column %i.",el.tagName().toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer error: Illegal size (invalid width) in %s at line %i column %i.",el.tagName().toLatin1().data(),el.lineNumber(),el.columnNumber()); canrender=false; } return QSizeF(); @@ -289,7 +289,7 @@ QSizeF MLabelRendererPrivate::getsize(QDomElement&el,bool isfatal) ret.setHeight(lst[1].toDouble(&b)); if(!b){ if(isfatal){ - qDebug("Label renderer error: Illegal size (invalid height) in %s at line %i column %i.",el.tagName().toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer error: Illegal size (invalid height) in %s at line %i column %i.",el.tagName().toLatin1().data(),el.lineNumber(),el.columnNumber()); canrender=false; } return QSizeF(); @@ -400,7 +400,7 @@ void MLabelRendererPrivate::render(QDomElement&sup, const MLabel&tick, QPaintDev QRectF rect(tonatural(pdev,off)+noff,tonatural(pdev,sz)); paint->drawImage(rect,code39(cd)); }else{ - qDebug("Label renderer error: unknown element %s in label template at line %i column %i.",enm.toAscii().data(),el.lineNumber(),el.columnNumber()); + qDebug("Label renderer error: unknown element %s in label template at line %i column %i.",enm.toLatin1().data(),el.lineNumber(),el.columnNumber()); canrender=false; return; } @@ -422,7 +422,7 @@ QString MLabelRendererPrivate::getfont(QString fnt) 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()); + qDebug("Label renderer warning: font file %s did not contain font families, using %s instead.",fnt.toLatin1().data(),dfont.toLatin1().data()); font=dfont; } getfontdb.insert(fnt,font); @@ -430,20 +430,20 @@ QString MLabelRendererPrivate::getfont(QString fnt) 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()); + qDebug("Label renderer warning: font %s not found, searching a close match...",fnt.toLatin1().data()); QString font; for(int i=0;i