mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 23:35:55 +00:00
Fix build with Qt 5.15
This commit is contained in:
parent
979de190dc
commit
10dae7482c
@ -1,4 +1,5 @@
|
|||||||
#include "autoupdatechecker.h"
|
#include "autoupdatechecker.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
@ -61,7 +62,7 @@ void AutoUpdateChecker::handleUpdateCheckRequestFinished(QNetworkReply* reply)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(reply->isFinished());
|
Q_ASSERT(reply->isFinished());
|
||||||
|
|
||||||
if (reply->error() == QNetworkReply::NoError) {
|
if (QNETREPLY_GET_ERROR(reply) == QNetworkReply::NoError) {
|
||||||
QTextStream stream(reply);
|
QTextStream stream(reply);
|
||||||
stream.setCodec("UTF-8");
|
stream.setCodec("UTF-8");
|
||||||
|
|
||||||
@ -154,7 +155,7 @@ void AutoUpdateChecker::handleUpdateCheckRequestFinished(QNetworkReply* reply)
|
|||||||
<< QSysInfo::buildCpuArchitecture() << getPlatform();
|
<< QSysInfo::buildCpuArchitecture() << getPlatform();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning() << "Update checking failed with error: " << reply->error();
|
qWarning() << "Update checking failed with error: " << QNETREPLY_GET_ERROR(reply);
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "nvcomputer.h"
|
#include "nvcomputer.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QUdpSocket>
|
#include <QUdpSocket>
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
@ -229,7 +230,7 @@ bool NvComputer::wake()
|
|||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning() << "Send failed:" << sock.error();
|
qWarning() << "Send failed:" << QSOCK_GET_ERROR(&sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "nvhttp.h"
|
#include "nvhttp.h"
|
||||||
|
#include "utils.h"
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -488,26 +489,26 @@ NvHTTP::openConnection(QUrl baseUrl,
|
|||||||
m_Nam.clearAccessCache();
|
m_Nam.clearAccessCache();
|
||||||
|
|
||||||
// Handle error
|
// Handle error
|
||||||
if (reply->error() != QNetworkReply::NoError)
|
if (QNETREPLY_GET_ERROR(reply) != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
if (logLevel >= NvLogLevel::NVLL_ERROR) {
|
if (logLevel >= NvLogLevel::NVLL_ERROR) {
|
||||||
qWarning() << command << " request failed with error " << reply->error();
|
qWarning() << command << " request failed with error " << QNETREPLY_GET_ERROR(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply->error() == QNetworkReply::SslHandshakeFailedError) {
|
if (QNETREPLY_GET_ERROR(reply) == QNetworkReply::SslHandshakeFailedError) {
|
||||||
// This will trigger falling back to HTTP for the serverinfo query
|
// This will trigger falling back to HTTP for the serverinfo query
|
||||||
// then pairing again to get the updated certificate.
|
// then pairing again to get the updated certificate.
|
||||||
GfeHttpResponseException exception(401, "Server certificate mismatch");
|
GfeHttpResponseException exception(401, "Server certificate mismatch");
|
||||||
delete reply;
|
delete reply;
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
else if (reply->error() == QNetworkReply::OperationCanceledError) {
|
else if (QNETREPLY_GET_ERROR(reply) == QNetworkReply::OperationCanceledError) {
|
||||||
QtNetworkReplyException exception(QNetworkReply::TimeoutError, "Request timed out");
|
QtNetworkReplyException exception(QNetworkReply::TimeoutError, "Request timed out");
|
||||||
delete reply;
|
delete reply;
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QtNetworkReplyException exception(reply->error(), reply->errorString());
|
QtNetworkReplyException exception(QNETREPLY_GET_ERROR(reply), reply->errorString());
|
||||||
delete reply;
|
delete reply;
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ void logToLoggerStream(QString& message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (s_LogLinesWritten == MAX_LOG_LINES) {
|
else if (s_LogLinesWritten == MAX_LOG_LINES) {
|
||||||
s_LoggerStream << "Log size limit reached!" << endl;
|
s_LoggerStream << "Log size limit reached!" << Qt::endl;
|
||||||
s_LogLimitReached = true;
|
s_LogLimitReached = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
10
app/utils.h
10
app/utils.h
@ -1,8 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
#define THROW_BAD_ALLOC_IF_NULL(x) \
|
#define THROW_BAD_ALLOC_IF_NULL(x) \
|
||||||
if ((x) == nullptr) throw std::bad_alloc()
|
if ((x) == nullptr) throw std::bad_alloc()
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
#define QNETREPLY_GET_ERROR(r) ((r)->networkError())
|
||||||
|
#define QSOCK_GET_ERROR(s) ((s)->socketError())
|
||||||
|
#else
|
||||||
|
#define QNETREPLY_GET_ERROR(r) ((r)->error())
|
||||||
|
#define QSOCK_GET_ERROR(s) ((s)->error())
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace WMUtils {
|
namespace WMUtils {
|
||||||
bool isRunningX11();
|
bool isRunningX11();
|
||||||
bool isRunningWayland();
|
bool isRunningWayland();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user