QXT_INIT_PRIVATE(QxtRPCPeer);
qxt_d().m_rpctype = type;
qxt_d().m_peer = device;
- //qDebug() << device->metaObject()->className();
if (qobject_cast<QAbstractSocket *>(device)!=0)
{
{
if (QxtMetaObject::isSignalOrSlot(rpcFunction.constData()))
{
- spec->rpcFunction = QMetaObject::normalizedSignature(rpcFunction.constData());
+ spec->rpcFunction = QMetaObject::normalizedSignature(rpcFunction);
}
else
{
else if (p8.isNull()) ct = 7;
else if (p9.isNull()) ct = 8;
str << ct;
- if (ct--) str << p1;
- if (ct--) str << p2;
- if (ct--) str << p3;
- if (ct--) str << p4;
- if (ct--) str << p5;
- if (ct--) str << p6;
- if (ct--) str << p7;
- if (ct--) str << p8;
- if (ct--) str << p9;
+ if (ct-- >0 ) str << p1;
+ if (ct-- >0) str << p2;
+ if (ct-- >0) str << p3;
+ if (ct-- >0) str << p4;
+ if (ct-- >0) str << p5;
+ if (ct-- >0) str << p6;
+ if (ct-- >0) str << p7;
+ if (ct-- >0) str << p8;
+ if (ct-- >0) str << p9;
rv.replace(QByteArray("\\"), QByteArray("\\\\"));
rv.replace(QByteArray("\n"), QByteArray("\\n"));
rv.append("\n");
callClientList(cs, fn, p1, p2, p3, p4, p5, p6, p7, p8);
}
-#include <QStringList>
+
#define QXT_ARG(i) ((numParams>i)?QGenericArgument(p ## i .typeName(), p ## i .constData()):QGenericArgument())
void QxtRPCPeerPrivate::receivePeerSignal(QString fn, QVariant p0, QVariant p1, QVariant p2, QVariant p3, QVariant p4, QVariant p5, QVariant p6, QVariant p7, QVariant p8) const
{
QByteArray sig;
int numParams;
- if(!attachedSlots.value(fn).count()) qDebug() << "no attached slot for signal" << fn;// qDebug() << attachedSlots;
foreach(QxtRPCPeerPrivate::MethodID i, attachedSlots.value(fn))
{
sig = i.first->metaObject()->method(i.second).signature();
sig = sig.left(sig.indexOf('('));
- numParams = i.first->metaObject()->method(i.second).parameterTypes().count(); //qDebug() << "calling" << fn << p0 << p1 << p2;
- bool res = QMetaObject::invokeMethod(i.first, sig, QXT_ARG(0), QXT_ARG(1), QXT_ARG(2), QXT_ARG(3), QXT_ARG(4), QXT_ARG(5), QXT_ARG(6), QXT_ARG(7), QXT_ARG(8));
- if(!res) qDebug() << "rpccall failed" << fn << sig << p0 << p1 << p2;
+ numParams = i.first->metaObject()->method(i.second).parameterTypes().count();
+ if(!QMetaObject::invokeMethod(i.first, sig, QXT_ARG(0), QXT_ARG(1), QXT_ARG(2), QXT_ARG(3), QXT_ARG(4), QXT_ARG(5), QXT_ARG(6), QXT_ARG(7), QXT_ARG(8)))
+ {
+ qWarning("QxtRPCPeerPrivate::receivePeerSignal: invokeMethod for \"%s\" failed ",sig.constData());
+ }
}
}
sig = i.first->metaObject()->method(i.second).signature();
sig = sig.left(sig.indexOf('('));
numParams = i.first->metaObject()->method(i.second).parameterTypes().count();
- QMetaObject::invokeMethod(i.first, sig, Q_ARG(quint64, id), QXT_ARG(0), QXT_ARG(1), QXT_ARG(2), QXT_ARG(3), QXT_ARG(4), QXT_ARG(5), QXT_ARG(6), QXT_ARG(7));
+ if(!QMetaObject::invokeMethod(i.first, sig, Q_ARG(quint64, id), QXT_ARG(0), QXT_ARG(1), QXT_ARG(2), QXT_ARG(3), QXT_ARG(4), QXT_ARG(5), QXT_ARG(6), QXT_ARG(7)))
+ {
+ qWarning("QxtRPCPeerPrivate::receiveClientSignal: invokeMethod for \"%s\" failed ",sig.constData());
+ }
}
}
QxtRPCConnection* conn = qxt_d().m_clients.value(sender());
if (!conn)
{
- //qDebug() << qxt_d().m_peer->metaObject()->className();
- if (qxt_d().m_peer!= qobject_cast<QTcpSocket*>(sender()))
+ if (qxt_d().m_peer!= qobject_cast<QIODevice*>(sender()))
{
qWarning() << "QxtRPCPeer: Unrecognized object connected to disconnectSender";
return;