X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsyncableobject.cpp;h=f43a155cf1883cda1d5fb7aebffeb0944e853f06;hp=a9417b107ce768d35c1d04122b6d1795ff7c0d2b;hb=c194ed5fb3d15e14b9364f9796d3521910dc72fe;hpb=5b686746c880e5cda6d5de3e08180ea4332ff222 diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index a9417b10..f43a155c 100644 --- a/src/common/syncableobject.cpp +++ b/src/common/syncableobject.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -27,19 +27,14 @@ #include "signalproxy.h" #include "util.h" -INIT_SYNCABLE_OBJECT(SyncableObject) SyncableObject::SyncableObject(QObject *parent) - : QObject(parent), - _initialized(false), - _allowClientUpdates(false) + : QObject(parent) { } SyncableObject::SyncableObject(const QString &objectName, QObject *parent) - : QObject(parent), - _initialized(false), - _allowClientUpdates(false) + : QObject(parent) { setObjectName(objectName); } @@ -114,13 +109,13 @@ QVariantMap SyncableObject::toVariantMap() QVariant::Type variantType = QVariant::nameToType(method.typeName()); if (variantType == QVariant::Invalid && !QByteArray(method.typeName()).isEmpty()) { - qWarning() << "SyncableObject::toVariantMap(): cannot fetch init data for:" << this << method.signature() << "- Returntype is unknown to Qt's MetaSystem:" << QByteArray(method.typeName()); + qWarning() << "SyncableObject::toVariantMap(): cannot fetch init data for:" << this << method.methodSignature() << "- Returntype is unknown to Qt's MetaSystem:" << QByteArray(method.typeName()); continue; } - QVariant value(variantType, (const void *)0); + QVariant value(variantType, (const void *)nullptr); QGenericReturnArgument genericvalue = QGenericReturnArgument(method.typeName(), value.data()); - QMetaObject::invokeMethod(this, methodname.toAscii(), genericvalue); + QMetaObject::invokeMethod(this, methodname.toLatin1(), genericvalue); properties[SignalProxy::ExtendedMetaObject::methodBaseName(method)] = value; } @@ -137,18 +132,18 @@ void SyncableObject::fromVariantMap(const QVariantMap &properties) while (iterator != properties.constEnd()) { propName = iterator.key(); if (propName == "objectName") { - iterator++; + ++iterator; continue; } - int propertyIndex = meta->indexOfProperty(propName.toAscii()); + int propertyIndex = meta->indexOfProperty(propName.toLatin1()); if (propertyIndex == -1 || !meta->property(propertyIndex).isWritable()) setInitValue(propName, iterator.value()); else - setProperty(propName.toAscii(), iterator.value()); + setProperty(propName.toLatin1(), iterator.value()); // qDebug() << "<<< SYNC:" << name << iterator.value(); - iterator++; + ++iterator; } } @@ -159,9 +154,9 @@ bool SyncableObject::setInitValue(const QString &property, const QVariant &value handlername[7] = handlername[7].toUpper(); QString methodSignature = QString("%1(%2)").arg(handlername).arg(value.typeName()); - int methodIdx = metaObject()->indexOfMethod(methodSignature.toAscii().constData()); + int methodIdx = metaObject()->indexOfMethod(methodSignature.toLatin1().constData()); if (methodIdx < 0) { - QByteArray normedMethodName = QMetaObject::normalizedSignature(methodSignature.toAscii().constData()); + QByteArray normedMethodName = QMetaObject::normalizedSignature(methodSignature.toLatin1().constData()); methodIdx = metaObject()->indexOfMethod(normedMethodName.constData()); } if (methodIdx < 0) { @@ -169,7 +164,7 @@ bool SyncableObject::setInitValue(const QString &property, const QVariant &value } QGenericArgument param(value.typeName(), value.constData()); - return QMetaObject::invokeMethod(this, handlername.toAscii(), param); + return QMetaObject::invokeMethod(this, handlername.toLatin1(), param); }