diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-03-15 12:57:25 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-15 19:36:01 +0100 |
commit | e640c3bcfefe02261cfa74227128da70837cc834 (patch) | |
tree | dc0fff70da401e15c4adea98c839d6b14fee1128 /src/dbus/qdbusmetatype.cpp | |
parent | 43a176804fbfae86e3bccb7f1a84816d4ae9c7ff (diff) |
Make more of QDBus bootstrapping-ready.
The DBus metatype system and marshaller is required for determining
the dbus-signature of built-in Qt types, for example QPoint.
Change-Id: I8860ab3b88827aeb8063dfb79c4a9b28c0a20c0f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusmetatype.cpp')
-rw-r--r-- | src/dbus/qdbusmetatype.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index 1cbac43441..b5a138f654 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -50,11 +50,11 @@ #include <qvector.h> #include "qdbusmetatype_p.h" +#include "qdbusargument_p.h" +#include "qdbusutil_p.h" +#include "qdbusunixfiledescriptor.h" #ifndef QT_BOOTSTRAPPED #include "qdbusmessage.h" -#include "qdbusunixfiledescriptor.h" -#include "qdbusutil_p.h" -#include "qdbusargument_p.h" #endif #ifndef QT_NO_DBUS @@ -75,20 +75,6 @@ Q_DECLARE_METATYPE(QList<double>) QT_BEGIN_NAMESPACE -#ifdef QT_BOOTSTRAPPED -int QDBusMetaTypeId::message = QMetaType::User + 1; -int QDBusMetaTypeId::argument = QMetaType::User + 2; -int QDBusMetaTypeId::variant = QMetaType::User + 3; -int QDBusMetaTypeId::objectpath = QMetaType::User + 4; -int QDBusMetaTypeId::signature = QMetaType::User + 5; -int QDBusMetaTypeId::error = QMetaType::User + 6; -int QDBusMetaTypeId::unixfd = QMetaType::User + 7; - -void QDBusMetaTypeId::init() -{ - -} -#else class QDBusCustomTypeInfo { public: @@ -127,13 +113,15 @@ void QDBusMetaTypeId::init() // reentrancy is not a problem since everything else is locked on their own // set the guard variable at the end if (!initialized) { +#ifndef QT_BOOTSTRAPPED // register our types with QtCore message = qRegisterMetaType<QDBusMessage>("QDBusMessage"); + error = qRegisterMetaType<QDBusError>("QDBusError"); +#endif argument = qRegisterMetaType<QDBusArgument>("QDBusArgument"); variant = qRegisterMetaType<QDBusVariant>("QDBusVariant"); objectpath = qRegisterMetaType<QDBusObjectPath>("QDBusObjectPath"); signature = qRegisterMetaType<QDBusSignature>("QDBusSignature"); - error = qRegisterMetaType<QDBusError>("QDBusError"); unixfd = qRegisterMetaType<QDBusUnixFileDescriptor>("QDBusUnixFileDescriptor"); #ifndef QDBUS_NO_SPECIALTYPES @@ -166,6 +154,11 @@ void QDBusMetaTypeId::init() qDBusRegisterMetaType<QList<QDBusUnixFileDescriptor> >(); #endif +#if QT_BOOTSTRAPPED + const int lastId = qDBusRegisterMetaType<QList<QDBusUnixFileDescriptor> >(); + message = lastId + 1; + error = lastId + 2; +#endif initialized = true; } } @@ -306,12 +299,16 @@ bool QDBusMetaType::demarshall(const QDBusArgument &arg, int id, void *data) } else df = info.demarshall; } - +#ifndef QT_BOOTSTRAPPED QDBusArgument copy = arg; df(copy, data); +#else + Q_UNUSED(arg); + Q_UNUSED(data); + Q_UNUSED(df); +#endif return true; } -#endif /*! \fn QDBusMetaType::signatureToType(const char *signature) @@ -464,7 +461,6 @@ const char *QDBusMetaType::typeToSignature(int type) else if (type == QDBusMetaTypeId::unixfd) return DBUS_TYPE_UNIX_FD_AS_STRING; -#ifndef QT_BOOTSTRAPPED // try the database QVector<QDBusCustomTypeInfo> *ct = customTypes(); { @@ -494,9 +490,6 @@ const char *QDBusMetaType::typeToSignature(int type) info->signature = signature; } return info->signature; -#else - return 0; -#endif } QT_END_NAMESPACE |