summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBrett Stottlemyer <bstottle@ford.com>2015-12-25 17:18:27 -0500
committerBrett Stottlemyer <bstottle@ford.com>2015-12-31 15:01:39 +0000
commit16959709b59db45c07385ecc13b76061de851edf (patch)
tree0aee76a40f9882f93e05e649ef695538ab9313ea /examples
parentd5facb09fae029c3dac653468e220113f6089af6 (diff)
Convert Nodes to QObject based class(es)
This change affects lots of lines of code, but is basically a refactoring, not changing much. It does change the QtRO API, though. In the interest of making it easier to expose QtRO types to QML, the move to QObject types for Nodes was necessary. The static generators allowed for different "types" of Nodes to be created with different combinations of 1 or 2 QUrl parameters, but this also forced a Node type that had methods that might not make sense (for instance, enableRemoting() from a Node that wasn't a Host Node). And Nodes needed to be copy-able. This change addresses those issues by creating three distinct types. QRemoteObjectNode is the most basic type, and only supports acquiring Replica objects. QRemoteObjectHost Nodes add the ability to share Source objects on the network. Both Node and Host types support connecting to a Registry. QRemoteObjectRegistryHost Nodes host a Registry object other nodes can connect to. This change requires converting end-user code from the static functions (createHostNode, etc) to using the new types explicitly. Aside from the obvious change from static generator functions, there are two other impacts to user code: 1) connect() was renamed to connectToNode to not conflict with QObject's connect() 2) default QUrls for Hosting and Registry were removed (it was too easy to create name clashes with unexpected results). Change-Id: Ieff62b95e71dac870367ebb90eab83fb59fc063b Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Kevin Funk <kfunk@kde.org> Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/RemoteObjects/CppClient/main.cpp2
-rw-r--r--examples/RemoteObjects/ModelViewClient/main.cpp2
-rw-r--r--examples/RemoteObjects/ModelViewServer/main.cpp4
-rw-r--r--examples/RemoteObjects/SimpleSwitch/DirectConnectClient/main.cpp4
-rw-r--r--examples/RemoteObjects/SimpleSwitch/DirectConnectDynamicClient/main.cpp4
-rw-r--r--examples/RemoteObjects/SimpleSwitch/DirectConnectServer/main.cpp2
-rw-r--r--examples/RemoteObjects/SimpleSwitch/RegistryConnectedClient/main.cpp2
-rw-r--r--examples/RemoteObjects/SimpleSwitch/RegistryConnectedServer/main.cpp4
-rw-r--r--examples/RemoteObjects/plugins/plugin.cpp2
-rw-r--r--examples/RemoteObjects/server/main.cpp4
10 files changed, 15 insertions, 15 deletions
diff --git a/examples/RemoteObjects/CppClient/main.cpp b/examples/RemoteObjects/CppClient/main.cpp
index 70509f5..60b0dbb 100644
--- a/examples/RemoteObjects/CppClient/main.cpp
+++ b/examples/RemoteObjects/CppClient/main.cpp
@@ -49,7 +49,7 @@ class tester : public QObject
public:
tester() : QObject(Q_NULLPTR)
{
- QRemoteObjectNode m_client = QRemoteObjectNode::createNodeConnectedToRegistry();;
+ QRemoteObjectNode m_client(QUrl(QStringLiteral("local:registry")));
ptr1.reset(m_client.acquire< MinuteTimerReplica >());
ptr2.reset(m_client.acquire< MinuteTimerReplica >());
ptr3.reset(m_client.acquire< MinuteTimerReplica >());
diff --git a/examples/RemoteObjects/ModelViewClient/main.cpp b/examples/RemoteObjects/ModelViewClient/main.cpp
index 177132e..90ff33d 100644
--- a/examples/RemoteObjects/ModelViewClient/main.cpp
+++ b/examples/RemoteObjects/ModelViewClient/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
- QRemoteObjectNode node = QRemoteObjectNode::createNodeConnectedToRegistry();
+ QRemoteObjectNode node(QUrl(QStringLiteral("local:registry")));
QTreeView view;
view.setWindowTitle(QStringLiteral("RemoteView"));
view.resize(640,480);
diff --git a/examples/RemoteObjects/ModelViewServer/main.cpp b/examples/RemoteObjects/ModelViewServer/main.cpp
index 421741d..0f1342e 100644
--- a/examples/RemoteObjects/ModelViewServer/main.cpp
+++ b/examples/RemoteObjects/ModelViewServer/main.cpp
@@ -130,9 +130,9 @@ int main(int argc, char *argv[])
roles << Qt::DisplayRole << Qt::BackgroundRole;
qDebug() << "Creating registry host";
- QRemoteObjectNode node = QRemoteObjectNode::createRegistryHostNode();
+ QRemoteObjectRegistryHost node(QUrl(QStringLiteral("local:registry")));
- QRemoteObjectNode node2 = QRemoteObjectNode::createHostNodeConnectedToRegistry();
+ QRemoteObjectHost node2(QUrl(QStringLiteral("local:replica")), QUrl(QStringLiteral("local:registry")));
node2.enableRemoting(&sourceModel, QStringLiteral("RemoteModel"), roles);
QTreeView view;
diff --git a/examples/RemoteObjects/SimpleSwitch/DirectConnectClient/main.cpp b/examples/RemoteObjects/SimpleSwitch/DirectConnectClient/main.cpp
index e72ee1b..c67aa52 100644
--- a/examples/RemoteObjects/SimpleSwitch/DirectConnectClient/main.cpp
+++ b/examples/RemoteObjects/SimpleSwitch/DirectConnectClient/main.cpp
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
QSharedPointer<SimpleSwitchReplica> ptr;
- QRemoteObjectNode repNode = QRemoteObjectNode(); // create remote object node
- repNode.connect(); // connect with remote host node
+ QRemoteObjectNode repNode; // create remote object node
+ repNode.connectToNode(QUrl(QStringLiteral("local:replica"))); // connect with remote host node
ptr.reset(repNode.acquire<SimpleSwitchReplica>()); // acquire replica of source from host node
diff --git a/examples/RemoteObjects/SimpleSwitch/DirectConnectDynamicClient/main.cpp b/examples/RemoteObjects/SimpleSwitch/DirectConnectDynamicClient/main.cpp
index 9c1cf3a..7af8d46 100644
--- a/examples/RemoteObjects/SimpleSwitch/DirectConnectDynamicClient/main.cpp
+++ b/examples/RemoteObjects/SimpleSwitch/DirectConnectDynamicClient/main.cpp
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
QSharedPointer<QRemoteObjectDynamicReplica> ptr; // shared pointer to hold replica
- QRemoteObjectNode repNode = QRemoteObjectNode(); // create remote object node
- repNode.connect(); // connect with remote host node
+ QRemoteObjectNode repNode; // create remote object node
+ repNode.connectToNode(QUrl(QStringLiteral("local:replica"))); // connect with remote host node
ptr.reset(repNode.acquire("SimpleSwitch")); // acquire replica of source from host node
diff --git a/examples/RemoteObjects/SimpleSwitch/DirectConnectServer/main.cpp b/examples/RemoteObjects/SimpleSwitch/DirectConnectServer/main.cpp
index a2de4b2..5d522fe 100644
--- a/examples/RemoteObjects/SimpleSwitch/DirectConnectServer/main.cpp
+++ b/examples/RemoteObjects/SimpleSwitch/DirectConnectServer/main.cpp
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
SimpleSwitch srcSwitch; // create simple switch
- QRemoteObjectNode srcNode = QRemoteObjectNode::createHostNode(); // create host node without Regsitry
+ QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:replica"))); // create host node without Regsitry
srcNode.enableRemoting(&srcSwitch); // enable remoting/Sharing
return a.exec();
diff --git a/examples/RemoteObjects/SimpleSwitch/RegistryConnectedClient/main.cpp b/examples/RemoteObjects/SimpleSwitch/RegistryConnectedClient/main.cpp
index 1f2fbe2..e8de42a 100644
--- a/examples/RemoteObjects/SimpleSwitch/RegistryConnectedClient/main.cpp
+++ b/examples/RemoteObjects/SimpleSwitch/RegistryConnectedClient/main.cpp
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
QSharedPointer<QRemoteObjectDynamicReplica> ptr; // shared pointer to hold replica
- QRemoteObjectNode repNode = QRemoteObjectNode::createNodeConnectedToRegistry();
+ QRemoteObjectNode repNode(QUrl(QStringLiteral("local:registry")));
ptr.reset(repNode.acquire("SimpleSwitch")); // acquire replica of source from host node
diff --git a/examples/RemoteObjects/SimpleSwitch/RegistryConnectedServer/main.cpp b/examples/RemoteObjects/SimpleSwitch/RegistryConnectedServer/main.cpp
index 03869de..34af643 100644
--- a/examples/RemoteObjects/SimpleSwitch/RegistryConnectedServer/main.cpp
+++ b/examples/RemoteObjects/SimpleSwitch/RegistryConnectedServer/main.cpp
@@ -48,8 +48,8 @@ int main(int argc, char *argv[])
SimpleSwitch srcSwitch; // create simple switch
- QRemoteObjectNode regNode = QRemoteObjectNode::createRegistryHostNode(); // create node that hosts registy
- QRemoteObjectNode srcNode = QRemoteObjectNode::createHostNodeConnectedToRegistry(); // create node that will host source and connect to registry
+ QRemoteObjectRegistryHost regNode(QUrl(QStringLiteral("local:registry"))); // create node that hosts registy
+ QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:replica")), QUrl(QStringLiteral("local:registry"))); // create node that will host source and connect to registry
//Note, you can add srcSwitch directly to regNode if desired.
//We use two Nodes here, as the regNode could easily be in a third process.
diff --git a/examples/RemoteObjects/plugins/plugin.cpp b/examples/RemoteObjects/plugins/plugin.cpp
index 0303ad5..3b20078 100644
--- a/examples/RemoteObjects/plugins/plugin.cpp
+++ b/examples/RemoteObjects/plugins/plugin.cpp
@@ -117,7 +117,7 @@ public:
Q_UNUSED(uri);
Q_ASSERT(uri == QLatin1String("TimeExample"));
engine->addImportPath(QStringLiteral("qrc:/qml"));
- m_client = QRemoteObjectNode::createNodeConnectedToRegistry();
+ m_client.setRegistryUrl(QUrl(QStringLiteral("local:registry")));
}
void registerTypes(const char *uri)
{
diff --git a/examples/RemoteObjects/server/main.cpp b/examples/RemoteObjects/server/main.cpp
index 15f76a2..0036bdd 100644
--- a/examples/RemoteObjects/server/main.cpp
+++ b/examples/RemoteObjects/server/main.cpp
@@ -85,8 +85,8 @@ int main(int argc, char *argv[])
#elif defined(Q_OS_WIN32)
SetConsoleCtrlHandler((PHANDLER_ROUTINE)WinHandler, TRUE);
#endif
- QRemoteObjectNode node = QRemoteObjectNode::createRegistryHostNode();
- QRemoteObjectNode node2 = QRemoteObjectNode::createHostNodeConnectedToRegistry();
+ QRemoteObjectHost node(QUrl(QStringLiteral("local:replica")),QUrl(QStringLiteral("local:registry")));
+ QRemoteObjectRegistryHost node2(QUrl(QStringLiteral("local:registry")));
MinuteTimer timer;
node2.enableRemoting(&timer);