summaryrefslogtreecommitdiffstats
path: root/examples/dbus
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit38be0d13830efd2d98281c645c3a60afe05ffece (patch)
tree6ea73f3ec77f7d153333779883e8120f82820abe /examples/dbus
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'examples/dbus')
-rw-r--r--examples/dbus/complexpingpong/complexping.cpp117
-rw-r--r--examples/dbus/complexpingpong/complexping.h58
-rw-r--r--examples/dbus/complexpingpong/complexping.pro18
-rw-r--r--examples/dbus/complexpingpong/complexpingpong.pro4
-rw-r--r--examples/dbus/complexpingpong/complexpong.cpp104
-rw-r--r--examples/dbus/complexpingpong/complexpong.h67
-rw-r--r--examples/dbus/complexpingpong/complexpong.pro18
-rw-r--r--examples/dbus/complexpingpong/ping-common.h41
-rw-r--r--examples/dbus/dbus-chat/chat.cpp163
-rw-r--r--examples/dbus/dbus-chat/chat.h81
-rw-r--r--examples/dbus/dbus-chat/chat_adaptor.cpp74
-rw-r--r--examples/dbus/dbus-chat/chat_adaptor.h96
-rw-r--r--examples/dbus/dbus-chat/chat_interface.cpp64
-rw-r--r--examples/dbus/dbus-chat/chat_interface.h88
-rw-r--r--examples/dbus/dbus-chat/chatmainwindow.ui185
-rw-r--r--examples/dbus/dbus-chat/chatsetnickname.ui149
-rw-r--r--examples/dbus/dbus-chat/com.trolltech.chat.xml15
-rw-r--r--examples/dbus/dbus-chat/dbus-chat.pro21
-rw-r--r--examples/dbus/dbus.pro17
-rw-r--r--examples/dbus/listnames/listnames.cpp91
-rw-r--r--examples/dbus/listnames/listnames.pro19
-rw-r--r--examples/dbus/pingpong/ping-common.h41
-rw-r--r--examples/dbus/pingpong/ping.cpp74
-rw-r--r--examples/dbus/pingpong/ping.pro18
-rw-r--r--examples/dbus/pingpong/pingpong.pro4
-rw-r--r--examples/dbus/pingpong/pong.cpp79
-rw-r--r--examples/dbus/pingpong/pong.h53
-rw-r--r--examples/dbus/pingpong/pong.pro18
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.cpp137
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.h73
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.pro22
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.xml11
-rw-r--r--examples/dbus/remotecontrolledcar/car/car_adaptor.cpp98
-rw-r--r--examples/dbus/remotecontrolledcar/car/car_adaptor.h96
-rw-r--r--examples/dbus/remotecontrolledcar/car/main.cpp72
-rw-r--r--examples/dbus/remotecontrolledcar/controller/car.xml11
-rw-r--r--examples/dbus/remotecontrolledcar/controller/car_interface.cpp64
-rw-r--r--examples/dbus/remotecontrolledcar/controller/car_interface.h113
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.cpp82
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.h69
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.pro23
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.ui64
-rw-r--r--examples/dbus/remotecontrolledcar/controller/main.cpp52
-rw-r--r--examples/dbus/remotecontrolledcar/remotecontrolledcar.pro10
44 files changed, 2774 insertions, 0 deletions
diff --git a/examples/dbus/complexpingpong/complexping.cpp b/examples/dbus/complexpingpong/complexping.cpp
new file mode 100644
index 0000000000..4e17486439
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexping.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <stdio.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QFile>
+#include <QtCore/QDebug>
+#include <QtCore/QProcess>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+#include "complexping.h"
+
+void Ping::start(const QString &name, const QString &oldValue, const QString &newValue)
+{
+ Q_UNUSED(oldValue);
+
+ if (name != SERVICE_NAME || newValue.isEmpty())
+ return;
+
+ // open stdin for reading
+ qstdin.open(stdin, QIODevice::ReadOnly);
+
+ // find our remote
+ iface = new QDBusInterface(SERVICE_NAME, "/", "com.trolltech.QtDBus.ComplexPong.Pong",
+ QDBusConnection::sessionBus(), this);
+ if (!iface->isValid()) {
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ QCoreApplication::instance()->quit();
+ }
+
+ connect(iface, SIGNAL(aboutToQuit()), QCoreApplication::instance(), SLOT(quit()));
+
+ while (true) {
+ printf("Ask your question: ");
+
+ QString line = QString::fromLocal8Bit(qstdin.readLine()).trimmed();
+ if (line.isEmpty()) {
+ iface->call("quit");
+ return;
+ } else if (line == "value") {
+ QVariant reply = iface->property("value");
+ if (!reply.isNull())
+ printf("value = %s\n", qPrintable(reply.toString()));
+ } else if (line.startsWith("value=")) {
+ iface->setProperty("value", line.mid(6));
+ } else {
+ QDBusReply<QDBusVariant> reply = iface->call("query", line);
+ if (reply.isValid())
+ printf("Reply was: %s\n", qPrintable(reply.value().variant().toString()));
+ }
+
+ if (iface->lastError().isValid())
+ fprintf(stderr, "Call failed: %s\n", qPrintable(iface->lastError().message()));
+ }
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ Ping ping;
+ ping.connect(QDBusConnection::sessionBus().interface(),
+ SIGNAL(serviceOwnerChanged(QString,QString,QString)),
+ SLOT(start(QString,QString,QString)));
+
+ QProcess pong;
+ pong.start("./complexpong");
+
+ app.exec();
+}
diff --git a/examples/dbus/complexpingpong/complexping.h b/examples/dbus/complexpingpong/complexping.h
new file mode 100644
index 0000000000..bf54e630a8
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexping.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 COMPLEXPING_H
+#define COMPLEXPING_H
+
+#include <QtCore/QObject>
+#include <QtCore/QFile>
+#include <QtDBus/QDBusInterface>
+
+class Ping: public QObject
+{
+ Q_OBJECT
+public slots:
+ void start(const QString &, const QString &, const QString &);
+public:
+ QFile qstdin;
+ QDBusInterface *iface;
+};
+
+#endif
diff --git a/examples/dbus/complexpingpong/complexping.pro b/examples/dbus/complexpingpong/complexping.pro
new file mode 100644
index 0000000000..ff4b9c236a
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexping.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += complexping.h ping-common.h
+SOURCES += complexping.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/complexpingpong/complexpingpong.pro b/examples/dbus/complexpingpong/complexpingpong.pro
new file mode 100644
index 0000000000..cd618d549d
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpingpong.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+win32:CONFIG += console
+SUBDIRS = complexping.pro complexpong.pro
diff --git a/examples/dbus/complexpingpong/complexpong.cpp b/examples/dbus/complexpingpong/complexpong.cpp
new file mode 100644
index 0000000000..f16afd3121
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpong.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <stdio.h>
+#include <stdlib.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QTimer>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+#include "complexpong.h"
+
+// the property
+QString Pong::value() const
+{
+ return m_value;
+}
+
+void Pong::setValue(const QString &newValue)
+{
+ m_value = newValue;
+}
+
+void Pong::quit()
+{
+ QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit()));
+}
+
+QDBusVariant Pong::query(const QString &query)
+{
+ QString q = query.toLower();
+ if (q == "hello")
+ return QDBusVariant("World");
+ if (q == "ping")
+ return QDBusVariant("Pong");
+ if (q.indexOf("the answer to life, the universe and everything") != -1)
+ return QDBusVariant(42);
+ if (q.indexOf("unladen swallow") != -1) {
+ if (q.indexOf("european") != -1)
+ return QDBusVariant(11.0);
+ return QDBusVariant(QByteArray("african or european?"));
+ }
+
+ return QDBusVariant("Sorry, I don't know the answer");
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ QObject obj;
+ Pong *pong = new Pong(&obj);
+ pong->connect(&app, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit()));
+ pong->setProperty("value", "initial value");
+ QDBusConnection::sessionBus().registerObject("/", &obj);
+
+ if (!QDBusConnection::sessionBus().registerService(SERVICE_NAME)) {
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ exit(1);
+ }
+
+ app.exec();
+ return 0;
+}
+
diff --git a/examples/dbus/complexpingpong/complexpong.h b/examples/dbus/complexpingpong/complexpong.h
new file mode 100644
index 0000000000..cc05972f02
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpong.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 COMPLEXPONG_H
+#define COMPLEXPONG_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QDBusAbstractAdaptor>
+#include <QtDBus/QDBusVariant>
+
+class Pong: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.QtDBus.ComplexPong.Pong")
+ Q_PROPERTY(QString value READ value WRITE setValue)
+public:
+ QString m_value;
+ QString value() const;
+ void setValue(const QString &newValue);
+
+ Pong(QObject *obj) : QDBusAbstractAdaptor(obj)
+ { }
+signals:
+ void aboutToQuit();
+public slots:
+ QDBusVariant query(const QString &query);
+ Q_NOREPLY void quit();
+};
+
+#endif
diff --git a/examples/dbus/complexpingpong/complexpong.pro b/examples/dbus/complexpingpong/complexpong.pro
new file mode 100644
index 0000000000..166293beed
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpong.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += complexpong.h
+SOURCES += complexpong.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/complexpingpong/ping-common.h b/examples/dbus/complexpingpong/ping-common.h
new file mode 100644
index 0000000000..532517394b
--- /dev/null
+++ b/examples/dbus/complexpingpong/ping-common.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#define SERVICE_NAME "com.trolltech.QtDBus.PingExample"
diff --git a/examples/dbus/dbus-chat/chat.cpp b/examples/dbus/dbus-chat/chat.cpp
new file mode 100644
index 0000000000..5cc12caafa
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 "chat.h"
+#include <QtGui/QApplication>
+#include <QtGui/QMessageBox>
+
+#include "chat_adaptor.h"
+#include "chat_interface.h"
+
+ChatMainWindow::ChatMainWindow()
+ : m_nickname(QLatin1String("nickname"))
+{
+ setupUi(this);
+ sendButton->setEnabled(false);
+
+ connect(messageLineEdit, SIGNAL(textChanged(QString)),
+ this, SLOT(textChangedSlot(QString)));
+ connect(sendButton, SIGNAL(clicked(bool)), this, SLOT(sendClickedSlot()));
+ connect(actionChangeNickname, SIGNAL(triggered(bool)), this, SLOT(changeNickname()));
+ connect(actionAboutQt, SIGNAL(triggered(bool)), this, SLOT(aboutQt()));
+ connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(exiting()));
+
+ // add our D-Bus interface and connect to D-Bus
+ new ChatAdaptor(this);
+ QDBusConnection::sessionBus().registerObject("/", this);
+
+ com::trolltech::chat *iface;
+ iface = new com::trolltech::chat(QString(), QString(), QDBusConnection::sessionBus(), this);
+ //connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString)));
+ QDBusConnection::sessionBus().connect(QString(), QString(), "com.trolltech.chat", "message", this, SLOT(messageSlot(QString,QString)));
+ connect(iface, SIGNAL(action(QString,QString)), this, SLOT(actionSlot(QString,QString)));
+
+ NicknameDialog dialog;
+ dialog.cancelButton->setVisible(false);
+ dialog.exec();
+ m_nickname = dialog.nickname->text().trimmed();
+ emit action(m_nickname, QLatin1String("joins the chat"));
+}
+
+ChatMainWindow::~ChatMainWindow()
+{
+}
+
+void ChatMainWindow::rebuildHistory()
+{
+ QString history = m_messages.join( QLatin1String("\n" ) );
+ chatHistory->setPlainText(history);
+}
+
+void ChatMainWindow::messageSlot(const QString &nickname, const QString &text)
+{
+ QString msg( QLatin1String("<%1> %2") );
+ msg = msg.arg(nickname, text);
+ m_messages.append(msg);
+
+ if (m_messages.count() > 100)
+ m_messages.removeFirst();
+ rebuildHistory();
+}
+
+void ChatMainWindow::actionSlot(const QString &nickname, const QString &text)
+{
+ QString msg( QLatin1String("* %1 %2") );
+ msg = msg.arg(nickname, text);
+ m_messages.append(msg);
+
+ if (m_messages.count() > 100)
+ m_messages.removeFirst();
+ rebuildHistory();
+}
+
+void ChatMainWindow::textChangedSlot(const QString &newText)
+{
+ sendButton->setEnabled(!newText.isEmpty());
+}
+
+void ChatMainWindow::sendClickedSlot()
+{
+ //emit message(m_nickname, messageLineEdit->text());
+ QDBusMessage msg = QDBusMessage::createSignal("/", "com.trolltech.chat", "message");
+ msg << m_nickname << messageLineEdit->text();
+ QDBusConnection::sessionBus().send(msg);
+ messageLineEdit->setText(QString());
+}
+
+void ChatMainWindow::changeNickname()
+{
+ NicknameDialog dialog(this);
+ if (dialog.exec() == QDialog::Accepted) {
+ QString old = m_nickname;
+ m_nickname = dialog.nickname->text().trimmed();
+ emit action(old, QString("is now known as %1").arg(m_nickname));
+ }
+}
+
+void ChatMainWindow::aboutQt()
+{
+ QMessageBox::aboutQt(this);
+}
+
+void ChatMainWindow::exiting()
+{
+ emit action(m_nickname, QLatin1String("leaves the chat"));
+}
+
+NicknameDialog::NicknameDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+}
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ qWarning("Cannot connect to the D-Bus session bus.\n"
+ "Please check your system settings and try again.\n");
+ return 1;
+ }
+
+ ChatMainWindow chat;
+ chat.show();
+ return app.exec();
+}
diff --git a/examples/dbus/dbus-chat/chat.h b/examples/dbus/dbus-chat/chat.h
new file mode 100644
index 0000000000..c7d7b6d2a8
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 CHAT_H
+#define CHAT_H
+
+#include <QtCore/QStringList>
+#include <QtDBus/QtDBus>
+#include "ui_chatmainwindow.h"
+#include "ui_chatsetnickname.h"
+
+class ChatMainWindow: public QMainWindow, Ui::ChatMainWindow
+{
+ Q_OBJECT
+ QString m_nickname;
+ QStringList m_messages;
+public:
+ ChatMainWindow();
+ ~ChatMainWindow();
+
+ void rebuildHistory();
+
+signals:
+ void message(const QString &nickname, const QString &text);
+ void action(const QString &nickname, const QString &text);
+
+private slots:
+ void messageSlot(const QString &nickname, const QString &text);
+ void actionSlot(const QString &nickname, const QString &text);
+ void textChangedSlot(const QString &newText);
+ void sendClickedSlot();
+ void changeNickname();
+ void aboutQt();
+ void exiting();
+};
+
+class NicknameDialog: public QDialog, public Ui::NicknameDialog
+{
+ Q_OBJECT
+public:
+ NicknameDialog(QWidget *parent = 0);
+};
+
+#endif
diff --git a/examples/dbus/dbus-chat/chat_adaptor.cpp b/examples/dbus/dbus-chat/chat_adaptor.cpp
new file mode 100644
index 0000000000..553e6e10cc
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_adaptor.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -i chat_adaptor.h -a :chat_adaptor.cpp com.trolltech.chat.xml
+**
+** qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** Do not edit! All changes made to it will be lost.
+**
+****************************************************************************/
+
+#include "chat_adaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class ChatAdaptor
+ */
+
+ChatAdaptor::ChatAdaptor(QObject *parent)
+ : QDBusAbstractAdaptor(parent)
+{
+ // constructor
+ setAutoRelaySignals(true);
+}
+
+ChatAdaptor::~ChatAdaptor()
+{
+ // destructor
+}
+
diff --git a/examples/dbus/dbus-chat/chat_adaptor.h b/examples/dbus/dbus-chat/chat_adaptor.h
new file mode 100644
index 0000000000..2558ceb29f
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_adaptor.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -a chat_adaptor.h: com.trolltech.chat.xml
+**
+** qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** This file may have been hand-edited. Look for HAND-EDIT comments
+** before re-generating it.
+**
+****************************************************************************/
+
+#ifndef CHAT_ADAPTOR_H_1257535021
+#define CHAT_ADAPTOR_H_1257535021
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+
+QT_BEGIN_NAMESPACE
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+QT_END_NAMESPACE
+
+/*
+ * Adaptor class for interface com.trolltech.chat
+ */
+class ChatAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.chat")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.trolltech.chat\">\n"
+" <signal name=\"message\">\n"
+" <arg direction=\"out\" type=\"s\" name=\"nickname\"/>\n"
+" <arg direction=\"out\" type=\"s\" name=\"text\"/>\n"
+" </signal>\n"
+" <signal name=\"action\">\n"
+" <arg direction=\"out\" type=\"s\" name=\"nickname\"/>\n"
+" <arg direction=\"out\" type=\"s\" name=\"text\"/>\n"
+" </signal>\n"
+" </interface>\n"
+ "")
+public:
+ ChatAdaptor(QObject *parent);
+ virtual ~ChatAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+Q_SIGNALS: // SIGNALS
+ void action(const QString &nickname, const QString &text);
+ void message(const QString &nickname, const QString &text);
+};
+
+#endif
diff --git a/examples/dbus/dbus-chat/chat_interface.cpp b/examples/dbus/dbus-chat/chat_interface.cpp
new file mode 100644
index 0000000000..ea472506de
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_interface.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -i chat_interface.h -p :chat_interface.cpp com.trolltech.chat.xml
+**
+** qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** This file may have been hand-edited. Look for HAND-EDIT comments
+** before re-generating it.
+**
+****************************************************************************/
+
+#include "chat_interface.h"
+/*
+ * Implementation of interface class ComTrolltechChatInterface
+ */
+
+ComTrolltechChatInterface::ComTrolltechChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+ComTrolltechChatInterface::~ComTrolltechChatInterface()
+{
+}
+
diff --git a/examples/dbus/dbus-chat/chat_interface.h b/examples/dbus/dbus-chat/chat_interface.h
new file mode 100644
index 0000000000..8db1b4f420
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_interface.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -p chat_interface.h: com.trolltech.chat.xml
+**
+** qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** Do not edit! All changes made to it will be lost.
+**
+****************************************************************************/
+
+#ifndef CHAT_INTERFACE_H_1257535021
+#define CHAT_INTERFACE_H_1257535021
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface com.trolltech.chat
+ */
+class ComTrolltechChatInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "com.trolltech.chat"; }
+
+public:
+ ComTrolltechChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~ComTrolltechChatInterface();
+
+public Q_SLOTS: // METHODS
+Q_SIGNALS: // SIGNALS
+ void action(const QString &nickname, const QString &text);
+ void message(const QString &nickname, const QString &text);
+};
+
+namespace com {
+ namespace trolltech {
+ typedef ::ComTrolltechChatInterface chat;
+ }
+}
+#endif
diff --git a/examples/dbus/dbus-chat/chatmainwindow.ui b/examples/dbus/dbus-chat/chatmainwindow.ui
new file mode 100644
index 0000000000..0616dcb137
--- /dev/null
+++ b/examples/dbus/dbus-chat/chatmainwindow.ui
@@ -0,0 +1,185 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>ChatMainWindow</class>
+ <widget class="QMainWindow" name="ChatMainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>QtDBus Chat</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QTextBrowser" name="chatHistory" >
+ <property name="acceptDrops" >
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" >
+ <string>Messages sent and received from other users</string>
+ </property>
+ <property name="acceptRichText" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Message:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>messageLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="messageLineEdit" />
+ </item>
+ <item>
+ <widget class="QPushButton" name="sendButton" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" >
+ <string>Sends a message to other people</string>
+ </property>
+ <property name="whatsThis" >
+ <string/>
+ </property>
+ <property name="text" >
+ <string>Send</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuQuit" >
+ <property name="title" >
+ <string>Help</string>
+ </property>
+ <addaction name="actionAboutQt" />
+ </widget>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>File</string>
+ </property>
+ <addaction name="actionChangeNickname" />
+ <addaction name="separator" />
+ <addaction name="actionQuit" />
+ </widget>
+ <addaction name="menuFile" />
+ <addaction name="menuQuit" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="actionQuit" >
+ <property name="text" >
+ <string>Quit</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
+ <action name="actionAboutQt" >
+ <property name="text" >
+ <string>About Qt...</string>
+ </property>
+ </action>
+ <action name="actionChangeNickname" >
+ <property name="text" >
+ <string>Change nickname...</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <tabstops>
+ <tabstop>chatHistory</tabstop>
+ <tabstop>messageLineEdit</tabstop>
+ <tabstop>sendButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>messageLineEdit</sender>
+ <signal>returnPressed()</signal>
+ <receiver>sendButton</receiver>
+ <slot>animateClick()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>299</x>
+ <y>554</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>744</x>
+ <y>551</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>actionQuit</sender>
+ <signal>triggered(bool)</signal>
+ <receiver>ChatMainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>399</x>
+ <y>299</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/dbus/dbus-chat/chatsetnickname.ui b/examples/dbus/dbus-chat/chatsetnickname.ui
new file mode 100644
index 0000000000..fb9894e09f
--- /dev/null
+++ b/examples/dbus/dbus-chat/chatsetnickname.ui
@@ -0,0 +1,149 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>NicknameDialog</class>
+ <widget class="QDialog" name="NicknameDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>396</width>
+ <height>105</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Set nickname</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>New nickname:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="nickname" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>131</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>NicknameDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>278</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>96</x>
+ <y>254</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>NicknameDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>369</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>179</x>
+ <y>282</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/dbus/dbus-chat/com.trolltech.chat.xml b/examples/dbus/dbus-chat/com.trolltech.chat.xml
new file mode 100644
index 0000000000..618c8c4dcc
--- /dev/null
+++ b/examples/dbus/dbus-chat/com.trolltech.chat.xml
@@ -0,0 +1,15 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="com.trolltech.chat">
+ <signal name="message">
+ <arg name="nickname" type="s" direction="out"/>
+ <arg name="text" type="s" direction="out"/>
+ </signal>
+ <signal name="action">
+ <arg name="nickname" type="s" direction="out"/>
+ <arg name="text" type="s" direction="out"/>
+ </signal>
+ </interface>
+</node>
+
diff --git a/examples/dbus/dbus-chat/dbus-chat.pro b/examples/dbus/dbus-chat/dbus-chat.pro
new file mode 100644
index 0000000000..b474ff8c15
--- /dev/null
+++ b/examples/dbus/dbus-chat/dbus-chat.pro
@@ -0,0 +1,21 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += qdbus
+
+# Input
+HEADERS += chat.h chat_adaptor.h chat_interface.h
+SOURCES += chat.cpp chat_adaptor.cpp chat_interface.cpp
+FORMS += chatmainwindow.ui chatsetnickname.ui
+
+#DBUS_ADAPTORS += com.trolltech.chat.xml
+#DBUS_INTERFACES += com.trolltech.chat.xml
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/chat
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xml
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/chat
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro
new file mode 100644
index 0000000000..90865bd3f6
--- /dev/null
+++ b/examples/dbus/dbus.pro
@@ -0,0 +1,17 @@
+TEMPLATE = subdirs
+SUBDIRS = listnames \
+ pingpong \
+ complexpingpong
+
+!contains(QT_CONFIG, no-gui) {
+ SUBDIRS += dbus-chat \
+ remotecontrolledcar
+}
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus
+sources.files = *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus
+INSTALLS += sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/listnames/listnames.cpp b/examples/dbus/listnames/listnames.cpp
new file mode 100644
index 0000000000..40bb032369
--- /dev/null
+++ b/examples/dbus/listnames/listnames.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+#include <QtCore/QStringList>
+#include <QtDBus/QtDBus>
+
+void method1()
+{
+ qDebug() << "Method 1:";
+
+ QDBusReply<QStringList> reply = QDBusConnection::sessionBus().interface()->registeredServiceNames();
+ if (!reply.isValid()) {
+ qDebug() << "Error:" << reply.error().message();
+ exit(1);
+ }
+ foreach (QString name, reply.value())
+ qDebug() << name;
+}
+
+void method2()
+{
+ qDebug() << "Method 2:";
+
+ QDBusConnection bus = QDBusConnection::sessionBus();
+ QDBusInterface dbus_iface("org.freedesktop.DBus", "/org/freedesktop/DBus",
+ "org.freedesktop.DBus", bus);
+ qDebug() << dbus_iface.call("ListNames").arguments().at(0);
+}
+
+void method3()
+{
+ qDebug() << "Method 3:";
+ qDebug() << QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ method1();
+ method2();
+ method3();
+
+ return 0;
+}
diff --git a/examples/dbus/listnames/listnames.pro b/examples/dbus/listnames/listnames.pro
new file mode 100644
index 0000000000..c965de451a
--- /dev/null
+++ b/examples/dbus/listnames/listnames.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+win32:CONFIG += console
+
+# Input
+SOURCES += listnames.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/listnames
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/listnames
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+
diff --git a/examples/dbus/pingpong/ping-common.h b/examples/dbus/pingpong/ping-common.h
new file mode 100644
index 0000000000..532517394b
--- /dev/null
+++ b/examples/dbus/pingpong/ping-common.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#define SERVICE_NAME "com.trolltech.QtDBus.PingExample"
diff --git a/examples/dbus/pingpong/ping.cpp b/examples/dbus/pingpong/ping.cpp
new file mode 100644
index 0000000000..67aaf571bc
--- /dev/null
+++ b/examples/dbus/pingpong/ping.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <stdio.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ QDBusInterface iface(SERVICE_NAME, "/", "", QDBusConnection::sessionBus());
+ if (iface.isValid()) {
+ QDBusReply<QString> reply = iface.call("ping", argc > 1 ? argv[1] : "");
+ if (reply.isValid()) {
+ printf("Reply was: %s\n", qPrintable(reply.value()));
+ return 0;
+ }
+
+ fprintf(stderr, "Call failed: %s\n", qPrintable(reply.error().message()));
+ return 1;
+ }
+
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ return 1;
+}
diff --git a/examples/dbus/pingpong/ping.pro b/examples/dbus/pingpong/ping.pro
new file mode 100644
index 0000000000..7166dba16e
--- /dev/null
+++ b/examples/dbus/pingpong/ping.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+TARGET = ping
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += ping-common.h
+SOURCES += ping.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/pingpong/pingpong.pro b/examples/dbus/pingpong/pingpong.pro
new file mode 100644
index 0000000000..07fca74c9a
--- /dev/null
+++ b/examples/dbus/pingpong/pingpong.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+win32:CONFIG += console
+SUBDIRS = ping.pro pong.pro
diff --git a/examples/dbus/pingpong/pong.cpp b/examples/dbus/pingpong/pong.cpp
new file mode 100644
index 0000000000..a7c0ad392c
--- /dev/null
+++ b/examples/dbus/pingpong/pong.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <stdio.h>
+#include <stdlib.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QTimer>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+#include "pong.h"
+
+QString Pong::ping(const QString &arg)
+{
+ QMetaObject::invokeMethod(QCoreApplication::instance(), "quit");
+ return QString("ping(\"%1\") got called").arg(arg);
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ if (!QDBusConnection::sessionBus().registerService(SERVICE_NAME)) {
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ exit(1);
+ }
+
+ Pong pong;
+ QDBusConnection::sessionBus().registerObject("/", &pong, QDBusConnection::ExportAllSlots);
+
+ app.exec();
+ return 0;
+}
diff --git a/examples/dbus/pingpong/pong.h b/examples/dbus/pingpong/pong.h
new file mode 100644
index 0000000000..1b53f11bbc
--- /dev/null
+++ b/examples/dbus/pingpong/pong.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 PONG_H
+#define PONG_H
+
+#include <QtCore/QObject>
+
+class Pong: public QObject
+{
+ Q_OBJECT
+public slots:
+ Q_SCRIPTABLE QString ping(const QString &arg);
+};
+
+#endif
diff --git a/examples/dbus/pingpong/pong.pro b/examples/dbus/pingpong/pong.pro
new file mode 100644
index 0000000000..4b18cc5c93
--- /dev/null
+++ b/examples/dbus/pingpong/pong.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+TARGET = pong
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += ping-common.h pong.h
+SOURCES += pong.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/remotecontrolledcar/car/car.cpp b/examples/dbus/remotecontrolledcar/car/car.cpp
new file mode 100644
index 0000000000..50f8f24d3e
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtGui/QtGui>
+#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;
+
+ rotate(rotation);
+ translate(0, -speed);
+ update();
+}
diff --git a/examples/dbus/remotecontrolledcar/car/car.h b/examples/dbus/remotecontrolledcar/car/car.h
new file mode 100644
index 0000000000..3db41d7770
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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/examples/dbus/remotecontrolledcar/car/car.pro b/examples/dbus/remotecontrolledcar/car/car.pro
new file mode 100644
index 0000000000..0d7971f9d7
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car.pro
@@ -0,0 +1,22 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Mon Aug 28 19:50:14 2006
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += qdbus
+
+# Input
+# DBUS_ADAPTORS += car.xml
+HEADERS += car.h car_adaptor.h
+SOURCES += car.cpp main.cpp car_adaptor.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/car
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xml
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/car
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/remotecontrolledcar/car/car.xml b/examples/dbus/remotecontrolledcar/car/car.xml
new file mode 100644
index 0000000000..641c6982d4
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/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="com.trolltech.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/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp b/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp
new file mode 100644
index 0000000000..4ced1f5a9c
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -i car_adaptor.h -a :car_adaptor.cpp car.xml
+**
+** qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** Do not edit! All changes made to it will be lost.
+**
+****************************************************************************/
+
+#include "car_adaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class CarInterfaceAdaptor
+ */
+
+CarInterfaceAdaptor::CarInterfaceAdaptor(QObject *parent)
+ : QDBusAbstractAdaptor(parent)
+{
+ // constructor
+ setAutoRelaySignals(true);
+}
+
+CarInterfaceAdaptor::~CarInterfaceAdaptor()
+{
+ // destructor
+}
+
+void CarInterfaceAdaptor::accelerate()
+{
+ // handle method call com.trolltech.Examples.CarInterface.accelerate
+ QMetaObject::invokeMethod(parent(), "accelerate");
+}
+
+void CarInterfaceAdaptor::decelerate()
+{
+ // handle method call com.trolltech.Examples.CarInterface.decelerate
+ QMetaObject::invokeMethod(parent(), "decelerate");
+}
+
+void CarInterfaceAdaptor::turnLeft()
+{
+ // handle method call com.trolltech.Examples.CarInterface.turnLeft
+ QMetaObject::invokeMethod(parent(), "turnLeft");
+}
+
+void CarInterfaceAdaptor::turnRight()
+{
+ // handle method call com.trolltech.Examples.CarInterface.turnRight
+ QMetaObject::invokeMethod(parent(), "turnRight");
+}
+
diff --git a/examples/dbus/remotecontrolledcar/car/car_adaptor.h b/examples/dbus/remotecontrolledcar/car/car_adaptor.h
new file mode 100644
index 0000000000..c31779fed0
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car_adaptor.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -a car_adaptor.h: car.xml
+**
+** qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** This file may have been hand-edited. Look for HAND-EDIT comments
+** before re-generating it.
+**
+****************************************************************************/
+
+#ifndef CAR_ADAPTOR_H_1264773009
+#define CAR_ADAPTOR_H_1264773009
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+
+QT_BEGIN_NAMESPACE
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+QT_END_NAMESPACE
+
+/*
+ * Adaptor class for interface com.trolltech.Examples.CarInterface
+ */
+class CarInterfaceAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.Examples.CarInterface")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.trolltech.Examples.CarInterface\">\n"
+" <method name=\"accelerate\"/>\n"
+" <method name=\"decelerate\"/>\n"
+" <method name=\"turnLeft\"/>\n"
+" <method name=\"turnRight\"/>\n"
+" <signal name=\"crashed\"/>\n"
+" </interface>\n"
+ "")
+public:
+ CarInterfaceAdaptor(QObject *parent);
+ virtual ~CarInterfaceAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+ void accelerate();
+ void decelerate();
+ void turnLeft();
+ void turnRight();
+Q_SIGNALS: // SIGNALS
+ void crashed();
+};
+
+#endif
diff --git a/examples/dbus/remotecontrolledcar/car/main.cpp b/examples/dbus/remotecontrolledcar/car/main.cpp
new file mode 100644
index 0000000000..342a2b0c5d
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtGui/QApplication>
+#include <QtGui/QGraphicsView>
+#include <QtGui/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("com.trolltech.CarExample");
+
+ return app.exec();
+}
diff --git a/examples/dbus/remotecontrolledcar/controller/car.xml b/examples/dbus/remotecontrolledcar/controller/car.xml
new file mode 100644
index 0000000000..641c6982d4
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/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="com.trolltech.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/examples/dbus/remotecontrolledcar/controller/car_interface.cpp b/examples/dbus/remotecontrolledcar/controller/car_interface.cpp
new file mode 100644
index 0000000000..e1e6ae4bec
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/car_interface.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -i car_interface.h -p :car_interface.cpp car.xml
+**
+** qqdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** This file may have been hand-edited. Look for HAND-EDIT comments
+** before re-generating it.
+**
+****************************************************************************/
+
+#include "car_interface.h"
+/*
+ * Implementation of interface class ComTrolltechExamplesCarInterfaceInterface
+ */
+
+ComTrolltechExamplesCarInterfaceInterface::ComTrolltechExamplesCarInterfaceInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+ComTrolltechExamplesCarInterfaceInterface::~ComTrolltechExamplesCarInterfaceInterface()
+{
+}
+
diff --git a/examples/dbus/remotecontrolledcar/controller/car_interface.h b/examples/dbus/remotecontrolledcar/controller/car_interface.h
new file mode 100644
index 0000000000..e7e3774c17
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/car_interface.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+**
+** This file was generated by qdbusxml2cpp version 0.7
+** Command line was: qdbusxml2cpp -p car_interface.h: car.xml
+**
+** qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** This is an auto-generated file.
+** Do not edit! All changes made to it will be lost.
+**
+****************************************************************************/
+
+#ifndef CAR_INTERFACE_H_1264772826
+#define CAR_INTERFACE_H_1264772826
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface com.trolltech.Examples.CarInterface
+ */
+class ComTrolltechExamplesCarInterfaceInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "com.trolltech.Examples.CarInterface"; }
+
+public:
+ ComTrolltechExamplesCarInterfaceInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~ComTrolltechExamplesCarInterfaceInterface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<> accelerate()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("accelerate"), argumentList);
+ }
+
+ inline QDBusPendingReply<> decelerate()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("decelerate"), argumentList);
+ }
+
+ inline QDBusPendingReply<> turnLeft()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("turnLeft"), argumentList);
+ }
+
+ inline QDBusPendingReply<> turnRight()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("turnRight"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+ void crashed();
+};
+
+namespace com {
+ namespace trolltech {
+ namespace Examples {
+ typedef ::ComTrolltechExamplesCarInterfaceInterface CarInterface;
+ }
+ }
+}
+#endif
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.cpp b/examples/dbus/remotecontrolledcar/controller/controller.cpp
new file mode 100644
index 0000000000..8691aafa92
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/controller.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtGui>
+
+#include "controller.h"
+#include "car_interface.h"
+
+Controller::Controller(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+ car = new com::trolltech::Examples::CarInterface("com.trolltech.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/examples/dbus/remotecontrolledcar/controller/controller.h b/examples/dbus/remotecontrolledcar/controller/controller.h
new file mode 100644
index 0000000000..3fe172e2b7
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/controller.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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;
+ com::trolltech::Examples::CarInterface *car;
+};
+
+#endif
+
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.pro b/examples/dbus/remotecontrolledcar/controller/controller.pro
new file mode 100644
index 0000000000..71cdb54b17
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/controller.pro
@@ -0,0 +1,23 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Aug 29 12:28:05 2006
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += qdbus
+
+# Input
+# DBUS_INTERFACES += car.xml
+FORMS += controller.ui
+HEADERS += car_interface.h controller.h
+SOURCES += main.cpp car_interface.cpp controller.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/controller
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xml
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/controller
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.ui b/examples/dbus/remotecontrolledcar/controller/controller.ui
new file mode 100644
index 0000000000..379015bf30
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/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/examples/dbus/remotecontrolledcar/controller/main.cpp b/examples/dbus/remotecontrolledcar/controller/main.cpp
new file mode 100644
index 0000000000..5b536117c8
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtGui>
+#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/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro
new file mode 100644
index 0000000000..586507683c
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+SUBDIRS = car \
+ controller
+
+# install
+sources.files = *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar
+INSTALLS += sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)