X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fidentity.cpp;h=4eadff9e0e39bb4c27259c7cb0d8b3e0d8b7f84a;hp=eff50215611f2f3df17cc68f5cedf75f8226d19a;hb=53c7a85fd154fa18eab6217bfd4b173307c47e5d;hpb=5d05ab030c24ff57b0e5d00d9d66869c2f934a49 diff --git a/src/common/identity.cpp b/src/common/identity.cpp index eff50215..4eadff9e 100644 --- a/src/common/identity.cpp +++ b/src/common/identity.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -86,10 +86,10 @@ void Identity::setToDefaults() { /*** setters ***/ -// NOTE: DO NOT USE ON SYNCHRONIZED OBJECTS! void Identity::setId(IdentityId _id) { _identityId = _id; - setObjectName(QString::number(id().toInt())); + emit idSet(_id); + renameObject(QString::number(id().toInt())); } void Identity::setIdentityName(const QString &identityName) { @@ -184,9 +184,9 @@ void Identity::setQuitReason(const QString &reason) { /*** ***/ -void Identity::update(const Identity &other) { -for(int idx = metaObject()->propertyOffset(); idx < metaObject()->propertyCount(); idx++) { - QMetaProperty metaProp = metaObject()->property(idx); +void Identity::copyFrom(const Identity &other) { + for(int idx = staticMetaObject.propertyOffset(); idx < staticMetaObject.propertyCount(); idx++) { + QMetaProperty metaProp = staticMetaObject.property(idx); Q_ASSERT(metaProp.isValid()); if(this->property(metaProp.name()) != other.property(metaProp.name())) { setProperty(metaProp.name(), other.property(metaProp.name())); @@ -194,9 +194,9 @@ for(int idx = metaObject()->propertyOffset(); idx < metaObject()->propertyCount( } } -bool Identity::operator==(const Identity &other) { - for(int idx = metaObject()->propertyOffset(); idx < metaObject()->propertyCount(); idx++) { - QMetaProperty metaProp = metaObject()->property(idx); +bool Identity::operator==(const Identity &other) const { + for(int idx = staticMetaObject.propertyOffset(); idx < staticMetaObject.propertyCount(); idx++) { + QMetaProperty metaProp = staticMetaObject.property(idx); Q_ASSERT(metaProp.isValid()); QVariant v1 = this->property(metaProp.name()); QVariant v2 = other.property(metaProp.name()); // qDebug() << v1 << v2; @@ -210,7 +210,7 @@ bool Identity::operator==(const Identity &other) { return true; } -bool Identity::operator!=(const Identity &other) { +bool Identity::operator!=(const Identity &other) const { return !(*this == other); } @@ -228,3 +228,4 @@ QDataStream &operator>>(QDataStream &in, Identity &id) { id.fromVariantMap(i); return in; } +