From 46995fd3fd7da4d1b035f71a1279c041b2871ffd Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Mon, 26 Dec 2022 21:35:16 +0100 Subject: Disable Qt keywords completely Previously we had the policy that no qt keywords were allowed in headers that may be included by users. However since there was no automatic test verifying that in some places keywords were still used. This now disables qt keywords completely, also in tests and examples. Qt keywords are in general no good or really good idea as they even conflict with the standard library (`emit` at least). In some cases in the examples I just removed the slot tag if the functions didn't need to be slots (anymore). Closes #503. --- src/base/QXmppStun.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/base/QXmppStun.cpp') diff --git a/src/base/QXmppStun.cpp b/src/base/QXmppStun.cpp index 360135a4..8a7e61c3 100644 --- a/src/base/QXmppStun.cpp +++ b/src/base/QXmppStun.cpp @@ -1186,7 +1186,7 @@ void QXmppStunTransaction::readStun(const QXmppStunMessage &response) response.messageClass() == QXmppStunMessage::Response) { m_response = response; m_retryTimer->stop(); - emit finished(); + Q_EMIT finished(); } } @@ -1211,12 +1211,12 @@ void QXmppStunTransaction::retry() if (m_tries >= STUN_RTO_MAX) { m_response.setType(QXmppStunMessage::Error); m_response.errorPhrase = QLatin1String("Request timed out"); - emit finished(); + Q_EMIT finished(); return; } // resend request - emit writeStun(m_request); + Q_EMIT writeStun(m_request); m_retryTimer->start(m_tries ? 2 * m_retryTimer->interval() : STUN_RTO_INTERVAL); m_tries++; } @@ -1360,8 +1360,8 @@ void QXmppTurnAllocation::handleDatagram(const QByteArray &buffer, const QHostAd stream >> channel; stream >> length; if (m_state == ConnectedState && m_channels.contains(channel) && length <= buffer.size() - 4) { - emit datagramReceived(buffer.mid(4, length), m_channels[channel].first, - m_channels[channel].second); + Q_EMIT datagramReceived(buffer.mid(4, length), m_channels[channel].first, + m_channels[channel].second); } return; } @@ -1488,10 +1488,10 @@ void QXmppTurnAllocation::setState(AllocationState state) } m_state = state; if (m_state == ConnectedState) { - emit connected(); + Q_EMIT connected(); } else if (m_state == UnconnectedState) { m_timer->stop(); - emit disconnected(); + Q_EMIT disconnected(); } } @@ -1684,7 +1684,7 @@ void QXmppUdpTransport::readyRead() const qint64 size = m_socket->pendingDatagramSize(); buffer.resize(size); m_socket->readDatagram(buffer.data(), buffer.size(), &remoteHost, &remotePort); - emit datagramReceived(buffer, remoteHost, remotePort); + Q_EMIT datagramReceived(buffer, remoteHost, remotePort); } } @@ -2122,7 +2122,7 @@ void QXmppIceComponent::handleDatagram(const QByteArray &buffer, const QHostAddr break; } } - emit datagramReceived(buffer); + Q_EMIT datagramReceived(buffer); return; } @@ -2282,7 +2282,7 @@ void QXmppIceComponent::handleDatagram(const QByteArray &buffer, const QHostAddr const bool wasConnected = (d->activePair != nullptr); d->activePair = pair; if (!wasConnected) { - emit connected(); + Q_EMIT connected(); } } } @@ -2362,7 +2362,7 @@ void QXmppIceComponent::transactionFinished() d->localCandidates << candidate; - emit localCandidatesChanged(); + Q_EMIT localCandidatesChanged(); } else { debug(QStringLiteral("STUN test failed (error %1)").arg(transaction->response().errorPhrase)); } @@ -2380,7 +2380,7 @@ void QXmppIceComponent::turnConnected() debug(QStringLiteral("Adding relayed candidate %1 port %2").arg(candidate.host().toString(), QString::number(candidate.port()))); d->localCandidates << candidate; - emit localCandidatesChanged(); + Q_EMIT localCandidatesChanged(); updateGatheringState(); } @@ -2521,7 +2521,7 @@ void QXmppIceComponent::updateGatheringState() if (newGatheringState != d->gatheringState) { d->gatheringState = newGatheringState; - emit gatheringStateChanged(); + Q_EMIT gatheringStateChanged(); } } @@ -2862,7 +2862,7 @@ void QXmppIceConnection::slotConnected() } info(QStringLiteral("ICE negotiation completed")); d->connectTimer->stop(); - emit connected(); + Q_EMIT connected(); } void QXmppIceConnection::slotGatheringStateChanged() @@ -2889,7 +2889,7 @@ void QXmppIceConnection::slotGatheringStateChanged() if (newGatheringState != d->gatheringState) { info(QStringLiteral("ICE gathering state changed from '%1' to '%2'").arg(gathering_states[d->gatheringState], gathering_states[newGatheringState])); d->gatheringState = newGatheringState; - emit gatheringStateChanged(); + Q_EMIT gatheringStateChanged(); } } @@ -2899,7 +2899,7 @@ void QXmppIceConnection::slotTimeout() for (auto *socket : std::as_const(d->components)) { socket->close(); } - emit disconnected(); + Q_EMIT disconnected(); } /// \cond -- cgit v1.2.3