From f18a6c5fb569ab93e86ca4b75301a7495ba17768 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Mar 2012 11:14:12 -0300 Subject: 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 Reviewed-by: Lorn Potter --- src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 10 +++---- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 53 +++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 66a59b56ec..60fd7302e0 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -129,7 +129,7 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) { // do we need to describe this argument? if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid) - xml += QString::fromLatin1(" \n") + xml += QString::fromLatin1(" \n") .arg(typeNameToXml(mm.normalizedType.constData())); } else { return QString(); @@ -171,7 +171,7 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) { // do we need to describe this argument? if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) { const char *typeName = QMetaType::typeName(types.at(j)); - xml += QString::fromLatin1(" \n") + xml += QString::fromLatin1(" \n") .arg(isOutput ? QLatin1String("Out") : QLatin1String("In")) .arg(isOutput && !isSignal ? j - inputCount : j - 1) .arg(typeNameToXml(typeName)); @@ -233,7 +233,7 @@ static QString generateInterfaceXml(const ClassDef *mo) .arg(QLatin1String(accessvalues[access])); if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) { - retval += QString::fromLatin1(">\n \n \n") + retval += QString::fromLatin1(">\n \n \n") .arg(typeNameToXml(mp.type.constData())); } else { retval += QLatin1String("/>\n"); @@ -277,11 +277,11 @@ QString qDBusInterfaceFromClassDef(const ClassDef *mo) interface.replace(QLatin1String("::"), QLatin1String(".")); if (interface.startsWith(QLatin1String("QDBus"))) { - interface.prepend(QLatin1String("com.trolltech.QtDBus.")); + interface.prepend(QLatin1String("org.qtproject.QtDBus.")); } else if (interface.startsWith(QLatin1Char('Q')) && interface.length() >= 2 && interface.at(1).isUpper()) { // assume it's Qt - interface.prepend(QLatin1String("local.com.trolltech.Qt.")); + interface.prepend(QLatin1String("local.org.qtproject.Qt.")); } else { interface.prepend(QLatin1String("local.")); } diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index cc30567543..8c75c8a27b 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/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 \"/> 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 \"/> 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; } -- cgit v1.2.3