summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBrett Stottlemyer <bstottle@ford.com>2014-10-07 13:48:57 -0400
committerBrett Stottlemyer <bstottle@ford.com>2014-10-16 13:05:29 +0200
commitec68d2724872c4e3c0b63e0ac12a369e639088de (patch)
treed0b93852644007bddf6d51097700dd40dcb366d7 /examples
parent4d455cba42dc11c3cd71bec0d560ea3642bf5350 (diff)
Say hello to QtRemoteObjects
This is a module that allows you to create copies/replicas of your QObjects in other processes, without having to write a bunch of IPC code. Change-Id: I4a62f120eca34c9f50089b7d9d09dcfcad14476c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/RemoteObjects/ClientApp/ClientApp.desktop11
-rw-r--r--examples/RemoteObjects/ClientApp/ClientApp.pro13
-rw-r--r--examples/RemoteObjects/ClientApp/ClientApp64.pngbin0 -> 3400 bytes
-rw-r--r--examples/RemoteObjects/ClientApp/ClientApp80.pngbin0 -> 4945 bytes
-rw-r--r--examples/RemoteObjects/ClientApp/ClientApp_harmattan.desktop11
-rw-r--r--examples/RemoteObjects/ClientApp/clientapp.qrc9
-rw-r--r--examples/RemoteObjects/ClientApp/main.cpp56
-rw-r--r--examples/RemoteObjects/ClientApp/qml/plugins.qml62
-rw-r--r--examples/RemoteObjects/ClientApp/qml/plugins0.qml48
-rw-r--r--examples/RemoteObjects/ClientApp/qml/plugins1.qml60
-rw-r--r--examples/RemoteObjects/ClientApp/qml/plugins2.qml71
-rw-r--r--examples/RemoteObjects/CppClient/CppClient.pro19
-rw-r--r--examples/RemoteObjects/CppClient/TimeModel.rep12
-rw-r--r--examples/RemoteObjects/CppClient/main.cpp90
-rw-r--r--examples/RemoteObjects/RemoteObjects.pro11
-rw-r--r--examples/RemoteObjects/TimeModel.rep12
-rw-r--r--examples/RemoteObjects/plugins/imports/TimeExample/Clock.qml88
-rw-r--r--examples/RemoteObjects/plugins/imports/TimeExample/center.pngbin0 -> 765 bytes
-rw-r--r--examples/RemoteObjects/plugins/imports/TimeExample/clock.pngbin0 -> 20653 bytes
-rw-r--r--examples/RemoteObjects/plugins/imports/TimeExample/hour.pngbin0 -> 625 bytes
-rw-r--r--examples/RemoteObjects/plugins/imports/TimeExample/minute.pngbin0 -> 625 bytes
-rw-r--r--examples/RemoteObjects/plugins/imports/TimeExample/qmldir3
-rw-r--r--examples/RemoteObjects/plugins/plugin.cpp130
-rw-r--r--examples/RemoteObjects/plugins/plugins.pro28
-rw-r--r--examples/RemoteObjects/plugins/plugins.qml62
-rw-r--r--examples/RemoteObjects/plugins/plugins0.qml48
-rw-r--r--examples/RemoteObjects/plugins/plugins1.qml60
-rw-r--r--examples/RemoteObjects/plugins/plugins2.qml71
-rw-r--r--examples/RemoteObjects/server/TimeModel.cpp81
-rw-r--r--examples/RemoteObjects/server/TimeModel.h62
-rw-r--r--examples/RemoteObjects/server/main.cpp95
-rw-r--r--examples/RemoteObjects/server/server.pro13
-rw-r--r--examples/examples.pro3
33 files changed, 1229 insertions, 0 deletions
diff --git a/examples/RemoteObjects/ClientApp/ClientApp.desktop b/examples/RemoteObjects/ClientApp/ClientApp.desktop
new file mode 100644
index 0000000..e85a515
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/ClientApp.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=ClientApp
+Exec=/opt/ClientApp/bin/ClientApp
+Icon=ClientApp64
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/RemoteObjects/ClientApp/ClientApp.pro b/examples/RemoteObjects/ClientApp/ClientApp.pro
new file mode 100644
index 0000000..1dc091c
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/ClientApp.pro
@@ -0,0 +1,13 @@
+SOURCES += main.cpp
+
+RESOURCES += \
+ clientapp.qrc
+
+QT += remoteobjects quick
+
+contains(QT_CONFIG, c++11): CONFIG += c++11
+
+target.path = $$[QT_INSTALL_EXAMPLES]/RemoteObjects/ClientApp
+
+INSTALLS += target
+
diff --git a/examples/RemoteObjects/ClientApp/ClientApp64.png b/examples/RemoteObjects/ClientApp/ClientApp64.png
new file mode 100644
index 0000000..707d5c4
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/ClientApp64.png
Binary files differ
diff --git a/examples/RemoteObjects/ClientApp/ClientApp80.png b/examples/RemoteObjects/ClientApp/ClientApp80.png
new file mode 100644
index 0000000..6ad8096
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/ClientApp80.png
Binary files differ
diff --git a/examples/RemoteObjects/ClientApp/ClientApp_harmattan.desktop b/examples/RemoteObjects/ClientApp/ClientApp_harmattan.desktop
new file mode 100644
index 0000000..d3da899
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/ClientApp_harmattan.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=ClientApp
+Exec=/usr/bin/single-instance /opt/ClientApp/bin/ClientApp
+Icon=/usr/share/icons/hicolor/80x80/apps/ClientApp80.png
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/RemoteObjects/ClientApp/clientapp.qrc b/examples/RemoteObjects/ClientApp/clientapp.qrc
new file mode 100644
index 0000000..7e6bf64
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/clientapp.qrc
@@ -0,0 +1,9 @@
+<RCC>
+ <qresource prefix="/qml">
+ <file>qml/plugins0.qml</file>
+ <file>qml/plugins.qml</file>
+ <file>qml/plugins1.qml</file>
+ <file>qml/plugins2.qml</file>
+ </qresource>
+ <qresource prefix="/images"/>
+</RCC>
diff --git a/examples/RemoteObjects/ClientApp/main.cpp b/examples/RemoteObjects/ClientApp/main.cpp
new file mode 100644
index 0000000..0721f50
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlEngine>
+#include <QtQuick/QQuickView>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQuickView viewer;
+ viewer.engine()->addImportPath(QStringLiteral("qrc:/qml"));
+ viewer.setSource(QUrl(QStringLiteral("qrc:/qml/qml/plugins.qml")));
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/RemoteObjects/ClientApp/qml/plugins.qml b/examples/RemoteObjects/ClientApp/qml/plugins.qml
new file mode 100644
index 0000000..87318a6
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/qml/plugins.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 400
+ property int counter: 0;
+ MouseArea {
+ anchors.fill: parent
+ onClicked:
+ {
+ counter = (counter + 1) % 3;
+ console.log(counter);
+ pageLoader.source = "plugins"+counter+".qml"
+ }
+ }
+ Loader {
+ id: pageLoader
+ source: "plugins0.qml"
+ }
+}
+//![0]
diff --git a/examples/RemoteObjects/ClientApp/qml/plugins0.qml b/examples/RemoteObjects/ClientApp/qml/plugins0.qml
new file mode 100644
index 0000000..958ae9f
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/qml/plugins0.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 400
+ color: "blue"
+}
+//![0]
diff --git a/examples/RemoteObjects/ClientApp/qml/plugins1.qml b/examples/RemoteObjects/ClientApp/qml/plugins1.qml
new file mode 100644
index 0000000..c9a9237
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/qml/plugins1.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+import TimeExample 1.0 // import types from the plugin
+
+Rectangle {
+ width: 200
+ height: 400
+ color: "blue"
+ Clock { // this class is defined in QML (imports/TimeExample/Clock.qml)
+ id: clock1
+ anchors.top: parent.top
+ Time { // this class is defined in C++ (plugin.cpp)
+ id: time
+ }
+
+ hours: time.hour
+ minutes: time.minute
+
+ }
+}
+//![0]
diff --git a/examples/RemoteObjects/ClientApp/qml/plugins2.qml b/examples/RemoteObjects/ClientApp/qml/plugins2.qml
new file mode 100644
index 0000000..55acb8a
--- /dev/null
+++ b/examples/RemoteObjects/ClientApp/qml/plugins2.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+import TimeExample 1.0 // import types from the plugin
+
+Rectangle {
+ width: 200
+ height: 400
+ Clock { // this class is defined in QML (imports/TimeExample/Clock.qml)
+ id: clock1
+ anchors.top: parent.top
+ Time { // this class is defined in C++ (plugin.cpp)
+ id: time
+ }
+
+ hours: time.hour
+ minutes: time.minute
+
+ }
+ Clock { // this class is defined in QML (imports/TimeExample/Clock.qml)
+ id: clock2
+ anchors.top: clock1.bottom
+ Time { // this class is defined in C++ (plugin.cpp)
+ id: time2
+ }
+
+ hours: time2.hour
+ minutes: time2.minute
+
+ }
+
+}
+//![0]
diff --git a/examples/RemoteObjects/CppClient/CppClient.pro b/examples/RemoteObjects/CppClient/CppClient.pro
new file mode 100644
index 0000000..05a89b9
--- /dev/null
+++ b/examples/RemoteObjects/CppClient/CppClient.pro
@@ -0,0 +1,19 @@
+QT += core
+
+REPC_REPLICA += TimeModel.rep
+QT += remoteobjects
+
+QT -= gui
+
+TARGET = CppClient
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+SOURCES += main.cpp
+
+OTHER_FILES += \
+ TimeModel.rep
+
+target.path = $$[QT_INSTALL_EXAMPLES]/RemoteObjects/CppClient
+INSTALLS += target
diff --git a/examples/RemoteObjects/CppClient/TimeModel.rep b/examples/RemoteObjects/CppClient/TimeModel.rep
new file mode 100644
index 0000000..fa7e612
--- /dev/null
+++ b/examples/RemoteObjects/CppClient/TimeModel.rep
@@ -0,0 +1,12 @@
+#include <QtCore>
+
+POD PresetInfo(int presetNumber, float frequency, QString stationName)
+class MinuteTimer
+{
+ PROP(int hour=1);
+ PROP(int minute=51);
+ SIGNAL(timeChanged());
+ SIGNAL(timeChanged2(QTime t));
+ SIGNAL(sendCustom(PresetInfo info));
+ SLOT(SetTimeZone(int zn));
+};
diff --git a/examples/RemoteObjects/CppClient/main.cpp b/examples/RemoteObjects/CppClient/main.cpp
new file mode 100644
index 0000000..ee7ec65
--- /dev/null
+++ b/examples/RemoteObjects/CppClient/main.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QTimer>
+#include "rep_TimeModel_replica.h"
+
+class tester : public QObject
+{
+ Q_OBJECT
+public:
+ tester() : QObject(Q_NULLPTR)
+ {
+ QRemoteObjectNode m_client = QRemoteObjectNode::createNodeConnectedToRegistry();;
+ ptr1.reset(m_client.acquire< MinuteTimerReplica >());
+ ptr2.reset(m_client.acquire< MinuteTimerReplica >());
+ ptr3.reset(m_client.acquire< MinuteTimerReplica >());
+ QTimer::singleShot(0,this,SLOT(clear()));
+ QTimer::singleShot(1,this,SLOT(clear()));
+ QTimer::singleShot(10000,this,SLOT(clear()));
+ QTimer::singleShot(11000,this,SLOT(clear()));
+ }
+public slots:
+ void clear()
+ {
+ static int i = 0;
+ if (i == 0) {
+ i++;
+ ptr1.reset();
+ } else if (i == 1) {
+ i++;
+ ptr2.reset();
+ } else if (i == 2) {
+ i++;
+ ptr3.reset();
+ } else {
+ qApp->quit();
+ }
+ }
+
+private:
+ QScopedPointer<MinuteTimerReplica> ptr1, ptr2, ptr3;
+};
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication a(argc, argv);
+ tester t;
+ return a.exec();
+}
+
+#include "main.moc"
diff --git a/examples/RemoteObjects/RemoteObjects.pro b/examples/RemoteObjects/RemoteObjects.pro
new file mode 100644
index 0000000..da12899
--- /dev/null
+++ b/examples/RemoteObjects/RemoteObjects.pro
@@ -0,0 +1,11 @@
+TEMPLATE = subdirs
+CONFIG += debug_and_release ordered
+SUBDIRS = \
+ server \
+ CppClient
+
+qtHaveModule(quick) {
+ SUBDIRS += \
+ plugins \
+ ClientApp
+}
diff --git a/examples/RemoteObjects/TimeModel.rep b/examples/RemoteObjects/TimeModel.rep
new file mode 100644
index 0000000..fa7e612
--- /dev/null
+++ b/examples/RemoteObjects/TimeModel.rep
@@ -0,0 +1,12 @@
+#include <QtCore>
+
+POD PresetInfo(int presetNumber, float frequency, QString stationName)
+class MinuteTimer
+{
+ PROP(int hour=1);
+ PROP(int minute=51);
+ SIGNAL(timeChanged());
+ SIGNAL(timeChanged2(QTime t));
+ SIGNAL(sendCustom(PresetInfo info));
+ SLOT(SetTimeZone(int zn));
+};
diff --git a/examples/RemoteObjects/plugins/imports/TimeExample/Clock.qml b/examples/RemoteObjects/plugins/imports/TimeExample/Clock.qml
new file mode 100644
index 0000000..ca57cae
--- /dev/null
+++ b/examples/RemoteObjects/plugins/imports/TimeExample/Clock.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: clock
+ width: 200; height: 200; color: "gray"
+
+ property alias city: cityLabel.text
+ property variant hours
+ property variant minutes
+ property variant shift : 0
+
+ Image { id: background; source: "clock.png" }
+
+ Image {
+ x: 92.5; y: 27
+ source: "hour.png"
+ transform: Rotation {
+ id: hourRotation
+ origin.x: 7.5; origin.y: 73;
+ angle: (clock.hours * 30) + (clock.minutes * 0.5)
+ Behavior on angle {
+ SpringAnimation{ spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ x: 93.5; y: 17
+ source: "minute.png"
+ transform: Rotation {
+ id: minuteRotation
+ origin.x: 6.5; origin.y: 83;
+ angle: clock.minutes * 6
+ Behavior on angle {
+ SpringAnimation{ spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ anchors.centerIn: background; source: "center.png"
+ }
+
+ Text {
+ id: cityLabel; font.bold: true; font.pixelSize: 14; y:200; color: "white"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/RemoteObjects/plugins/imports/TimeExample/center.png b/examples/RemoteObjects/plugins/imports/TimeExample/center.png
new file mode 100644
index 0000000..7fbd802
--- /dev/null
+++ b/examples/RemoteObjects/plugins/imports/TimeExample/center.png
Binary files differ
diff --git a/examples/RemoteObjects/plugins/imports/TimeExample/clock.png b/examples/RemoteObjects/plugins/imports/TimeExample/clock.png
new file mode 100644
index 0000000..462edac
--- /dev/null
+++ b/examples/RemoteObjects/plugins/imports/TimeExample/clock.png
Binary files differ
diff --git a/examples/RemoteObjects/plugins/imports/TimeExample/hour.png b/examples/RemoteObjects/plugins/imports/TimeExample/hour.png
new file mode 100644
index 0000000..f8061a1
--- /dev/null
+++ b/examples/RemoteObjects/plugins/imports/TimeExample/hour.png
Binary files differ
diff --git a/examples/RemoteObjects/plugins/imports/TimeExample/minute.png b/examples/RemoteObjects/plugins/imports/TimeExample/minute.png
new file mode 100644
index 0000000..1297ec7
--- /dev/null
+++ b/examples/RemoteObjects/plugins/imports/TimeExample/minute.png
Binary files differ
diff --git a/examples/RemoteObjects/plugins/imports/TimeExample/qmldir b/examples/RemoteObjects/plugins/imports/TimeExample/qmldir
new file mode 100644
index 0000000..252e662
--- /dev/null
+++ b/examples/RemoteObjects/plugins/imports/TimeExample/qmldir
@@ -0,0 +1,3 @@
+module TimeExample
+Clock 1.0 Clock.qml
+plugin qmlqtimeexampleplugin
diff --git a/examples/RemoteObjects/plugins/plugin.cpp b/examples/RemoteObjects/plugins/plugin.cpp
new file mode 100644
index 0000000..0415fc3
--- /dev/null
+++ b/examples/RemoteObjects/plugins/plugin.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/QQmlExtensionPlugin>
+#include <QtQml/QQmlEngine>
+#include <QtQml/qqml.h>
+#include <QDebug>
+#include <QDateTime>
+#include <QBasicTimer>
+#include <QCoreApplication>
+#include <QRemoteObjectReplica>
+#include <QRemoteObjectNode>
+#include "rep_TimeModel_replica.h"
+
+// Implements a "TimeModel" class with hour and minute properties
+// that change on-the-minute yet efficiently sleep the rest
+// of the time.
+
+QRemoteObjectNode m_client;
+
+class TimeModel : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int hour READ hour NOTIFY timeChanged)
+ Q_PROPERTY(int minute READ minute NOTIFY timeChanged)
+ Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
+
+public:
+ TimeModel(QObject *parent=0) : QObject(parent), d_ptr(Q_NULLPTR)
+ {
+ d_ptr.reset(m_client.acquire< MinuteTimerReplica >());
+ connect(d_ptr.data(), SIGNAL(onHourChanged()), this, SIGNAL(timeChanged()));
+ connect(d_ptr.data(), SIGNAL(onMinuteChanged()), this, SIGNAL(timeChanged()));
+ connect(d_ptr.data(), SIGNAL(timeChanged()), this, SIGNAL(timeChanged()));
+ connect(d_ptr.data(), SIGNAL(timeChanged2(QTime)), this, SLOT(test(QTime)));
+ connect(d_ptr.data(), SIGNAL(sendCustom(PresetInfo)), this, SLOT(testCustom(PresetInfo)));
+ }
+
+ ~TimeModel()
+ {
+ }
+
+ int minute() const { return d_ptr->minute(); }
+ int hour() const { return d_ptr->hour(); }
+ bool isValid() const { return d_ptr->isReplicaValid(); }
+
+public slots:
+ //Test a signal with parameters
+ void test(QTime t)
+ {
+ qDebug()<<"Test"<<t;
+ d_ptr->SetTimeZone(t.minute());
+ }
+ //Test a signal with a custom type
+ void testCustom(PresetInfo info)
+ {
+ qDebug()<<"testCustom"<<info.presetNumber()<<info.frequency()<<info.stationName();
+ }
+
+signals:
+ void timeChanged();
+ void timeChanged2(QTime t);
+ void sendCustom(PresetInfo info);
+ void isValidChanged();
+
+private:
+ QScopedPointer<MinuteTimerReplica> d_ptr;
+};
+
+class QExampleQmlPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ void initializeEngine(QQmlEngine *engine, const char *uri)
+ {
+ Q_UNUSED(engine);
+ Q_UNUSED(uri);
+ Q_ASSERT(uri == QLatin1String("TimeExample"));
+ engine->addImportPath(QStringLiteral("qrc:/qml"));
+ m_client = QRemoteObjectNode::createNodeConnectedToRegistry();
+ }
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(uri == QLatin1String("TimeExample"));
+ qmlRegisterType<TimeModel>(uri, 1, 0, "Time");
+ }
+
+};
+
+#include "plugin.moc"
diff --git a/examples/RemoteObjects/plugins/plugins.pro b/examples/RemoteObjects/plugins/plugins.pro
new file mode 100644
index 0000000..ce1518f
--- /dev/null
+++ b/examples/RemoteObjects/plugins/plugins.pro
@@ -0,0 +1,28 @@
+QT += qml remoteobjects
+
+TEMPLATE = lib
+CONFIG += plugin
+
+REPC_REPLICA += $$PWD/../TimeModel.rep
+
+DESTDIR = imports/TimeExample
+TARGET = qmlqtimeexampleplugin
+
+SOURCES += plugin.cpp
+
+pluginfiles.files += \
+ imports/TimeExample/qmldir \
+ imports/TimeExample/center.png \
+ imports/TimeExample/clock.png \
+ imports/TimeExample/Clock.qml \
+ imports/TimeExample/hour.png \
+ imports/TimeExample/minute.png
+
+#qml.files = plugins.qml
+#qml.path += $$[QT_HOST_PREFIX]/qml/plugins
+target.path += $$[QT_HOST_PREFIX]/qml/TimeExample
+pluginfiles.path += $$[QT_HOST_PREFIX]/qml/TimeExample
+
+INSTALLS += target pluginfiles
+
+contains(QT_CONFIG, c++11): CONFIG += c++11
diff --git a/examples/RemoteObjects/plugins/plugins.qml b/examples/RemoteObjects/plugins/plugins.qml
new file mode 100644
index 0000000..87318a6
--- /dev/null
+++ b/examples/RemoteObjects/plugins/plugins.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 400
+ property int counter: 0;
+ MouseArea {
+ anchors.fill: parent
+ onClicked:
+ {
+ counter = (counter + 1) % 3;
+ console.log(counter);
+ pageLoader.source = "plugins"+counter+".qml"
+ }
+ }
+ Loader {
+ id: pageLoader
+ source: "plugins0.qml"
+ }
+}
+//![0]
diff --git a/examples/RemoteObjects/plugins/plugins0.qml b/examples/RemoteObjects/plugins/plugins0.qml
new file mode 100644
index 0000000..958ae9f
--- /dev/null
+++ b/examples/RemoteObjects/plugins/plugins0.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 400
+ color: "blue"
+}
+//![0]
diff --git a/examples/RemoteObjects/plugins/plugins1.qml b/examples/RemoteObjects/plugins/plugins1.qml
new file mode 100644
index 0000000..c9a9237
--- /dev/null
+++ b/examples/RemoteObjects/plugins/plugins1.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+import TimeExample 1.0 // import types from the plugin
+
+Rectangle {
+ width: 200
+ height: 400
+ color: "blue"
+ Clock { // this class is defined in QML (imports/TimeExample/Clock.qml)
+ id: clock1
+ anchors.top: parent.top
+ Time { // this class is defined in C++ (plugin.cpp)
+ id: time
+ }
+
+ hours: time.hour
+ minutes: time.minute
+
+ }
+}
+//![0]
diff --git a/examples/RemoteObjects/plugins/plugins2.qml b/examples/RemoteObjects/plugins/plugins2.qml
new file mode 100644
index 0000000..55acb8a
--- /dev/null
+++ b/examples/RemoteObjects/plugins/plugins2.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia Plc 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$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+import TimeExample 1.0 // import types from the plugin
+
+Rectangle {
+ width: 200
+ height: 400
+ Clock { // this class is defined in QML (imports/TimeExample/Clock.qml)
+ id: clock1
+ anchors.top: parent.top
+ Time { // this class is defined in C++ (plugin.cpp)
+ id: time
+ }
+
+ hours: time.hour
+ minutes: time.minute
+
+ }
+ Clock { // this class is defined in QML (imports/TimeExample/Clock.qml)
+ id: clock2
+ anchors.top: clock1.bottom
+ Time { // this class is defined in C++ (plugin.cpp)
+ id: time2
+ }
+
+ hours: time2.hour
+ minutes: time2.minute
+
+ }
+
+}
+//![0]
diff --git a/examples/RemoteObjects/server/TimeModel.cpp b/examples/RemoteObjects/server/TimeModel.cpp
new file mode 100644
index 0000000..1654a1a
--- /dev/null
+++ b/examples/RemoteObjects/server/TimeModel.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "TimeModel.h"
+
+MinuteTimer::MinuteTimer(QObject *parent) : MinuteTimerSource(parent)
+{
+ time = QTime::currentTime();
+ setHour(time.hour());
+ setMinute(time.minute());
+ timer.start(60000-time.second()*1000, this);
+}
+MinuteTimer::~MinuteTimer()
+{
+ timer.stop();
+}
+void MinuteTimer::timerEvent(QTimerEvent *)
+{
+ QTime now = QTime::currentTime();
+ if (now.second() == 59 && now.minute() == time.minute() && now.hour() == time.hour()) {
+ // just missed time tick over, force it, wait extra 0.5 seconds
+ time.addSecs(60);
+ timer.start(60500, this);
+ } else {
+ time = now;
+ timer.start(60000-time.second()*1000, this);
+ }
+ qDebug()<<"Time"<<time;
+ setHour(time.hour());
+ setMinute(time.minute());
+ emit timeChanged();
+ emit timeChanged2(time);
+ static PresetInfo bla(3, 93.9f, "Best Station");
+ emit sendCustom(bla);
+}
+void MinuteTimer::SetTimeZone(int zn)
+{
+ qDebug()<<"SetTimeZone"<<zn;
+ if (zn != zone)
+ {
+ zone = zn;
+ }
+}
diff --git a/examples/RemoteObjects/server/TimeModel.h b/examples/RemoteObjects/server/TimeModel.h
new file mode 100644
index 0000000..67c87c0
--- /dev/null
+++ b/examples/RemoteObjects/server/TimeModel.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include "rep_TimeModel_source.h"
+
+class MinuteTimer : public MinuteTimerSource
+{
+ Q_OBJECT
+public:
+ MinuteTimer(QObject *parent=Q_NULLPTR);
+ virtual ~MinuteTimer();
+
+public slots:
+ virtual void SetTimeZone(int zn);
+
+protected:
+ void timerEvent(QTimerEvent *);
+
+private:
+ QTime time;
+ QBasicTimer timer;
+ int zone;
+};
diff --git a/examples/RemoteObjects/server/main.cpp b/examples/RemoteObjects/server/main.cpp
new file mode 100644
index 0000000..15f76a2
--- /dev/null
+++ b/examples/RemoteObjects/server/main.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "TimeModel.h"
+
+#include <QCoreApplication>
+/*
+* http://stackoverflow.com/questions/7404163/windows-handling-ctrlc-in-different-thread
+*/
+
+void SigIntHandler()
+{
+ qDebug()<<"Ctrl-C received. Quitting.";
+ qApp->quit();
+}
+
+#if defined(Q_OS_UNIX) || defined(Q_OS_LINUX) || defined(Q_OS_QNX)
+ #include <signal.h>
+
+ void unix_handler(int s)
+ {
+ if (s==SIGINT)
+ SigIntHandler();
+ }
+
+#elif defined(Q_OS_WIN32)
+ #include <windows.h>
+
+ BOOL WINAPI WinHandler(DWORD CEvent)
+ {
+ switch (CEvent)
+ {
+ case CTRL_C_EVENT:
+ SigIntHandler();
+ break;
+ }
+ return TRUE;
+ }
+#endif
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ #if defined(Q_OS_UNIX) || defined(Q_OS_LINUX) || defined(Q_OS_QNX)
+ signal(SIGINT, &unix_handler);
+ #elif defined(Q_OS_WIN32)
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)WinHandler, TRUE);
+ #endif
+ QRemoteObjectNode node = QRemoteObjectNode::createRegistryHostNode();
+ QRemoteObjectNode node2 = QRemoteObjectNode::createHostNodeConnectedToRegistry();
+ MinuteTimer timer;
+ node2.enableRemoting(&timer);
+
+ Q_UNUSED(timer);
+ return app.exec();
+}
diff --git a/examples/RemoteObjects/server/server.pro b/examples/RemoteObjects/server/server.pro
new file mode 100644
index 0000000..9d624fd
--- /dev/null
+++ b/examples/RemoteObjects/server/server.pro
@@ -0,0 +1,13 @@
+CONFIG += console
+
+
+REPC_SOURCE += ../TimeModel.rep
+QT = remoteobjects core
+
+SOURCES += TimeModel.cpp main.cpp
+HEADERS += TimeModel.h
+
+contains(QT_CONFIG, c++11): CONFIG += c++11
+
+target.path = $$[QT_INSTALL_EXAMPLES]/RemoteObjects/Server
+INSTALLS += target
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 0000000..698f31d
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ RemoteObjects