diff options
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/dbus.pro | 2 | ||||
-rw-r--r-- | src/dbus/qdbusabstractinterface.cpp | 2 | ||||
-rw-r--r-- | src/dbus/qdbusargument.h | 15 | ||||
-rw-r--r-- | src/dbus/qdbusdemarshaller.cpp | 18 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 4 | ||||
-rw-r--r-- | src/dbus/qdbusinternalfilters.cpp | 6 | ||||
-rw-r--r-- | src/dbus/qdbusmetatype.cpp | 1 |
7 files changed, 32 insertions, 16 deletions
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index 46a723a..52ed217 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -12,7 +12,7 @@ contains(QT_CONFIG, dbus-linked) { } # INCLUDEPATH += . -unix { +unix|win32-g++* { QMAKE_PKGCONFIG_DESCRIPTION = Qt \ DBus \ module diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 39debdc..e48e1c0 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -208,7 +208,7 @@ bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const Q QLatin1String(DBUS_INTERFACE_PROPERTIES), QLatin1String("Set")); QDBusMessagePrivate::setParametersValidated(msg, true); - msg << interface << QString::fromUtf8(mp.name()) << qVariantFromValue(QDBusVariant(value)); + msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value)); QDBusMessage reply = connection.call(msg, QDBus::Block); if (reply.type() != QDBusMessage::ReplyMessage) { diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index 2c8693b..e331d8f 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -376,6 +376,21 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QHash<Key, T> & return arg; } +inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantHash &map) +{ + arg.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>()); + QVariantHash::ConstIterator it = map.constBegin(); + QVariantHash::ConstIterator end = map.constEnd(); + for ( ; it != end; ++it) { + arg.beginMapEntry(); + arg << it.key() << QDBusVariant(it.value()); + arg.endMapEntry(); + } + arg.endMap(); + return arg; +} + + QT_END_NAMESPACE Q_DECLARE_METATYPE(QDBusArgument) diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp index ab1455f..3882edb 100644 --- a/src/dbus/qdbusdemarshaller.cpp +++ b/src/dbus/qdbusdemarshaller.cpp @@ -188,11 +188,11 @@ QVariant QDBusDemarshaller::toVariantInternal() { switch (q_dbus_message_iter_get_arg_type(&iterator)) { case DBUS_TYPE_BYTE: - return qVariantFromValue(toByte()); + return QVariant::fromValue(toByte()); case DBUS_TYPE_INT16: - return qVariantFromValue(toShort()); + return QVariant::fromValue(toShort()); case DBUS_TYPE_UINT16: - return qVariantFromValue(toUShort()); + return QVariant::fromValue(toUShort()); case DBUS_TYPE_INT32: return toInt(); case DBUS_TYPE_UINT32: @@ -208,11 +208,11 @@ QVariant QDBusDemarshaller::toVariantInternal() case DBUS_TYPE_STRING: return toString(); case DBUS_TYPE_OBJECT_PATH: - return qVariantFromValue(toObjectPath()); + return QVariant::fromValue(toObjectPath()); case DBUS_TYPE_SIGNATURE: - return qVariantFromValue(toSignature()); + return QVariant::fromValue(toSignature()); case DBUS_TYPE_VARIANT: - return qVariantFromValue(toVariant()); + return QVariant::fromValue(toVariant()); case DBUS_TYPE_ARRAY: switch (q_dbus_message_iter_get_element_type(&iterator)) { @@ -222,14 +222,14 @@ QVariant QDBusDemarshaller::toVariantInternal() case DBUS_TYPE_STRING: return toStringList(); case DBUS_TYPE_DICT_ENTRY: - return qVariantFromValue(duplicate()); + return QVariant::fromValue(duplicate()); default: - return qVariantFromValue(duplicate()); + return QVariant::fromValue(duplicate()); } case DBUS_TYPE_STRUCT: - return qVariantFromValue(duplicate()); + return QVariant::fromValue(duplicate()); default: qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'", diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index bc03896..14138e0 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -832,14 +832,14 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu slotData.slotIdx = -1; slotData.metaTypes.clear(); slotCache.hash.insert(cacheKey, slotData); - object->setProperty(cachePropertyName, qVariantFromValue(slotCache)); + object->setProperty(cachePropertyName, QVariant::fromValue(slotCache)); return false; } } // save to the cache slotCache.hash.insert(cacheKey, slotData); - object->setProperty(cachePropertyName, qVariantFromValue(slotCache)); + object->setProperty(cachePropertyName, QVariant::fromValue(slotCache)); // found the slot to be called deliverCall(object, flags, msg, slotData.metaTypes, slotData.slotIdx); diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp index 35e8b8d..357fa2b 100644 --- a/src/dbus/qdbusinternalfilters.cpp +++ b/src/dbus/qdbusinternalfilters.cpp @@ -264,7 +264,7 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node return propertyNotFoundError(msg, interface_name, property_name); } - return msg.createReply(qVariantFromValue(QDBusVariant(value))); + return msg.createReply(QVariant::fromValue(QDBusVariant(value))); } enum PropertyWriteResult { @@ -334,7 +334,7 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant // we have to demarshall before writing void *null = 0; QVariant other(id, null); - if (!QDBusMetaType::demarshall(qVariantValue<QDBusArgument>(value), id, other.data())) { + if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) { qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " "Use qDBusRegisterMetaType to register it", mp.typeName(), id); @@ -495,7 +495,7 @@ QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &n return interfaceNotFoundError(msg, interface_name); } - return msg.createReply(qVariantFromValue(result)); + return msg.createReply(QVariant::fromValue(result)); } QT_END_NAMESPACE diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index 6de5d93..9f29205 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -127,6 +127,7 @@ void QDBusMetaTypeId::init() registerHelper<QLineF>(); registerHelper<QVariantList>(); registerHelper<QVariantMap>(); + registerHelper<QVariantHash>(); qDBusRegisterMetaType<QList<bool> >(); qDBusRegisterMetaType<QList<short> >(); |