Fix conflict with macros on Windows.

This commit is contained in:
Roman Telezhynskyi 2024-04-16 11:46:02 +03:00
parent cd7bf7d261
commit 5b92408fee
3 changed files with 9 additions and 10 deletions

View File

@ -298,8 +298,7 @@ void VGAnalytics::SendAppCloseEvent(qint64 engagementTimeMsec)
}; };
SendEvent(QStringLiteral("vapp_close"), params); SendEvent(QStringLiteral("vapp_close"), params);
QNetworkReply *reply = d->PostMessage(); if (QNetworkReply *reply = d->SendAnalytics())
if (reply)
{ {
QTimer timer; QTimer timer;
const int timeoutSeconds = 3; // Wait for 3 seconds const int timeoutSeconds = 3; // Wait for 3 seconds

View File

@ -78,7 +78,7 @@ VGAnalyticsWorker::VGAnalyticsWorker(QObject *parent)
m_screenScaleFactor = screen->logicalDotsPerInchX() / 96.0; m_screenScaleFactor = screen->logicalDotsPerInchX() / 96.0;
m_timer.setInterval(m_timerInterval); m_timer.setInterval(m_timerInterval);
connect(&m_timer, &QTimer::timeout, this, &VGAnalyticsWorker::PostMessage); connect(&m_timer, &QTimer::timeout, this, &VGAnalyticsWorker::SendAnalytics);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -203,7 +203,7 @@ void VGAnalyticsWorker::EnqueQueryWithCurrentTime(const QJsonObject &query)
* The message POST is asyncroniously when the server * The message POST is asyncroniously when the server
* answered a signal will be emitted. * answered a signal will be emitted.
*/ */
auto VGAnalyticsWorker::PostMessage() -> QNetworkReply * auto VGAnalyticsWorker::SendAnalytics() -> QNetworkReply *
{ {
if (m_messageQueue.isEmpty()) if (m_messageQueue.isEmpty())
{ {
@ -229,7 +229,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
{ {
// too old. // too old.
m_messageQueue.dequeue(); m_messageQueue.dequeue();
return PostMessage(); return SendAnalytics();
} }
QByteArray const requestJson = QJsonDocument(buffer.postQuery).toJson(QJsonDocument::Compact); QByteArray const requestJson = QJsonDocument(buffer.postQuery).toJson(QJsonDocument::Compact);
@ -258,7 +258,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
} }
QNetworkReply *reply = networkManager->post(m_request, requestJson); QNetworkReply *reply = networkManager->post(m_request, requestJson);
connect(reply, &QNetworkReply::finished, this, &VGAnalyticsWorker::PostMessageFinished); connect(reply, &QNetworkReply::finished, this, &VGAnalyticsWorker::SendAnalyticsFinished);
return reply; return reply;
} }
@ -272,7 +272,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
* If message couldn't be send then next try is when the * If message couldn't be send then next try is when the
* timer emits its signal. * timer emits its signal.
*/ */
void VGAnalyticsWorker::PostMessageFinished() void VGAnalyticsWorker::SendAnalyticsFinished()
{ {
auto *reply = qobject_cast<QNetworkReply *>(sender()); auto *reply = qobject_cast<QNetworkReply *>(sender());
@ -289,6 +289,6 @@ void VGAnalyticsWorker::PostMessageFinished()
LogMessage(VGAnalytics::Debug, QStringLiteral("Message sent")); LogMessage(VGAnalytics::Debug, QStringLiteral("Message sent"));
m_messageQueue.dequeue(); m_messageQueue.dequeue();
PostMessage(); SendAnalytics();
reply->deleteLater(); reply->deleteLater();
} }

View File

@ -91,8 +91,8 @@ public:
void Enable(bool state); void Enable(bool state);
public slots: public slots:
QNetworkReply *PostMessage(); // NOLINT(modernize-use-trailing-return-type) QNetworkReply *SendAnalytics(); // NOLINT(modernize-use-trailing-return-type)
void PostMessageFinished(); void SendAnalyticsFinished();
private: private:
Q_DISABLE_COPY_MOVE(VGAnalyticsWorker) // NOLINT Q_DISABLE_COPY_MOVE(VGAnalyticsWorker) // NOLINT