X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsyncableobject.cpp;h=8667a593285398153c8e5a68c8f4c70ce80fbdcc;hp=325f0be32fdd6002dbc539afafd7b19c171da72b;hb=88b350153eb364853e75d237d3eed2dfaf839d59;hpb=70283ef877bdf3339fb067667ad9130ceabd8b9a diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index 325f0be3..8667a593 100644 --- a/src/common/syncableobject.cpp +++ b/src/common/syncableobject.cpp @@ -27,6 +27,7 @@ #include "signalproxy.h" #include "util.h" +INIT_SYNCABLE_OBJECT(SyncableObject) SyncableObject::SyncableObject(QObject *parent) : QObject(parent), _initialized(false), @@ -141,6 +142,17 @@ void SyncableObject::fromVariantMap(const QVariantMap &properties) { bool SyncableObject::setInitValue(const QString &property, const QVariant &value) { QString handlername = QString("initSet") + property; handlername[7] = handlername[7].toUpper(); + + QString methodSignature = QString("%1(%2)").arg(handlername).arg(value.typeName()); + int methodIdx = metaObject()->indexOfMethod(methodSignature.toAscii().constData()); + if(methodIdx < 0) { + QByteArray normedMethodName = QMetaObject::normalizedSignature(methodSignature.toAscii().constData()); + methodIdx = metaObject()->indexOfMethod(normedMethodName.constData()); + } + if(methodIdx < 0) { + return false; + } + QGenericArgument param(value.typeName(), value.constData()); return QMetaObject::invokeMethod(this, handlername.toAscii(), param); } @@ -157,14 +169,15 @@ void SyncableObject::renameObject(const QString &newName) { void SyncableObject::update(const QVariantMap &properties) { fromVariantMap(properties); - emit updated(properties); + SYNC(ARG(properties)) + emit updated(); } void SyncableObject::requestUpdate(const QVariantMap &properties) { if(allowClientUpdates()) { update(properties); } - emit updateRequested(properties); + REQUEST(ARG(properties)) } void SyncableObject::sync_call__(SignalProxy::ProxyMode modeType, const char *funcname, ...) const {