aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/reference/modules/qt-modules.qdoc25
-rw-r--r--src/lib/qtprofilesetup/qtprofilesetup.cpp4
-rw-r--r--src/lib/qtprofilesetup/templates.qrc2
-rw-r--r--src/lib/qtprofilesetup/templates/dbus.js47
-rw-r--r--src/lib/qtprofilesetup/templates/dbus.qbs69
-rw-r--r--tests/auto/blackbox/testdata/dbus-adaptors/car.cpp137
-rw-r--r--tests/auto/blackbox/testdata/dbus-adaptors/car.h73
-rw-r--r--tests/auto/blackbox/testdata/dbus-adaptors/car.qbs19
-rw-r--r--tests/auto/blackbox/testdata/dbus-adaptors/car.xml11
-rw-r--r--tests/auto/blackbox/testdata/dbus-adaptors/main.cpp72
-rw-r--r--tests/auto/blackbox/testdata/dbus-interfaces/car.xml11
-rw-r--r--tests/auto/blackbox/testdata/dbus-interfaces/controller.cpp82
-rw-r--r--tests/auto/blackbox/testdata/dbus-interfaces/controller.h69
-rw-r--r--tests/auto/blackbox/testdata/dbus-interfaces/controller.qbs20
-rw-r--r--tests/auto/blackbox/testdata/dbus-interfaces/controller.ui64
-rw-r--r--tests/auto/blackbox/testdata/dbus-interfaces/main.cpp52
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp12
-rw-r--r--tests/auto/blackbox/tst_blackbox.h2
18 files changed, 771 insertions, 0 deletions
diff --git a/doc/reference/modules/qt-modules.qdoc b/doc/reference/modules/qt-modules.qdoc
index 60e70fb87..549f304c7 100644
--- a/doc/reference/modules/qt-modules.qdoc
+++ b/doc/reference/modules/qt-modules.qdoc
@@ -373,6 +373,31 @@
\li The base name of the \c uic tool. Set this if your system uses a name such as "uic-qt4".
\endtable
+ \section1 dbus Properties
+
+ \table
+ \header
+ \li Property
+ \li Type
+ \li Default
+ \li Description
+ \row
+ \li xml2cppName
+ \li \c{string}
+ \li \c{"qdbusxml2cpp"}
+ \li The base name of the \c qdbusxml2cpp tool. Set this if your system uses a different name.
+ \row
+ \li xml2CppHeaderFlags
+ \li \c{stringList}
+ \li empty list
+ \li Additional flags when running the \c qdbusxml2cpp tool to create header files.
+ \row
+ \li xml2CppSourceFlags
+ \li \c{stringList}
+ \li empty list
+ \li Additional flags when running the \c qdbusxml2cpp tool to create source files.
+ \endtable
+
\section1 quick Properties
\table
diff --git a/src/lib/qtprofilesetup/qtprofilesetup.cpp b/src/lib/qtprofilesetup/qtprofilesetup.cpp
index 834762999..982fe085f 100644
--- a/src/lib/qtprofilesetup/qtprofilesetup.cpp
+++ b/src/lib/qtprofilesetup/qtprofilesetup.cpp
@@ -213,6 +213,10 @@ static void createModules(Profile &profile, Settings *settings,
&allFiles);
} else if (module.qbsName == QLatin1String("gui")) {
moduleTemplateFileName = QLatin1String("gui.qbs");
+ } else if (module.qbsName == QLatin1String("dbus")) {
+ moduleTemplateFileName = QLatin1String("dbus.qbs");
+ copyTemplateFile(QLatin1String("dbus.js"), qbsQtModuleDir, profile, qtEnvironment,
+ &allFiles);
} else if (module.qbsName == QLatin1String("phonon")) {
moduleTemplateFileName = QLatin1String("phonon.qbs");
} else if (module.isPlugin) {
diff --git a/src/lib/qtprofilesetup/templates.qrc b/src/lib/qtprofilesetup/templates.qrc
index 0a89bd8e6..257e89a54 100644
--- a/src/lib/qtprofilesetup/templates.qrc
+++ b/src/lib/qtprofilesetup/templates.qrc
@@ -9,5 +9,7 @@
<file>templates/plugin.qbs</file>
<file>templates/qdoc.js</file>
<file>templates/QtPlugin.qbs</file>
+ <file>templates/dbus.js</file>
+ <file>templates/dbus.qbs</file>
</qresource>
</RCC>
diff --git a/src/lib/qtprofilesetup/templates/dbus.js b/src/lib/qtprofilesetup/templates/dbus.js
new file mode 100644
index 000000000..e2b0ff3ab
--- /dev/null
+++ b/src/lib/qtprofilesetup/templates/dbus.js
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing
+**
+** This file is part of the Qt Build Suite.
+**
+** Commercial License Usage
+** 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 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
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** 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, 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.
+**
+****************************************************************************/
+function createCommands(product, input, outputs, option)
+{
+ var exe = ModUtils.moduleProperty(product, "binPath") + '/'
+ + ModUtils.moduleProperty(product, "xml2cppName");
+ var hppOutput = outputs["hpp"][0];
+ var hppArgs = ModUtils.moduleProperty(product, "xml2CppHeaderFlags");
+ hppArgs.push(option, hppOutput.filePath + ':', input.filePath);
+ var hppCmd = new Command(exe, hppArgs)
+ hppCmd.description = "qdbusxml2cpp " + input.fileName + " -> " + hppOutput.fileName;
+ hppCmd.highlight = "codegen";
+ var cppOutput = outputs["cpp"][0];
+ var cppArgs = ModUtils.moduleProperty(product, "xml2CppSourceFlags");
+ cppArgs.push("-i", hppOutput.filePath, option, ':' + cppOutput.filePath, input.filePath);
+ var cppCmd = new Command(exe, cppArgs)
+ cppCmd.description = "qdbusxml2cpp " + input.fileName + " -> " + cppOutput.fileName;
+ cppCmd.highlight = "codegen";
+ return [hppCmd, cppCmd];
+}
diff --git a/src/lib/qtprofilesetup/templates/dbus.qbs b/src/lib/qtprofilesetup/templates/dbus.qbs
new file mode 100644
index 000000000..d7d5d0b59
--- /dev/null
+++ b/src/lib/qtprofilesetup/templates/dbus.qbs
@@ -0,0 +1,69 @@
+import qbs 1.0
+import qbs.FileInfo
+import qbs.ModUtils
+import "../QtModule.qbs" as QtModule
+import "dbus.js" as DBus
+
+QtModule {
+ qtModuleName: "DBus"
+
+ property string xml2cppName: "qdbusxml2cpp"
+ property stringList xml2CppHeaderFlags: []
+ property stringList xml2CppSourceFlags: []
+
+ Rule {
+ inputs: ["qt.dbus.adaptor"]
+
+ Artifact {
+ filePath: "GeneratedFiles/" + input.completeBaseName + "_adaptor.h"
+ fileTags: ["hpp"]
+ }
+ Artifact {
+ filePath: "GeneratedFiles/" + input.completeBaseName + "_adaptor.cpp"
+ fileTags: ["cpp"]
+ }
+
+ prepare: {
+ return DBus.createCommands(product, input, outputs, "-a");
+ }
+ }
+
+ Rule {
+ inputs: ["qt.dbus.interface"]
+
+ Artifact {
+ filePath: "GeneratedFiles/" + input.completeBaseName + "_interface.h"
+ fileTags: ["hpp"]
+ }
+ Artifact {
+ filePath: "GeneratedFiles/" + input.completeBaseName + "_interface.cpp"
+ fileTags: ["cpp"]
+ }
+
+ prepare: {
+ return DBus.createCommands(product, input, outputs, "-p");
+ }
+ }
+
+ staticLibsDebug: @staticLibsDebug@
+ staticLibsRelease: @staticLibsRelease@
+ dynamicLibsDebug: @dynamicLibsDebug@
+ dynamicLibsRelease: @dynamicLibsRelease@
+ linkerFlagsDebug: @linkerFlagsDebug@
+ linkerFlagsRelease: @linkerFlagsRelease@
+ frameworksDebug: @frameworksDebug@
+ frameworksRelease: @frameworksRelease@
+ frameworkPathsDebug: @frameworkPathsDebug@
+ frameworkPathsRelease: @frameworkPathsRelease@
+ libNameForLinkerDebug: @libNameForLinkerDebug@
+ libNameForLinkerRelease: @libNameForLinkerRelease@
+ libFilePathDebug: @libFilePathDebug@
+ libFilePathRelease: @libFilePathRelease@
+
+ cpp.defines: @defines@
+ cpp.includePaths: @includes@
+ cpp.libraryPaths: @libraryPaths@
+
+ @special_properties@
+}
+
diff --git a/tests/auto/blackbox/testdata/dbus-adaptors/car.cpp b/tests/auto/blackbox/testdata/dbus-adaptors/car.cpp
new file mode 100644
index 000000000..8f7716234
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-adaptors/car.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "car.h"
+#include <QtWidgets/QtWidgets>
+#include <math.h>
+
+static const double Pi = 3.14159265358979323846264338327950288419717;
+
+QRectF Car::boundingRect() const
+{
+ return QRectF(-35, -81, 70, 115);
+}
+
+Car::Car() : color(Qt::green), wheelsAngle(0), speed(0)
+{
+ startTimer(1000 / 33);
+ setFlag(QGraphicsItem::ItemIsMovable, true);
+ setFlag(QGraphicsItem::ItemIsFocusable, true);
+}
+
+void Car::accelerate()
+{
+ if (speed < 10)
+ ++speed;
+}
+
+void Car::decelerate()
+{
+ if (speed > -10)
+ --speed;
+}
+
+void Car::turnLeft()
+{
+ if (wheelsAngle > -30)
+ wheelsAngle -= 5;
+}
+
+void Car::turnRight()
+{
+ if (wheelsAngle < 30)
+ wheelsAngle += 5;
+}
+
+void Car::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+
+ painter->setBrush(Qt::gray);
+ painter->drawRect(-20, -58, 40, 2); // front axel
+ painter->drawRect(-20, 7, 40, 2); // rear axel
+
+ painter->setBrush(color);
+ painter->drawRect(-25, -79, 50, 10); // front wing
+
+ painter->drawEllipse(-25, -48, 50, 20); // side pods
+ painter->drawRect(-25, -38, 50, 35); // side pods
+ painter->drawRect(-5, 9, 10, 10); // back pod
+
+ painter->drawEllipse(-10, -81, 20, 100); // main body
+
+ painter->drawRect(-17, 19, 34, 15); // rear wing
+
+ painter->setBrush(Qt::black);
+ painter->drawPie(-5, -51, 10, 15, 0, 180 * 16);
+ painter->drawRect(-5, -44, 10, 10); // cocpit
+
+ painter->save();
+ painter->translate(-20, -58);
+ painter->rotate(wheelsAngle);
+ painter->drawRect(-10, -7, 10, 15); // front left
+ painter->restore();
+
+ painter->save();
+ painter->translate(20, -58);
+ painter->rotate(wheelsAngle);
+ painter->drawRect(0, -7, 10, 15); // front left
+ painter->restore();
+
+ painter->drawRect(-30, 0, 12, 17); // rear left
+ painter->drawRect(19, 0, 12, 17); // rear right
+}
+
+void Car::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+
+ const qreal axelDistance = 54;
+ qreal wheelsAngleRads = (wheelsAngle * Pi) / 180;
+ qreal turnDistance = ::cos(wheelsAngleRads) * axelDistance * 2;
+ qreal turnRateRads = wheelsAngleRads / turnDistance; // rough estimate
+ qreal turnRate = (turnRateRads * 180) / Pi;
+ qreal rotation = speed * turnRate;
+
+ setTransform(QTransform().rotate(rotation), true);
+ setTransform(QTransform::fromTranslate(0, -speed), true);
+ update();
+}
diff --git a/tests/auto/blackbox/testdata/dbus-adaptors/car.h b/tests/auto/blackbox/testdata/dbus-adaptors/car.h
new file mode 100644
index 000000000..d7aff9cb5
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-adaptors/car.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CAR_H
+#define CAR_H
+
+#include <QGraphicsObject>
+#include <QBrush>
+
+class Car : public QGraphicsObject
+{
+ Q_OBJECT
+public:
+ Car();
+ QRectF boundingRect() const;
+
+public Q_SLOTS:
+ void accelerate();
+ void decelerate();
+ void turnLeft();
+ void turnRight();
+
+Q_SIGNALS:
+ void crashed();
+
+protected:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void timerEvent(QTimerEvent *event);
+
+private:
+ QBrush color;
+ qreal wheelsAngle; // used when applying rotation
+ qreal speed; // delta movement along the body axis
+};
+
+#endif // CAR_H
diff --git a/tests/auto/blackbox/testdata/dbus-adaptors/car.qbs b/tests/auto/blackbox/testdata/dbus-adaptors/car.qbs
new file mode 100644
index 000000000..3f7b0b405
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-adaptors/car.qbs
@@ -0,0 +1,19 @@
+import qbs
+
+CppApplication {
+ name: "car"
+ condition: Qt.dbus.present
+ Depends { name: "Qt.dbus"; required: false }
+ Depends { name: "Qt.widgets" }
+ files: [
+ "car.cpp",
+ "car.h",
+ "main.cpp",
+ ]
+
+ Group {
+ name: "DBUS Adaptor"
+ files: ["car.xml"]
+ fileTags: ["qt.dbus.adaptor"]
+ }
+}
diff --git a/tests/auto/blackbox/testdata/dbus-adaptors/car.xml b/tests/auto/blackbox/testdata/dbus-adaptors/car.xml
new file mode 100644
index 000000000..6d8c9d19f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-adaptors/car.xml
@@ -0,0 +1,11 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/com/trollech/examples/car">
+ <interface name="org.example.Examples.CarInterface">
+ <method name="accelerate"/>
+ <method name="decelerate"/>
+ <method name="turnLeft"/>
+ <method name="turnRight"/>
+ <signal name="crashed"/>
+ </interface>
+</node> \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata/dbus-adaptors/main.cpp b/tests/auto/blackbox/testdata/dbus-adaptors/main.cpp
new file mode 100644
index 000000000..9db5d1d68
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-adaptors/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "car.h"
+#include "car_adaptor.h"
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QGraphicsView>
+#include <QtWidgets/QGraphicsScene>
+#include <QtDBus/QDBusConnection>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QGraphicsScene scene;
+ scene.setSceneRect(-500, -500, 1000, 1000);
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+
+ Car *car = new Car();
+ scene.addItem(car);
+
+ QGraphicsView view(&scene);
+ view.setRenderHint(QPainter::Antialiasing);
+ view.setBackgroundBrush(Qt::darkGray);
+ view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Qt DBus Controlled Car"));
+ view.resize(400, 300);
+ view.show();
+
+ new CarInterfaceAdaptor(car);
+ QDBusConnection connection = QDBusConnection::sessionBus();
+ connection.registerObject("/Car", car);
+ connection.registerService("org.example.CarExample");
+
+ return app.exec();
+}
diff --git a/tests/auto/blackbox/testdata/dbus-interfaces/car.xml b/tests/auto/blackbox/testdata/dbus-interfaces/car.xml
new file mode 100644
index 000000000..6d8c9d19f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-interfaces/car.xml
@@ -0,0 +1,11 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/com/trollech/examples/car">
+ <interface name="org.example.Examples.CarInterface">
+ <method name="accelerate"/>
+ <method name="decelerate"/>
+ <method name="turnLeft"/>
+ <method name="turnRight"/>
+ <signal name="crashed"/>
+ </interface>
+</node> \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata/dbus-interfaces/controller.cpp b/tests/auto/blackbox/testdata/dbus-interfaces/controller.cpp
new file mode 100644
index 000000000..5f7dd0c38
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-interfaces/controller.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets>
+
+#include "controller.h"
+#include "car_interface.h"
+
+Controller::Controller(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+ car = new org::example::Examples::CarInterface("org.example.CarExample", "/Car",
+ QDBusConnection::sessionBus(), this);
+ startTimer(1000);
+}
+
+void Controller::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+ if (car->isValid())
+ ui.label->setText("connected");
+ else
+ ui.label->setText("disconnected");
+}
+
+void Controller::on_accelerate_clicked()
+{
+ car->accelerate();
+}
+
+void Controller::on_decelerate_clicked()
+{
+ car->decelerate();
+}
+
+void Controller::on_left_clicked()
+{
+ car->turnLeft();
+}
+
+void Controller::on_right_clicked()
+{
+ car->turnRight();
+}
diff --git a/tests/auto/blackbox/testdata/dbus-interfaces/controller.h b/tests/auto/blackbox/testdata/dbus-interfaces/controller.h
new file mode 100644
index 000000000..f13bbad66
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-interfaces/controller.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CONTROLLER_H
+#define CONTROLLER_H
+
+#include "ui_controller.h"
+#include "car_interface.h"
+
+class Controller : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Controller(QWidget *parent = 0);
+
+protected:
+ void timerEvent(QTimerEvent *event);
+
+private slots:
+ void on_accelerate_clicked();
+ void on_decelerate_clicked();
+ void on_left_clicked();
+ void on_right_clicked();
+
+private:
+ Ui::Controller ui;
+ org::example::Examples::CarInterface *car;
+};
+
+#endif
+
diff --git a/tests/auto/blackbox/testdata/dbus-interfaces/controller.qbs b/tests/auto/blackbox/testdata/dbus-interfaces/controller.qbs
new file mode 100644
index 000000000..b5fb3d698
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-interfaces/controller.qbs
@@ -0,0 +1,20 @@
+import qbs
+
+CppApplication {
+ name: "controller"
+ condition: Qt.dbus.present
+ Depends { name: "Qt.dbus"; required: false }
+ Depends { name: "Qt.widgets" }
+ files: [
+ "controller.cpp",
+ "controller.h",
+ "controller.ui",
+ "main.cpp",
+ ]
+
+ Group {
+ name: "DBUS Interface"
+ files: ["car.xml"]
+ fileTags: ["qt.dbus.interface"]
+ }
+}
diff --git a/tests/auto/blackbox/testdata/dbus-interfaces/controller.ui b/tests/auto/blackbox/testdata/dbus-interfaces/controller.ui
new file mode 100644
index 000000000..379015bf3
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-interfaces/controller.ui
@@ -0,0 +1,64 @@
+<ui version="4.0" >
+ <class>Controller</class>
+ <widget class="QWidget" name="Controller" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>255</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Controller</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Controller</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QPushButton" name="decelerate" >
+ <property name="text" >
+ <string>Decelerate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QPushButton" name="accelerate" >
+ <property name="text" >
+ <string>Accelerate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="right" >
+ <property name="text" >
+ <string>Right</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QPushButton" name="left" >
+ <property name="text" >
+ <string>Left</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/blackbox/testdata/dbus-interfaces/main.cpp b/tests/auto/blackbox/testdata/dbus-interfaces/main.cpp
new file mode 100644
index 000000000..26c92c693
--- /dev/null
+++ b/tests/auto/blackbox/testdata/dbus-interfaces/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets>
+#include <QtDBus>
+
+#include "controller.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Controller controller;
+ controller.show();
+ return app.exec();
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 8d0977b94..b144aa096 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -1138,6 +1138,18 @@ void TestBlackbox::conflictingArtifacts()
QVERIFY2(m_qbsStderr.contains("Conflicting artifacts"), m_qbsStderr.constData());
}
+void TestBlackbox::dbusAdaptors()
+{
+ QDir::setCurrent(testDataDir + "/dbus-adaptors");
+ QCOMPARE(runQbs(), 0);
+}
+
+void TestBlackbox::dbusInterfaces()
+{
+ QDir::setCurrent(testDataDir + "/dbus-interfaces");
+ QCOMPARE(runQbs(), 0);
+}
+
void TestBlackbox::renameDependency()
{
QDir::setCurrent(testDataDir + "/renameDependency");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 469f60d87..e3a55e33f 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -114,6 +114,8 @@ private slots:
void cli();
void concurrentExecutor();
void conflictingArtifacts();
+ void dbusAdaptors();
+ void dbusInterfaces();
void dependenciesProperty();
void dependencyProfileMismatch();
void deploymentTarget();