mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-03 16:25:54 +00:00
Address Clazy warnings
This commit is contained in:
parent
164b3edd41
commit
1ebb5fefb1
@ -15,8 +15,8 @@ AutoUpdateChecker::AutoUpdateChecker(QObject *parent) :
|
|||||||
// Allow HTTP redirects
|
// Allow HTTP redirects
|
||||||
m_Nam.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
m_Nam.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
|
|
||||||
connect(&m_Nam, SIGNAL(finished(QNetworkReply*)),
|
connect(&m_Nam, &QNetworkAccessManager::finished,
|
||||||
this, SLOT(handleUpdateCheckRequestFinished(QNetworkReply*)));
|
this, &AutoUpdateChecker::handleUpdateCheckRequestFinished);
|
||||||
|
|
||||||
QString currentVersion(VERSION_STR);
|
QString currentVersion(VERSION_STR);
|
||||||
qDebug() << "Current Moonlight version:" << currentVersion;
|
qDebug() << "Current Moonlight version:" << currentVersion;
|
||||||
|
@ -46,8 +46,8 @@ public:
|
|||||||
m_Computer(computer),
|
m_Computer(computer),
|
||||||
m_App(app)
|
m_App(app)
|
||||||
{
|
{
|
||||||
connect(this, SIGNAL(boxArtFetchCompleted(NvComputer*,NvApp,QUrl)),
|
connect(this, &NetworkBoxArtLoadTask::boxArtFetchCompleted,
|
||||||
boxArtManager, SLOT(handleBoxArtLoadComplete(NvComputer*,NvApp,QUrl)));
|
boxArtManager, &BoxArtManager::handleBoxArtLoadComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -164,7 +164,7 @@ ComputerManager::ComputerManager(QObject *parent)
|
|||||||
// because NvHTTP uses aboutToQuit() to abort requests in progres
|
// because NvHTTP uses aboutToQuit() to abort requests in progres
|
||||||
// while quitting, however this is a one time signal - additional
|
// while quitting, however this is a one time signal - additional
|
||||||
// requests would not be aborted and block termination.
|
// requests would not be aborted and block termination.
|
||||||
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(handleAboutToQuit()));
|
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &ComputerManager::handleAboutToQuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputerManager::~ComputerManager()
|
ComputerManager::~ComputerManager()
|
||||||
@ -302,8 +302,8 @@ void ComputerManager::startPollingComputer(NvComputer* computer)
|
|||||||
|
|
||||||
if (!pollingEntry->isActive()) {
|
if (!pollingEntry->isActive()) {
|
||||||
PcMonitorThread* thread = new PcMonitorThread(computer);
|
PcMonitorThread* thread = new PcMonitorThread(computer);
|
||||||
connect(thread, SIGNAL(computerStateChanged(NvComputer*)),
|
connect(thread, &PcMonitorThread::computerStateChanged,
|
||||||
this, SLOT(handleComputerStateChanged(NvComputer*)));
|
this, &ComputerManager::handleComputerStateChanged);
|
||||||
pollingEntry->setActiveThread(thread);
|
pollingEntry->setActiveThread(thread);
|
||||||
thread->start();
|
thread->start();
|
||||||
}
|
}
|
||||||
@ -337,7 +337,6 @@ void ComputerManager::handleMdnsServiceResolved(MdnsPendingComputer* computer,
|
|||||||
address.isInSubnet(QHostAddress("fec0::"), 10) ||
|
address.isInSubnet(QHostAddress("fec0::"), 10) ||
|
||||||
address.isInSubnet(QHostAddress("fc00::"), 7)) {
|
address.isInSubnet(QHostAddress("fc00::"), 7)) {
|
||||||
addNewHost(address.toString(), true, v6Global);
|
addNewHost(address.toString(), true, v6Global);
|
||||||
added = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -418,7 +417,7 @@ void ComputerManager::deleteHost(NvComputer* computer)
|
|||||||
void ComputerManager::renameHost(NvComputer* computer, QString name)
|
void ComputerManager::renameHost(NvComputer* computer, QString name)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
QWriteLocker(&computer->lock);
|
QWriteLocker lock(&computer->lock);
|
||||||
|
|
||||||
computer->name = name;
|
computer->name = name;
|
||||||
computer->hasCustomName = true;
|
computer->hasCustomName = true;
|
||||||
|
@ -70,7 +70,7 @@ private:
|
|||||||
m_Resolver = new QMdnsEngine::Resolver(m_Server, m_Hostname);
|
m_Resolver = new QMdnsEngine::Resolver(m_Server, m_Hostname);
|
||||||
connect(m_Resolver, &QMdnsEngine::Resolver::resolved,
|
connect(m_Resolver, &QMdnsEngine::Resolver::resolved,
|
||||||
this, &MdnsPendingComputer::handleResolvedAddress);
|
this, &MdnsPendingComputer::handleResolvedAddress);
|
||||||
QTimer::singleShot(2000, this, SLOT(handleResolvedTimeout()));
|
QTimer::singleShot(2000, this, &MdnsPendingComputer::handleResolvedTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray m_Hostname;
|
QByteArray m_Hostname;
|
||||||
|
@ -143,7 +143,7 @@ QSslKey
|
|||||||
IdentityManager::getSslKey()
|
IdentityManager::getSslKey()
|
||||||
{
|
{
|
||||||
if (m_CachedSslKey.isNull()) {
|
if (m_CachedSslKey.isNull()) {
|
||||||
BIO* bio = BIO_new_mem_buf(m_CachedPrivateKey.data(), -1);
|
BIO* bio = BIO_new_mem_buf(m_CachedPrivateKey.constData(), -1);
|
||||||
THROW_BAD_ALLOC_IF_NULL(bio);
|
THROW_BAD_ALLOC_IF_NULL(bio);
|
||||||
|
|
||||||
EVP_PKEY* pk = PEM_read_bio_PrivateKey(bio, nullptr, nullptr, nullptr);
|
EVP_PKEY* pk = PEM_read_bio_PrivateKey(bio, nullptr, nullptr, nullptr);
|
||||||
|
@ -30,6 +30,7 @@ NvComputer::NvComputer(QSettings& settings)
|
|||||||
this->serverCert = QSslCertificate(settings.value(SER_SRVCERT).toByteArray());
|
this->serverCert = QSslCertificate(settings.value(SER_SRVCERT).toByteArray());
|
||||||
|
|
||||||
int appCount = settings.beginReadArray(SER_APPLIST);
|
int appCount = settings.beginReadArray(SER_APPLIST);
|
||||||
|
this->appList.reserve(appCount);
|
||||||
for (int i = 0; i < appCount; i++) {
|
for (int i = 0; i < appCount; i++) {
|
||||||
settings.setArrayIndex(i);
|
settings.setArrayIndex(i);
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ NvComputer::NvComputer(QString address, QString serverInfo, QSslCertificate serv
|
|||||||
QString newMacString = NvHTTP::getXmlString(serverInfo, "mac");
|
QString newMacString = NvHTTP::getXmlString(serverInfo, "mac");
|
||||||
if (newMacString != "00:00:00:00:00:00") {
|
if (newMacString != "00:00:00:00:00:00") {
|
||||||
QStringList macOctets = newMacString.split(':');
|
QStringList macOctets = newMacString.split(':');
|
||||||
for (QString macOctet : macOctets) {
|
for (const QString& macOctet : macOctets) {
|
||||||
this->macAddress.append((char) macOctet.toInt(nullptr, 16));
|
this->macAddress.append((char) macOctet.toInt(nullptr, 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,8 @@ NvHTTP::parseQuad(QString quad)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList parts = quad.split(".");
|
QStringList parts = quad.split(".");
|
||||||
for (int i = 0; i < 4; i++)
|
ret.reserve(parts.length());
|
||||||
|
for (int i = 0; i < parts.length(); i++)
|
||||||
{
|
{
|
||||||
ret.append(parts.at(i).toInt());
|
ret.append(parts.at(i).toInt());
|
||||||
}
|
}
|
||||||
@ -391,7 +392,7 @@ void NvHTTP::handleSslErrors(QNetworkReply* reply, const QList<QSslError>& error
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto error : errors) {
|
for (const QSslError& error : errors) {
|
||||||
if (m_ServerCert != error.certificate()) {
|
if (m_ServerCert != error.certificate()) {
|
||||||
ignoreErrors = false;
|
ignoreErrors = false;
|
||||||
break;
|
break;
|
||||||
@ -462,10 +463,10 @@ NvHTTP::openConnection(QUrl baseUrl,
|
|||||||
|
|
||||||
// Run the request with a timeout if requested
|
// Run the request with a timeout if requested
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||||
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), &loop, SLOT(quit()));
|
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, &loop, &QEventLoop::quit);
|
||||||
if (timeoutMs) {
|
if (timeoutMs) {
|
||||||
QTimer::singleShot(timeoutMs, &loop, SLOT(quit()));
|
QTimer::singleShot(timeoutMs, &loop, &QEventLoop::quit);
|
||||||
}
|
}
|
||||||
if (logLevel >= NvLogLevel::NVLL_VERBOSE) {
|
if (logLevel >= NvLogLevel::NVLL_VERBOSE) {
|
||||||
qInfo() << "Executing request:" << url.toString();
|
qInfo() << "Executing request:" << url.toString();
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
int height;
|
int height;
|
||||||
int refreshRate;
|
int refreshRate;
|
||||||
};
|
};
|
||||||
|
Q_DECLARE_TYPEINFO(NvDisplayMode, Q_PRIMITIVE_TYPE);
|
||||||
|
|
||||||
class GfeHttpResponseException : public std::exception
|
class GfeHttpResponseException : public std::exception
|
||||||
{
|
{
|
||||||
|
@ -215,7 +215,7 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
|
|||||||
QByteArray salt = generateRandomBytes(16);
|
QByteArray salt = generateRandomBytes(16);
|
||||||
QByteArray saltedPin = saltPin(salt, pin);
|
QByteArray saltedPin = saltPin(salt, pin);
|
||||||
|
|
||||||
QByteArray aesKey = QCryptographicHash::hash(saltedPin, hashAlgo).data();
|
QByteArray aesKey = QCryptographicHash::hash(saltedPin, hashAlgo).constData();
|
||||||
aesKey.truncate(16);
|
aesKey.truncate(16);
|
||||||
|
|
||||||
QString getCert = m_Http.openConnectionToString(m_Http.m_BaseUrlHttp,
|
QString getCert = m_Http.openConnectionToString(m_Http.m_BaseUrlHttp,
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
void handleUnknownOptions()
|
void handleUnknownOptions()
|
||||||
{
|
{
|
||||||
if (unknownOptionNames().length()) {
|
if (!unknownOptionNames().isEmpty()) {
|
||||||
showError(QString("Unknown options: %1").arg(unknownOptionNames().join(", ")));
|
showError(QString("Unknown options: %1").arg(unknownOptionNames().join(", ")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,25 +325,21 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||||||
// Resolve display's width and height
|
// Resolve display's width and height
|
||||||
QRegularExpression resolutionRexExp("^(720|1080|1440|4K|resolution)$");
|
QRegularExpression resolutionRexExp("^(720|1080|1440|4K|resolution)$");
|
||||||
QStringList resoOptions = parser.optionNames().filter(resolutionRexExp);
|
QStringList resoOptions = parser.optionNames().filter(resolutionRexExp);
|
||||||
bool displaySet = resoOptions.length();
|
bool displaySet = !resoOptions.isEmpty();
|
||||||
if (displaySet) {
|
if (displaySet) {
|
||||||
QString name = resoOptions.last();
|
QString name = resoOptions.last();
|
||||||
if (name == "720") {
|
if (name == "720") {
|
||||||
preferences->width = 1280;
|
preferences->width = 1280;
|
||||||
preferences->height = 720;
|
preferences->height = 720;
|
||||||
displaySet = true;
|
|
||||||
} else if (name == "1080") {
|
} else if (name == "1080") {
|
||||||
preferences->width = 1920;
|
preferences->width = 1920;
|
||||||
preferences->height = 1080;
|
preferences->height = 1080;
|
||||||
displaySet = true;
|
|
||||||
} else if (name == "1440") {
|
} else if (name == "1440") {
|
||||||
preferences->width = 2560;
|
preferences->width = 2560;
|
||||||
preferences->height = 1440;
|
preferences->height = 1440;
|
||||||
displaySet = true;
|
|
||||||
} else if (name == "4K") {
|
} else if (name == "4K") {
|
||||||
preferences->width = 3840;
|
preferences->width = 3840;
|
||||||
preferences->height = 2160;
|
preferences->height = 2160;
|
||||||
displaySet = true;
|
|
||||||
} else if (name == "resolution") {
|
} else if (name == "resolution") {
|
||||||
auto resolution = parser.getResolutionOptionValue(name);
|
auto resolution = parser.getResolutionOptionValue(name);
|
||||||
preferences->width = resolution.first;
|
preferences->width = resolution.first;
|
||||||
|
@ -15,7 +15,7 @@ SdlGamepadKeyNavigation::SdlGamepadKeyNavigation()
|
|||||||
m_LastAxisNavigationEventTime(0)
|
m_LastAxisNavigationEventTime(0)
|
||||||
{
|
{
|
||||||
m_PollingTimer = new QTimer(this);
|
m_PollingTimer = new QTimer(this);
|
||||||
connect(m_PollingTimer, SIGNAL(timeout()), this, SLOT(onPollingTimerFired()));
|
connect(m_PollingTimer, &QTimer::timeout, this, &SdlGamepadKeyNavigation::onPollingTimerFired);
|
||||||
}
|
}
|
||||||
|
|
||||||
SdlGamepadKeyNavigation::~SdlGamepadKeyNavigation()
|
SdlGamepadKeyNavigation::~SdlGamepadKeyNavigation()
|
||||||
|
@ -13,8 +13,8 @@ MappingFetcher::MappingFetcher(QObject *parent) :
|
|||||||
// Allow HTTP redirects
|
// Allow HTTP redirects
|
||||||
m_Nam.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
m_Nam.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
|
|
||||||
connect(&m_Nam, SIGNAL(finished(QNetworkReply*)),
|
connect(&m_Nam, &QNetworkAccessManager::finished,
|
||||||
this, SLOT(handleMappingListFetched(QNetworkReply*)));
|
this, &MappingFetcher::handleMappingListFetched);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingFetcher::start()
|
void MappingFetcher::start()
|
||||||
|
@ -41,7 +41,7 @@ MappingManager::MappingManager()
|
|||||||
#else
|
#else
|
||||||
.split('\n', QString::SkipEmptyParts);
|
.split('\n', QString::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
for (QString sdlMapping : sdlMappings) {
|
for (const QString& sdlMapping : sdlMappings) {
|
||||||
SdlGamepadMapping mapping(sdlMapping);
|
SdlGamepadMapping mapping(sdlMapping);
|
||||||
addMapping(mapping);
|
addMapping(mapping);
|
||||||
}
|
}
|
||||||
|
@ -281,8 +281,8 @@ public:
|
|||||||
// Queue this sample for the next v-sync
|
// Queue this sample for the next v-sync
|
||||||
CMSampleTimingInfo timingInfo = {
|
CMSampleTimingInfo timingInfo = {
|
||||||
.duration = kCMTimeInvalid,
|
.duration = kCMTimeInvalid,
|
||||||
|
.presentationTimeStamp = CMClockMakeHostTimeFromSystemUnits(mach_absolute_time()),
|
||||||
.decodeTimeStamp = kCMTimeInvalid,
|
.decodeTimeStamp = kCMTimeInvalid,
|
||||||
.presentationTimeStamp = CMClockMakeHostTimeFromSystemUnits(mach_absolute_time())
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CMSampleBufferRef sampleBuffer;
|
CMSampleBufferRef sampleBuffer;
|
||||||
@ -365,6 +365,7 @@ public:
|
|||||||
if ([device.name containsString:@" 5"]) {
|
if ([device.name containsString:@" 5"]) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"No HEVC Main10 support on Skylake iGPU");
|
"No HEVC Main10 support on Skylake iGPU");
|
||||||
|
[device release];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,10 +376,13 @@ public:
|
|||||||
[device.name containsString:@" M3"]) {
|
[device.name containsString:@" M3"]) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"No HEVC Main10 support on AMD GPUs until Polaris");
|
"No HEVC Main10 support on AMD GPUs until Polaris");
|
||||||
|
[device release];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[device release];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user