summaryrefslogtreecommitdiffstats
path: root/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp')
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index 5b8de7c2ab..b4c23da628 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -32,7 +32,6 @@
****************************************************************************/
#include <qbytearray.h>
-#include <qdatetime.h>
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -49,7 +48,7 @@
#define PROGRAMNAME "qdbusxml2cpp"
#define PROGRAMVERSION "0.8"
-#define PROGRAMCOPYRIGHT "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies)."
+#define PROGRAMCOPYRIGHT "Copyright (C) 2015 The Qt Company Ltd."
#define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply"
@@ -58,7 +57,6 @@ static QString parentClassName;
static QString proxyFile;
static QString adaptorFile;
static QString inputFile;
-static QDateTime classCreationTime;
static bool skipNamespaces;
static bool verbose;
static bool includeMocs;
@@ -212,10 +210,8 @@ static QDBusIntrospection::Interfaces readInput()
QFile input(inputFile);
if (inputFile.isEmpty() || inputFile == QLatin1String("-")) {
input.open(stdin, QIODevice::ReadOnly);
- classCreationTime = QDateTime::currentDateTime();
} else {
input.open(QIODevice::ReadOnly);
- classCreationTime = QFileInfo(input).lastModified();
}
QByteArray data = input.readAll();
@@ -488,6 +484,15 @@ static QString propertySetter(const QDBusIntrospection::Property &property)
return setter;
}
+static QString methodName(const QDBusIntrospection::Method &method)
+{
+ QString name = method.annotations.value(QStringLiteral("org.qtproject.QtDBus.MethodName"));
+ if (!name.isEmpty())
+ return name;
+
+ return method.name;
+}
+
static QString stringify(const QString &data)
{
QString retval;
@@ -551,9 +556,8 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
} else {
includeGuard = QLatin1String("QDBUSXML2CPP_PROXY");
}
- includeGuard = QString(QLatin1String("%1_%2"))
- .arg(includeGuard)
- .arg(classCreationTime.toTime_t());
+ includeGuard = QString(QLatin1String("%1"))
+ .arg(includeGuard);
hs << "#ifndef " << includeGuard << endl
<< "#define " << includeGuard << endl
<< endl;
@@ -679,7 +683,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
hs << "> ";
}
- hs << method.name << "(";
+ hs << methodName(method) << "(";
QStringList argNames = makeArgNames(method.inputArgs);
writeArgList(hs, argNames, method.annotations, method.inputArgs);
@@ -859,9 +863,8 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
} else {
includeGuard = QLatin1String("QDBUSXML2CPP_ADAPTOR");
}
- includeGuard = QString(QLatin1String("%1_%2"))
- .arg(includeGuard)
- .arg(QDateTime::currentDateTime().toTime_t());
+ includeGuard = QString(QLatin1String("%1"))
+ .arg(includeGuard);
hs << "#ifndef " << includeGuard << endl
<< "#define " << includeGuard << endl
<< endl;
@@ -1012,7 +1015,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
cs << returnType << " ";
}
- QString name = method.name;
+ QString name = methodName(method);
hs << name << "(";
cs << className << "::" << name << "(";
@@ -1023,7 +1026,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
hs << ");" << endl; // finished for header
cs << ")" << endl
<< "{" << endl
- << " // handle method call " << interface->name << "." << method.name << endl;
+ << " // handle method call " << interface->name << "." << methodName(method) << endl;
// make the call
bool usingInvokeMethod = false;