summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects/qremoteobjectnode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/remoteobjects/qremoteobjectnode.cpp')
-rw-r--r--src/remoteobjects/qremoteobjectnode.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/remoteobjects/qremoteobjectnode.cpp b/src/remoteobjects/qremoteobjectnode.cpp
index 482de0f..8cbaa71 100644
--- a/src/remoteobjects/qremoteobjectnode.cpp
+++ b/src/remoteobjects/qremoteobjectnode.cpp
@@ -233,11 +233,15 @@ QRemoteObjectSourceLocations QRemoteObjectRegistryHostPrivate::remoteObjectAddre
void QRemoteObjectNode::timerEvent(QTimerEvent*)
{
Q_D(QRemoteObjectNode);
- Q_FOREACH (ClientIoDevice *conn, d->pendingReconnect) {
- if (conn->isOpen())
- d->pendingReconnect.remove(conn);
- else
+
+ for (auto it = d->pendingReconnect.begin(), end = d->pendingReconnect.end(); it != end; /*erasing*/) {
+ const auto &conn = *it;
+ if (conn->isOpen()) {
+ it = d->pendingReconnect.erase(it);
+ } else {
conn->connectToServer();
+ ++it;
+ }
}
if (d->pendingReconnect.isEmpty())
@@ -976,7 +980,7 @@ void QRemoteObjectMetaObjectManager::addFromMetaObject(const QMetaObject *metaOb
QString className = QLatin1String(metaObject->className());
if (!className.endsWith(QLatin1String("Replica")))
return;
- if (className == QStringLiteral("QRemoteObjectDynamicReplica") || staticTypes.contains(className))
+ if (className == QLatin1String("QRemoteObjectDynamicReplica") || staticTypes.contains(className))
return;
className.chop(7); //Remove 'Replica' from name
staticTypes.insert(className, metaObject);
@@ -1110,9 +1114,8 @@ void QRemoteObjectNodePrivate::onRegistryInitialized()
{
qROPrivDebug() << "Registry Initialized" << remoteObjectAddresses();
- QHashIterator<QString, QRemoteObjectSourceLocationInfo> i(remoteObjectAddresses());
- while (i.hasNext()) {
- i.next();
+ const auto remotes = remoteObjectAddresses();
+ for (auto i = remotes.cbegin(), end = remotes.cend(); i != end; ++i) {
if (replicas.contains(i.key())) //We have a replica waiting on this remoteObject
{
QSharedPointer<QReplicaImplementationInterface> rep = replicas.value(i.key()).toStrongRef();
@@ -1130,7 +1133,8 @@ void QRemoteObjectNodePrivate::onShouldReconnect(ClientIoDevice *ioDevice)
{
Q_Q(QRemoteObjectNode);
- Q_FOREACH (const QString &remoteObject, ioDevice->remoteObjects()) {
+ const auto remoteObjects = ioDevice->remoteObjects();
+ for (const QString &remoteObject : remoteObjects) {
connectedSources.remove(remoteObject);
ioDevice->removeSource(remoteObject);
if (replicas.contains(remoteObject)) { //We have a replica waiting on this remoteObject
@@ -1265,17 +1269,17 @@ void QRemoteObjectNodePrivate::onClientRead(QObject *obj)
// We need to make sure all of the source objects are in connectedSources before we add connections,
// otherwise nested QObjects could fail (we want to acquire children before parents, and the object
// list is unordered)
- Q_FOREACH (const auto &remoteObject, rxObjects) {
+ for (const auto &remoteObject : qAsConst(rxObjects)) {
qROPrivDebug() << " connectedSources.contains(" << remoteObject << ")" << connectedSources.contains(remoteObject.name) << replicas.contains(remoteObject.name);
if (!connectedSources.contains(remoteObject.name)) {
connectedSources[remoteObject.name] = SourceInfo{connection, remoteObject.typeName, remoteObject.signature};
connection->addSource(remoteObject.name);
// Make sure we handle Registry first if it is available
- if (remoteObject.name == QStringLiteral("Registry") && replicas.contains(remoteObject.name))
+ if (remoteObject.name == QLatin1String("Registry") && replicas.contains(remoteObject.name))
handleReplicaConnection(remoteObject.name);
}
}
- Q_FOREACH (const auto &remoteObject, rxObjects) {
+ for (const auto &remoteObject : qAsConst(rxObjects)) {
if (replicas.contains(remoteObject.name)) //We have a replica waiting on this remoteObject
handleReplicaConnection(remoteObject.name);
}
@@ -2226,7 +2230,7 @@ bool QRemoteObjectHostBase::enableRemoting(QAbstractItemModel *model, const QStr
QAbstractItemAdapterSourceAPI<QAbstractItemModel, QAbstractItemModelSourceAdapter> *api =
new QAbstractItemAdapterSourceAPI<QAbstractItemModel, QAbstractItemModelSourceAdapter>(name);
if (!this->objectName().isEmpty())
- adapter->setObjectName(this->objectName().append(QStringLiteral("Adapter")));
+ adapter->setObjectName(this->objectName().append(QLatin1String("Adapter")));
return enableRemoting(model, api, adapter);
}