aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmldebug
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-04-09 18:15:32 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-10-11 15:02:15 +0200
commit1d2cf00cecd537cc1dfdedda776897c0dc23e229 (patch)
tree9a25537bd5cc92bc3b7a69da63dc825ae2fb7676 /src/qmldebug
parent5bb77e39c7448a9dd5255fb18e9df07348d0ea95 (diff)
QQmlDebugConnection: code cosmetics
Fix some typos, use auto. Change-Id: Ia0cbb6486e327d250ca40d861934e287646862db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qmldebug')
-rw-r--r--src/qmldebug/qqmldebugconnection.cpp27
-rw-r--r--src/qmldebug/qqmldebugconnection_p.h1
2 files changed, 14 insertions, 14 deletions
diff --git a/src/qmldebug/qqmldebugconnection.cpp b/src/qmldebug/qqmldebugconnection.cpp
index 4e087ee6db..15c56fc20d 100644
--- a/src/qmldebug/qqmldebugconnection.cpp
+++ b/src/qmldebug/qqmldebugconnection.cpp
@@ -205,14 +205,14 @@ void QQmlDebugConnection::protocolReadyRead()
QHash<QString, QQmlDebugClient *>::Iterator iter = d->plugins.begin();
for (; iter != d->plugins.end(); ++iter) {
- const QString pluginName = iter.key();
- QQmlDebugClient::State newSate = QQmlDebugClient::Unavailable;
+ const QString &pluginName = iter.key();
+ QQmlDebugClient::State newState = QQmlDebugClient::Unavailable;
if (d->serverPlugins.contains(pluginName))
- newSate = QQmlDebugClient::Enabled;
+ newState = QQmlDebugClient::Enabled;
if (oldServerPlugins.contains(pluginName)
!= d->serverPlugins.contains(pluginName)) {
- iter.value()->stateChanged(newSate);
+ iter.value()->stateChanged(newState);
}
}
} else {
@@ -223,9 +223,10 @@ void QQmlDebugConnection::protocolReadyRead()
if (iter == d->plugins.end()) {
// We can get more messages for plugins we have removed because it takes time to
// send the advertisement message but the removal is instant locally.
- if (!d->removedPlugins.contains(name))
+ if (!d->removedPlugins.contains(name)) {
qWarning() << "QQmlDebugConnection: Message received for missing plugin"
<< name;
+ }
} else {
QQmlDebugClient *client = *iter;
QByteArray message;
@@ -307,7 +308,7 @@ void QQmlDebugConnection::close()
bool QQmlDebugConnection::waitForConnected(int msecs)
{
Q_D(QQmlDebugConnection);
- QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ auto socket = qobject_cast<QAbstractSocket*>(d->device);
if (!socket) {
if (!d->server || (!d->server->hasPendingConnections() &&
!d->server->waitForNewConnection(msecs)))
@@ -324,7 +325,7 @@ bool QQmlDebugConnection::waitForConnected(int msecs)
QQmlDebugClient *QQmlDebugConnection::client(const QString &name) const
{
Q_D(const QQmlDebugConnection);
- return d->plugins.value(name, 0);
+ return d->plugins.value(name, nullptr);
}
bool QQmlDebugConnection::addClient(const QString &name, QQmlDebugClient *client)
@@ -371,9 +372,9 @@ bool QQmlDebugConnection::sendMessage(const QString &name, const QByteArray &mes
void QQmlDebugConnectionPrivate::flush()
{
- if (QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(device))
+ if (auto socket = qobject_cast<QAbstractSocket *>(device))
socket->flush();
- else if (QLocalSocket *socket = qobject_cast<QLocalSocket *>(device))
+ else if (auto socket = qobject_cast<QLocalSocket *>(device))
socket->flush();
}
@@ -382,7 +383,7 @@ void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
Q_D(QQmlDebugConnection);
if (d->gotHello)
close();
- QTcpSocket *socket = new QTcpSocket(this);
+ auto socket = new QTcpSocket(this);
d->device = socket;
d->createProtocol();
connect(socket, &QAbstractSocket::disconnected, this, &QQmlDebugConnection::socketDisconnected);
@@ -430,8 +431,8 @@ public:
}
signals:
- void socketError(QAbstractSocket::SocketError error);
- void socketStateChanged(QAbstractSocket::SocketState state);
+ void socketError(QAbstractSocket::SocketError);
+ void socketStateChanged(QAbstractSocket::SocketState);
};
void QQmlDebugConnection::newConnection()
@@ -443,7 +444,7 @@ void QQmlDebugConnection::newConnection()
d->device = socket;
d->createProtocol();
connect(socket, &QLocalSocket::disconnected, this, &QQmlDebugConnection::socketDisconnected);
- LocalSocketSignalTranslator *translator = new LocalSocketSignalTranslator(socket);
+ auto translator = new LocalSocketSignalTranslator(socket);
connect(translator, &LocalSocketSignalTranslator::socketError,
this, &QQmlDebugConnection::socketError);
diff --git a/src/qmldebug/qqmldebugconnection_p.h b/src/qmldebug/qqmldebugconnection_p.h
index ad9376886c..5abdd2943b 100644
--- a/src/qmldebug/qqmldebugconnection_p.h
+++ b/src/qmldebug/qqmldebugconnection_p.h
@@ -61,7 +61,6 @@ class QQmlDebugConnectionPrivate;
class QQmlDebugConnection : public QObject
{
Q_OBJECT
- Q_DISABLE_COPY(QQmlDebugConnection)
Q_DECLARE_PRIVATE(QQmlDebugConnection)
public:
QQmlDebugConnection(QObject *parent = nullptr);