X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsyncableobject.cpp;h=526e47a1359f46d97ac45e950f70343778ef6cf9;hp=426bc86cf28dd3d8f122a7e85285c6af44c5e87c;hb=9e5ced750e86fc8b5d0d6b69b927323a2de7c3ec;hpb=997a62b68d7469a93f373476dd955c44eb051be0 diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index 426bc86c..526e47a1 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 * @@ -34,13 +34,30 @@ SyncableObject::SyncableObject(QObject *parent) { } +SyncableObject::SyncableObject(const QString &objectName, QObject *parent) + : QObject(parent), + _initialized(false), + _allowClientUpdates(false) +{ + setObjectName(objectName); +} + SyncableObject::SyncableObject(const SyncableObject &other, QObject *parent) : QObject(parent), _initialized(other._initialized), - _allowClientUpdates(false) + _allowClientUpdates(other._allowClientUpdates) { } +SyncableObject &SyncableObject::operator=(const SyncableObject &other) { + if(this == &other) + return *this; + + _initialized = other._initialized; + _allowClientUpdates = other._allowClientUpdates; + return *this; +} + bool SyncableObject::isInitialized() const { return _initialized; } @@ -69,7 +86,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; @@ -82,8 +99,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; @@ -101,7 +117,7 @@ void SyncableObject::fromVariantMap(const QVariantMap &properties) { iterator++; continue; } - + int propertyIndex = meta->indexOfProperty(propName.toAscii()); if(propertyIndex == -1 || !meta->property(propertyIndex).isWritable())