X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsyncableobject.cpp;h=aab2857c668e590822a0439d0bbf478d6daabc60;hp=96b159b02e4b410f65b9e719697caec75dffe167;hb=e89cfe68c0b4d117ce79d0d38fcc085de77a3083;hpb=ac21cc48d22f0cf58a98b74754fa94564a8e3f45 diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index 96b159b0..aab2857c 100644 --- a/src/common/syncableobject.cpp +++ b/src/common/syncableobject.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel IRC Team * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -58,6 +58,12 @@ SyncableObject &SyncableObject::operator=(const SyncableObject &other) { return *this; } +void SyncableObject::synchronize(SignalProxy *proxy) { + if(_signalProxies.contains(proxy)) + return; + _signalProxies << proxy; +} + bool SyncableObject::isInitialized() const { return _initialized; } @@ -86,7 +92,7 @@ QVariantMap SyncableObject::toVariantMap() { // ...as well as methods, which have names starting with "init" for(int i = 0; i < meta->methodCount(); i++) { QMetaMethod method = meta->method(i); - QString methodname(::methodName(method)); + QString methodname(SignalProxy::ExtendedMetaObject::methodName(method)); if(!methodname.startsWith("init") || methodname.startsWith("initSet") || methodname.startsWith("initDone")) continue; @@ -99,8 +105,7 @@ QVariantMap SyncableObject::toVariantMap() { QGenericReturnArgument genericvalue = QGenericReturnArgument(method.typeName(), &value); QMetaObject::invokeMethod(this, methodname.toAscii(), genericvalue); - properties[SignalProxy::methodBaseName(method)] = value; - // qDebug() << ">>> SYNC:" << methodBaseName(method) << value; + properties[SignalProxy::ExtendedMetaObject::methodBaseName(method)] = value; } // properties["Payload"] = QByteArray(10000000, 'a'); // for testing purposes return properties; @@ -156,3 +161,13 @@ void SyncableObject::requestUpdate(const QVariantMap &properties) { } emit updateRequested(properties); } + +void SyncableObject::sync_call__(SignalProxy::ProxyMode modeType, const char *funcname, ...) { + qDebug() << Q_FUNC_INFO << modeType << funcname; + foreach(SignalProxy *proxy, _signalProxies) { + va_list ap; + va_start(ap, funcname); + proxy->syncCall(this, modeType, funcname, ap); + va_end(ap); + } +}