diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-03-29 14:14:12 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-20 16:32:24 (GMT) |
commit | 0b286344c59b726ad414af0cdd04777425061478 (patch) | |
tree | f53f8ad040a67aab2849f6f033d7404fcf780ba6 | |
parent | 2a392118dae5169de8a5b1eacfd02d02e5dda7be (diff) | |
download | Qt-0b286344c59b726ad414af0cdd04777425061478.zip Qt-0b286344c59b726ad414af0cdd04777425061478.tar.gz Qt-0b286344c59b726ad414af0cdd04777425061478.tar.bz2 |
Update com.trolltech -> org.qtproject in the bootstrapped tools
The tools will now generate the new org.qtproject annotations only,
matching the XML generator in the library. They accept both types of
annotations as input though -- and will generate a warning about the
older one.
This commit should be backported to Qt 4, so XML files can start to be
ported.
Task-number: QTBUG-23274
Change-Id: If298c342ab4774cbca1be1898a01af8b46e80446
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
(cherry-picked from commit f18a6c5fb569ab93e86ca4b75301a7495ba17768)
-rw-r--r-- | tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp index 9510050..7f6463b 100644 --- a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -343,17 +343,28 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection: { int type = QDBusMetaType::signatureToType(signature.toLatin1()); if (type == QVariant::Invalid) { - QString annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName"); + QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName"); if (paramId >= 0) annotationName += QString::fromLatin1(".%1%2").arg(QLatin1String(direction)).arg(paramId); QString qttype = annotations.value(annotationName); if (!qttype.isEmpty()) return qttype.toLatin1(); - fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature)); - fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n", - qPrintable(annotationName)); - exit(1); + QString oldAnnotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName"); + if (paramId >= 0) + oldAnnotationName += QString::fromLatin1(".%1%2").arg(QLatin1String(direction)).arg(paramId); + qttype = annotations.value(annotationName); + + if (qttype.isEmpty()) { + fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature)); + fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n", + qPrintable(annotationName)); + exit(1); + } + + fprintf(stderr, "Warning: deprecated annotation '%s' found; suggest updating to '%s'\n", + qPrintable(oldAnnotationName), qPrintable(annotationName)); + return qttype.toLatin1(); } return QVariant::typeToName(QVariant::Type(type)); @@ -442,21 +453,37 @@ static void writeArgList(QTextStream &ts, const QStringList &argNames, static QString propertyGetter(const QDBusIntrospection::Property &property) { - QString getter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertyGetter")); - if (getter.isEmpty()) { - getter = property.name; - getter[0] = getter[0].toLower(); + QString getter = property.annotations.value(QLatin1String("org.qtproject.QtDBus.PropertyGetter")); + if (!getter.isEmpty()) + return getter; + + getter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertyGetter")); + if (!getter.isEmpty()) { + fprintf(stderr, "Warning: deprecated annotation 'com.trolltech.QtDBus.propertyGetter' found;" + " suggest updating to 'org.qtproject.QtDBus.PropertyGetter'\n"); + return getter; } + + getter = property.name; + getter[0] = getter[0].toLower(); return getter; } static QString propertySetter(const QDBusIntrospection::Property &property) { - QString setter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertySetter")); - if (setter.isEmpty()) { - setter = QLatin1String("set") + property.name; - setter[3] = setter[3].toUpper(); + QString setter = property.annotations.value(QLatin1String("org.qtproject.QtDBus.PropertySetter")); + if (!setter.isEmpty()) + return setter; + + setter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertySetter")); + if (!setter.isEmpty()) { + fprintf(stderr, "Warning: deprecated annotation 'com.trolltech.QtDBus.propertySetter' found;" + " suggest updating to 'org.qtproject.QtDBus.PropertySetter'\n"); + return setter; } + + setter = QLatin1String("set") + property.name; + setter[3] = setter[3].toUpper(); return setter; } |