aboutsummaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-12-26 21:35:16 +0100
committerLinus Jahn <lnj@kaidan.im>2022-12-26 22:00:07 +0100
commit46995fd3fd7da4d1b035f71a1279c041b2871ffd (patch)
tree788517dbefa88fc1680b05a97e84f0e1d7403815 /src/base
parent71442ab927cd5c1c235528442fe3706f33e7ff6e (diff)
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.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/QXmppLogger.cpp2
-rw-r--r--src/base/QXmppLogger.h10
-rw-r--r--src/base/QXmppSocks.cpp4
-rw-r--r--src/base/QXmppStun.cpp32
4 files changed, 24 insertions, 24 deletions
diff --git a/src/base/QXmppLogger.cpp b/src/base/QXmppLogger.cpp
index a9c7bcef..c0758765 100644
--- a/src/base/QXmppLogger.cpp
+++ b/src/base/QXmppLogger.cpp
@@ -183,7 +183,7 @@ void QXmppLogger::log(QXmppLogger::MessageType type, const QString &text)
std::cout << qPrintable(formatted(type, text)) << std::endl;
break;
case QXmppLogger::SignalLogging:
- emit message(type, text);
+ Q_EMIT message(type, text);
break;
default:
break;
diff --git a/src/base/QXmppLogger.h b/src/base/QXmppLogger.h
index 04765d39..f851cbf6 100644
--- a/src/base/QXmppLogger.h
+++ b/src/base/QXmppLogger.h
@@ -119,7 +119,7 @@ protected:
void debug(const QString &message)
{
- emit logMessage(QXmppLogger::DebugMessage, qxmpp_loggable_trace(message));
+ Q_EMIT logMessage(QXmppLogger::DebugMessage, qxmpp_loggable_trace(message));
}
/// Logs an informational message.
@@ -128,7 +128,7 @@ protected:
void info(const QString &message)
{
- emit logMessage(QXmppLogger::InformationMessage, qxmpp_loggable_trace(message));
+ Q_EMIT logMessage(QXmppLogger::InformationMessage, qxmpp_loggable_trace(message));
}
/// Logs a warning message.
@@ -137,7 +137,7 @@ protected:
void warning(const QString &message)
{
- emit logMessage(QXmppLogger::WarningMessage, qxmpp_loggable_trace(message));
+ Q_EMIT logMessage(QXmppLogger::WarningMessage, qxmpp_loggable_trace(message));
}
/// Logs a received packet.
@@ -146,7 +146,7 @@ protected:
void logReceived(const QString &message)
{
- emit logMessage(QXmppLogger::ReceivedMessage, qxmpp_loggable_trace(message));
+ Q_EMIT logMessage(QXmppLogger::ReceivedMessage, qxmpp_loggable_trace(message));
}
/// Logs a sent packet.
@@ -155,7 +155,7 @@ protected:
void logSent(const QString &message)
{
- emit logMessage(QXmppLogger::SentMessage, qxmpp_loggable_trace(message));
+ Q_EMIT logMessage(QXmppLogger::SentMessage, qxmpp_loggable_trace(message));
}
Q_SIGNALS:
diff --git a/src/base/QXmppSocks.cpp b/src/base/QXmppSocks.cpp
index 5420f6b4..bff85456 100644
--- a/src/base/QXmppSocks.cpp
+++ b/src/base/QXmppSocks.cpp
@@ -167,7 +167,7 @@ void QXmppSocksClient::slotReadyRead()
// notify of connection
m_step = ReadyState;
- emit ready();
+ Q_EMIT ready();
}
}
@@ -295,7 +295,7 @@ void QXmppSocksServer::slotReadyRead()
// notify of connection
m_states.insert(socket, ReadyState);
- emit newConnection(socket, hostName, hostPort);
+ Q_EMIT newConnection(socket, hostName, hostPort);
// send response
buffer.resize(3);
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