Fix Clazy warnings

This commit is contained in:
Cameron Gutman 2020-02-24 17:44:21 -08:00
parent 10dae7482c
commit 13d68e789f
5 changed files with 18 additions and 17 deletions

View file

@ -209,9 +209,10 @@ void ComputerManager::saveHosts()
settings.remove(SER_HOSTS);
settings.beginWriteArray(SER_HOSTS);
for (int i = 0; i < m_KnownHosts.count(); i++) {
settings.setArrayIndex(i);
m_KnownHosts.value(m_KnownHosts.keys()[i])->serialize(settings);
int i = 0;
for (const NvComputer* computer : m_KnownHosts) {
settings.setArrayIndex(i++);
computer->serialize(settings);
}
settings.endArray();
}

View file

@ -58,7 +58,7 @@ NvComputer::NvComputer(QSettings& settings)
this->gpuModel = nullptr;
}
void NvComputer::serialize(QSettings& settings)
void NvComputer::serialize(QSettings& settings) const
{
QReadLocker lock(&this->lock);
@ -314,7 +314,7 @@ bool NvComputer::isReachableOverVpn()
}
}
QVector<QString> NvComputer::uniqueAddresses()
QVector<QString> NvComputer::uniqueAddresses() const
{
QVector<QString> uniqueAddressList;

View file

@ -33,10 +33,10 @@ public:
isReachableOverVpn();
QVector<QString>
uniqueAddresses();
uniqueAddresses() const;
void
serialize(QSettings& settings);
serialize(QSettings& settings) const;
enum PairState
{
@ -76,5 +76,5 @@ public:
QVector<NvApp> appList;
// Synchronization
QReadWriteLock lock;
mutable QReadWriteLock lock;
};

View file

@ -258,16 +258,16 @@ NvHTTP::getDisplayModeList(QString serverInfo)
while (!xmlReader.atEnd()) {
while (xmlReader.readNextStartElement()) {
QStringRef name = xmlReader.name();
if (xmlReader.name() == "DisplayMode") {
if (name == "DisplayMode") {
modes.append(NvDisplayMode());
}
else if (xmlReader.name() == "Width") {
else if (name == "Width") {
modes.last().width = xmlReader.readElementText().toInt();
}
else if (xmlReader.name() == "Height") {
else if (name == "Height") {
modes.last().height = xmlReader.readElementText().toInt();
}
else if (xmlReader.name() == "RefreshRate") {
else if (name == "RefreshRate") {
modes.last().refreshRate = xmlReader.readElementText().toInt();
}
}
@ -291,7 +291,7 @@ NvHTTP::getAppList()
while (!xmlReader.atEnd()) {
while (xmlReader.readNextStartElement()) {
QStringRef name = xmlReader.name();
if (xmlReader.name() == "App") {
if (name == "App") {
// We must have a valid app before advancing to the next one
if (!apps.isEmpty() && !apps.last().isInitialized()) {
qWarning() << "Invalid applist XML";
@ -300,13 +300,13 @@ NvHTTP::getAppList()
}
apps.append(NvApp());
}
else if (xmlReader.name() == "AppTitle") {
else if (name == "AppTitle") {
apps.last().name = xmlReader.readElementText();
}
else if (xmlReader.name() == "ID") {
else if (name == "ID") {
apps.last().id = xmlReader.readElementText().toInt();
}
else if (xmlReader.name() == "IsHdrSupported") {
else if (name == "IsHdrSupported") {
apps.last().hdrSupported = xmlReader.readElementText() == "1";
}
}

View file

@ -303,7 +303,7 @@ int main(int argc, char *argv[])
}
else {
#ifndef STEAM_LINK
if (qgetenv("QT_QPA_PLATFORM").isEmpty()) {
if (!qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) {
qInfo() << "Unable to detect Wayland or X11, so EGLFS will be used by default. Set QT_QPA_PLATFORM to override this.";
qputenv("QT_QPA_PLATFORM", "eglfs");