mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 23:35:55 +00:00
Improve source compatibility with Qt 6.0
This commit is contained in:
parent
32a74e3416
commit
90a513dc3d
@ -233,17 +233,17 @@ NvHTTP::getDisplayModeList(QString serverInfo)
|
|||||||
|
|
||||||
while (!xmlReader.atEnd()) {
|
while (!xmlReader.atEnd()) {
|
||||||
while (xmlReader.readNextStartElement()) {
|
while (xmlReader.readNextStartElement()) {
|
||||||
QStringRef name = xmlReader.name();
|
auto name = xmlReader.name();
|
||||||
if (name == "DisplayMode") {
|
if (name == QString("DisplayMode")) {
|
||||||
modes.append(NvDisplayMode());
|
modes.append(NvDisplayMode());
|
||||||
}
|
}
|
||||||
else if (name == "Width") {
|
else if (name == QString("Width")) {
|
||||||
modes.last().width = xmlReader.readElementText().toInt();
|
modes.last().width = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
else if (name == "Height") {
|
else if (name == QString("Height")) {
|
||||||
modes.last().height = xmlReader.readElementText().toInt();
|
modes.last().height = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
else if (name == "RefreshRate") {
|
else if (name == QString("RefreshRate")) {
|
||||||
modes.last().refreshRate = xmlReader.readElementText().toInt();
|
modes.last().refreshRate = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,8 +266,8 @@ NvHTTP::getAppList()
|
|||||||
QVector<NvApp> apps;
|
QVector<NvApp> apps;
|
||||||
while (!xmlReader.atEnd()) {
|
while (!xmlReader.atEnd()) {
|
||||||
while (xmlReader.readNextStartElement()) {
|
while (xmlReader.readNextStartElement()) {
|
||||||
QStringRef name = xmlReader.name();
|
auto name = xmlReader.name();
|
||||||
if (name == "App") {
|
if (name == QString("App")) {
|
||||||
// We must have a valid app before advancing to the next one
|
// We must have a valid app before advancing to the next one
|
||||||
if (!apps.isEmpty() && !apps.last().isInitialized()) {
|
if (!apps.isEmpty() && !apps.last().isInitialized()) {
|
||||||
qWarning() << "Invalid applist XML";
|
qWarning() << "Invalid applist XML";
|
||||||
@ -276,16 +276,16 @@ NvHTTP::getAppList()
|
|||||||
}
|
}
|
||||||
apps.append(NvApp());
|
apps.append(NvApp());
|
||||||
}
|
}
|
||||||
else if (name == "AppTitle") {
|
else if (name == QString("AppTitle")) {
|
||||||
apps.last().name = xmlReader.readElementText();
|
apps.last().name = xmlReader.readElementText();
|
||||||
}
|
}
|
||||||
else if (name == "ID") {
|
else if (name == QString("ID")) {
|
||||||
apps.last().id = xmlReader.readElementText().toInt();
|
apps.last().id = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
else if (name == "IsHdrSupported") {
|
else if (name == QString("IsHdrSupported")) {
|
||||||
apps.last().hdrSupported = xmlReader.readElementText() == "1";
|
apps.last().hdrSupported = xmlReader.readElementText() == "1";
|
||||||
}
|
}
|
||||||
else if (name == "IsAppCollectorGame") {
|
else if (name == QString("IsAppCollectorGame")) {
|
||||||
apps.last().isAppCollectorGame = xmlReader.readElementText() == "1";
|
apps.last().isAppCollectorGame = xmlReader.readElementText() == "1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ NvHTTP::verifyResponseStatus(QString xml)
|
|||||||
|
|
||||||
while (xmlReader.readNextStartElement())
|
while (xmlReader.readNextStartElement())
|
||||||
{
|
{
|
||||||
if (xmlReader.name() == "root")
|
if (xmlReader.name() == QString("root"))
|
||||||
{
|
{
|
||||||
// Status code can be 0xFFFFFFFF in some rare cases on GFE 3.20.3, and
|
// Status code can be 0xFFFFFFFF in some rare cases on GFE 3.20.3, and
|
||||||
// QString::toInt() will fail in that case, so use QString::toUInt()
|
// QString::toInt() will fail in that case, so use QString::toUInt()
|
||||||
|
@ -305,8 +305,10 @@ int main(int argc, char *argv[])
|
|||||||
// NB: We can't use QGuiApplication::platformName() here because it is only
|
// NB: We can't use QGuiApplication::platformName() here because it is only
|
||||||
// set once the QGuiApplication is created, which is too late to enable High DPI :(
|
// set once the QGuiApplication is created, which is too late to enable High DPI :(
|
||||||
if (WMUtils::isRunningWindowManager()) {
|
if (WMUtils::isRunningWindowManager()) {
|
||||||
// Enable High DPI support
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
// Enable High DPI support on Qt 5.x. It is always enabled on Qt 6.0
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
// Enable fractional High DPI scaling on Qt 5.14 and later
|
// Enable fractional High DPI scaling on Qt 5.14 and later
|
||||||
|
Loading…
x
Reference in New Issue
Block a user