X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsignalproxy.cpp;h=5d302030c06a0d89bf9d2c141b19042a354ae3e0;hp=7808ad1087ca13fff4d98d6b2725fd49667c7d2c;hb=d816b49993aa24d4d2e88975eb92a28cf329a381;hpb=aa7841638c6537034102da959cad8c36853bf280 diff --git a/src/common/signalproxy.cpp b/src/common/signalproxy.cpp index 7808ad10..5d302030 100644 --- a/src/common/signalproxy.cpp +++ b/src/common/signalproxy.cpp @@ -440,6 +440,8 @@ void SignalProxy::setArgTypes(QObject* obj, int methodId) { const QList &SignalProxy::argTypes(QObject *obj, int methodId) { const QMetaObject *meta = metaObject(obj); + if(!_classInfo.contains(meta)) + qDebug() << obj << meta; Q_ASSERT(_classInfo.contains(meta)); if(!_classInfo[meta]->argTypes.contains(methodId)) setArgTypes(obj, methodId); @@ -1107,7 +1109,8 @@ bool SignalProxy::readDataFromDevice(QIODevice *dev, quint32 &blockSize, QVarian bool SignalProxy::methodsMatch(const QMetaMethod &signal, const QMetaMethod &slot) const { // if we don't even have the same basename it's a sure NO - if(methodBaseName(signal) != methodBaseName(slot)) + QString baseName = methodBaseName(signal); + if(baseName != methodBaseName(slot)) return false; // are the signatures compatible? @@ -1115,11 +1118,20 @@ bool SignalProxy::methodsMatch(const QMetaMethod &signal, const QMetaMethod &slo return false; // we take an educated guess if the signals and slots match - QString signalsuffix = ::methodName(signal).mid(QString(::methodName(signal)).lastIndexOf(QRegExp("[A-Z]"))).toLower(); - QString slotprefix = ::methodName(slot).left(QString(::methodName(slot)).indexOf(QRegExp("[A-Z]"))).toLower(); - + QString signalsuffix = ::methodName(signal); + QString slotprefix = ::methodName(slot); + if(!baseName.isEmpty()) { + signalsuffix = signalsuffix.mid(baseName.count()).toLower(); + slotprefix = slotprefix.left(slotprefix.count() - baseName.count()).toLower(); + } + uint sizediff = qAbs(slotprefix.size() - signalsuffix.size()); int ratio = editingDistance(slotprefix, signalsuffix) - sizediff; +// if(ratio < 2) { +// qDebug() << Q_FUNC_INFO; +// qDebug() << methodBaseName(signal) << methodBaseName(slot); +// qDebug() << signalsuffix << slotprefix << sizediff << ratio; +// } return (ratio < 2); } @@ -1273,13 +1285,7 @@ void SignalProxy::dumpSyncMap(SyncableObject *object) { QHash syncMap_ = syncMap(object); QHash::const_iterator iter = syncMap_.constBegin(); while(iter != syncMap_.constEnd()) { - qDebug() << iter.key() << "-->" << iter.value() << meta->method(iter.value()).signature(); + qDebug() << qPrintable(QString("%1 --> %2 %3").arg(QString(iter.key()), 40).arg(iter.value()).arg(QString(meta->method(iter.value()).signature()))); iter++; } -// QHash syncMap_ = syncMap(object); -// QHash::const_iterator iter = syncMap_.constBegin(); -// while(iter != syncMap_.constEnd()) { -// qDebug() << iter.key() << meta->method(iter.key()).signature() << "-->" << iter.value() << meta->method(iter.value()).signature(); -// iter++; -// } }