diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,15 @@ # library setup +add_definitions( + -DQT_USE_QSTRINGBUILDER + -DQT_NO_CAST_TO_ASCII + -DQT_NO_CAST_FROM_ASCII + -DQT_STRICT_ITERATORS + -DQT_NO_URL_CAST_FROM_STRING + -DQT_NO_CAST_FROM_BYTEARRAY +) + set(KF5_VERSION ${PROJECT_VERSION}) #When we are happy with the api, we can sync with frameworks ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KSCREEN VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kscreen_version.h" diff --git a/autotests/testbackendloader.cpp b/autotests/testbackendloader.cpp --- a/autotests/testbackendloader.cpp +++ b/autotests/testbackendloader.cpp @@ -101,7 +101,7 @@ { qputenv("KSCREEN_BACKEND", "nonsense"); auto preferred = BackendManager::instance()->preferredBackend(); - QVERIFY(preferred.fileName().startsWith("KSC_QScreen")); + QVERIFY(preferred.fileName().startsWith(QLatin1String("KSC_QScreen"))); } QTEST_GUILESS_MAIN(TestBackendLoader) diff --git a/autotests/testkwaylandbackend.cpp b/autotests/testkwaylandbackend.cpp --- a/autotests/testkwaylandbackend.cpp +++ b/autotests/testkwaylandbackend.cpp @@ -76,16 +76,16 @@ { qputenv("KSCREEN_LOGGING", "false"); m_server = new WaylandTestServer(this); - m_server->setConfig(TEST_DATA + QStringLiteral("multipleoutput.json")); + m_server->setConfig(QLatin1String(TEST_DATA) + QLatin1String("multipleoutput.json")); } void testWaylandBackend::initTestCase() { qputenv("KSCREEN_BACKEND", "kwayland"); KScreen::BackendManager::instance()->shutdownBackend(); // This is how KWayland will pick up the right socket, // and thus connect to our internal test server. - setenv("WAYLAND_DISPLAY", s_socketName.toLocal8Bit(), 1); + setenv("WAYLAND_DISPLAY", s_socketName.toLocal8Bit().constData(), 1); m_server->start(); GetConfigOperation *op = new GetConfigOperation(); diff --git a/autotests/testkwaylandconfig.cpp b/autotests/testkwaylandconfig.cpp --- a/autotests/testkwaylandconfig.cpp +++ b/autotests/testkwaylandconfig.cpp @@ -75,7 +75,7 @@ // This is how KWayland will pick up the right socket, // and thus connect to our internal test server. - setenv("WAYLAND_DISPLAY", s_socketName.toLocal8Bit(), 1); + setenv("WAYLAND_DISPLAY", s_socketName.toLocal8Bit().constData(), 1); m_server = new WaylandTestServer(this); m_server->start(); @@ -105,7 +105,7 @@ auto output = config->outputs().first(); QVERIFY(output->isEnabled() == false); output->setEnabled(true); - output->setCurrentModeId("76"); + output->setCurrentModeId(QStringLiteral("76")); auto output2 = config->outputs()[2]; // is this id stable enough? output2->setPos(QPoint(4000, 1080)); diff --git a/autotests/testkwaylanddpms.cpp b/autotests/testkwaylanddpms.cpp --- a/autotests/testkwaylanddpms.cpp +++ b/autotests/testkwaylanddpms.cpp @@ -64,7 +64,7 @@ : QObject(parent) , m_server(nullptr) { - setenv("WAYLAND_DISPLAY", s_socketName.toLocal8Bit(), 1); + setenv("WAYLAND_DISPLAY", s_socketName.toLocal8Bit().constData(), true); m_server = new KScreen::WaylandTestServer(this); m_server->start(); } diff --git a/autotests/testlog.cpp b/autotests/testlog.cpp --- a/autotests/testlog.cpp +++ b/autotests/testlog.cpp @@ -49,7 +49,7 @@ void TestLog::init() { QStandardPaths::setTestModeEnabled(true); - m_defaultLogFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kscreen/kscreen.log"; + m_defaultLogFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kscreen/kscreen.log"); } void TestLog::initTestCase() @@ -66,7 +66,7 @@ void TestLog::testContext() { auto log = Log::instance(); - QString ctx("context text"); + QString ctx = QStringLiteral("context text"); QVERIFY(log != nullptr); log->setContext(ctx); QCOMPARE(log->context(), ctx); @@ -108,7 +108,7 @@ lf.remove(); QVERIFY(!lf.exists()); - QString logmsg("This is a log message. ♥"); + QString logmsg = QStringLiteral("This is a log message. ♥"); Log::log(logmsg); QVERIFY(lf.exists()); diff --git a/autotests/testqscreenbackend.cpp b/autotests/testqscreenbackend.cpp --- a/autotests/testqscreenbackend.cpp +++ b/autotests/testqscreenbackend.cpp @@ -59,7 +59,7 @@ qputenv("KSCREEN_BACKEND_INPROCESS", "1"); KScreen::BackendManager::instance()->shutdownBackend(); - m_backend = qgetenv("KSCREEN_BACKEND").constData(); + m_backend = QString::fromLocal8Bit(qgetenv("KSCREEN_BACKEND")); QElapsedTimer t; t.start(); @@ -172,16 +172,15 @@ } QVariantMap info; - - info["id"] = output->id(); - info["primary"] = output->isPrimary(); - info["enabled"] = output->isEnabled(); - info["rotation"] = output->rotation(); + info[QStringLiteral("id")] = output->id(); + info[QStringLiteral("primary")] = output->isPrimary(); + info[QStringLiteral("enabled")] = output->isEnabled(); + info[QStringLiteral("rotation")] = output->rotation(); QVariantMap pos; - pos["x"] = output->pos().x(); - pos["y"] = output->pos().y(); - info["pos"] = pos; + pos[QStringLiteral("x")] = output->pos().x(); + pos[QStringLiteral("y")] = output->pos().y(); + info[QStringLiteral("pos")] = pos; if (output->isEnabled()) { const KScreen::ModePtr mode = output->currentMode(); @@ -191,14 +190,14 @@ } QVariantMap modeInfo; - modeInfo["refresh"] = mode->refreshRate(); + modeInfo[QStringLiteral("refresh")] = mode->refreshRate(); QVariantMap modeSize; - modeSize["width"] = mode->size().width(); - modeSize["height"] = mode->size().height(); - modeInfo["size"] = modeSize; + modeSize[QStringLiteral("width")] = mode->size().width(); + modeSize[QStringLiteral("height")] = mode->size().height(); + modeInfo[QStringLiteral("size")] = modeSize; - info["mode"] = modeInfo; + info[QStringLiteral("mode")] = modeInfo; } outputList.append(info); diff --git a/autotests/testscreenconfig.cpp b/autotests/testscreenconfig.cpp --- a/autotests/testscreenconfig.cpp +++ b/autotests/testscreenconfig.cpp @@ -101,7 +101,7 @@ const OutputPtr output = config->outputs().take(1); QVERIFY(!output.isNull()); - QCOMPARE(output->name(), QString("LVDS1")); + QCOMPARE(output->name(), QLatin1String("LVDS1")); QCOMPARE(output->type(), Output::Panel); QCOMPARE(output->modes().count(), 3); QCOMPARE(output->pos(), QPoint(0, 0)); @@ -152,7 +152,7 @@ const OutputPtr output = config->outputs().take(2); QVERIFY(!output.isNull()); - QCOMPARE(output->name(), QString("HDMI1")); + QCOMPARE(output->name(), QStringLiteral("HDMI1")); QCOMPARE(output->type(), Output::HDMI); QCOMPARE(output->modes().count(), 4); QCOMPARE(output->pos(), QPoint(1280, 0)); @@ -216,9 +216,9 @@ QVERIFY(!Config::canBeApplied(brokenConfig)); primaryBroken->setCurrentModeId(currentPrimary->currentModeId()); QVERIFY(!Config::canBeApplied(brokenConfig)); - qDebug() << "brokenConfig.modes" << primaryBroken->mode("3"); + qDebug() << "brokenConfig.modes" << primaryBroken->mode(QStringLiteral("3")); primaryBroken->mode(QLatin1String("3"))->setSize(QSize(1280, 800)); - qDebug() << "brokenConfig.modes" << primaryBroken->mode("3"); + qDebug() << "brokenConfig.modes" << primaryBroken->mode(QStringLiteral("3")); QVERIFY(Config::canBeApplied(brokenConfig)); @@ -270,7 +270,7 @@ void testScreenConfig::testInvalidMode() { ModeList modes; - ModePtr invalidMode = modes.value("99"); + ModePtr invalidMode = modes.value(QStringLiteral("99")); QVERIFY(invalidMode.isNull()); auto output = new KScreen::Output(); diff --git a/backends/fake/fake.cpp b/backends/fake/fake.cpp --- a/backends/fake/fake.cpp +++ b/backends/fake/fake.cpp @@ -74,7 +74,7 @@ QString Fake::name() const { - return QString("Fake"); + return QStringLiteral("Fake"); } QString Fake::serviceName() const @@ -112,14 +112,14 @@ const QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll()); const QJsonObject json = jsonDoc.object(); - const QJsonArray outputs = json["outputs"].toArray(); + const QJsonArray outputs = json[QStringLiteral("outputs")].toArray(); Q_FOREACH(const QJsonValue &value, outputs) { const QVariantMap output = value.toObject().toVariantMap(); - if (output["id"].toInt() != outputId) { + if (output[QStringLiteral("id")].toInt() != outputId) { continue; } - return QByteArray::fromBase64(output["edid"].toByteArray()); + return QByteArray::fromBase64(output[QStringLiteral("edid")].toByteArray()); } return QByteArray(); } diff --git a/backends/fake/parser.cpp b/backends/fake/parser.cpp --- a/backends/fake/parser.cpp +++ b/backends/fake/parser.cpp @@ -38,10 +38,10 @@ const QJsonObject json = QJsonDocument::fromJson(data).object(); - ScreenPtr screen = Parser::screenFromJson(json["screen"].toObject().toVariantMap()); + ScreenPtr screen = Parser::screenFromJson(json[QStringLiteral("screen")].toObject().toVariantMap()); config->setScreen(screen); - const QVariantList outputs = json["outputs"].toArray().toVariantList(); + const QVariantList outputs = json[QStringLiteral("outputs")].toArray().toVariantList(); if (outputs.isEmpty()) { return config; } @@ -71,11 +71,11 @@ ScreenPtr Parser::screenFromJson(const QVariantMap &data) { ScreenPtr screen(new Screen); - screen->setId(data["id"].toInt()); - screen->setMinSize(Parser::sizeFromJson(data["minSize"].toMap())); - screen->setMaxSize(Parser::sizeFromJson(data["maxSize"].toMap())); - screen->setCurrentSize(Parser::sizeFromJson(data["currentSize"].toMap())); - screen->setMaxActiveOutputsCount(data["maxActiveOutputsCount"].toInt()); + screen->setId(data[QStringLiteral("id")].toInt()); + screen->setMinSize(Parser::sizeFromJson(data[QStringLiteral("minSize")].toMap())); + screen->setMaxSize(Parser::sizeFromJson(data[QStringLiteral("maxSize")].toMap())); + screen->setCurrentSize(Parser::sizeFromJson(data[QStringLiteral("currentSize")].toMap())); + screen->setMaxActiveOutputsCount(data[QStringLiteral("maxActiveOutputsCount")].toInt()); return screen; } @@ -95,53 +95,53 @@ continue; } - const QVariant property = object->property(iter.key().toLatin1()); + const QVariant property = object->property(iter.key().toLatin1().constData()); Q_ASSERT(property.isValid()); if (property.isValid()) { QVariant value = iter.value(); if (value.canConvert(property.type())) { value.convert(property.type()); - object->setProperty(iter.key().toLatin1(), value); + object->setProperty(iter.key().toLatin1().constData(), value); } else if (QString(QLatin1String("QVariant")).compare(QLatin1String(property.typeName())) == 0) { - object->setProperty(iter.key().toLatin1(), value); + object->setProperty(iter.key().toLatin1().constData(), value); } } } } OutputPtr Parser::outputFromJson(QMap< QString, QVariant > map) { OutputPtr output(new Output); - output->setId(map["id"].toInt()); + output->setId(map[QStringLiteral("id")].toInt()); QStringList preferredModes; - const QVariantList prefModes = map["preferredModes"].toList(); + const QVariantList prefModes = map[QStringLiteral("preferredModes")].toList(); Q_FOREACH(const QVariant &mode, prefModes) { preferredModes.append(mode.toString()); } output->setPreferredModes(preferredModes); - map.remove(QLatin1Literal("preferredModes")); + map.remove(QStringLiteral("preferredModes")); ModeList modelist; - const QVariantList modes = map["modes"].toList(); + const QVariantList modes = map[QStringLiteral("modes")].toList(); Q_FOREACH(const QVariant &modeValue, modes) { const ModePtr mode = Parser::modeFromJson(modeValue); modelist.insert(mode->id(), mode); } output->setModes(modelist); - map.remove(QLatin1Literal("modes")); + map.remove(QStringLiteral("modes")); - if(map.contains("clones")) { + if(map.contains(QLatin1String("clones"))) { QList clones; - Q_FOREACH(const QVariant &id, map["clones"].toList()) { + Q_FOREACH(const QVariant &id, map[QStringLiteral("clones")].toList()) { clones.append(id.toInt()); } output->setClones(clones); - map.remove(QLatin1Literal("clones")); + map.remove(QStringLiteral("clones")); } - const QString type = map["type"].toByteArray().toUpper(); + const QByteArray type = map[QStringLiteral("type")].toByteArray().toUpper(); if (type.contains("LVDS") || type.contains("EDP") || type.contains("IDP") || type.contains("7")) { output->setType(Output::Panel); } else if (type.contains("VGA")) { @@ -177,26 +177,27 @@ } else { qCWarning(KSCREEN_FAKE) << "Output Type not translated:" << type; } - map.remove(QLatin1Literal("type")); + map.remove(QStringLiteral("type")); - if (map.contains("pos")) { - output->setPos(Parser::pointFromJson(map["pos"].toMap())); - map.remove(QLatin1Literal("pos")); + if (map.contains(QStringLiteral("pos"))) { + output->setPos(Parser::pointFromJson(map[QStringLiteral("pos")].toMap())); + map.remove(QStringLiteral("pos")); } - if (map.contains("size")) { - output->setSize(Parser::sizeFromJson(map["size"].toMap())); - map.remove(QLatin1Literal("size")); + if (map.contains(QStringLiteral("size"))) { + output->setSize(Parser::sizeFromJson(map[QStringLiteral("size")].toMap())); + map.remove(QStringLiteral("size")); } - if (map.contains("scale")) { - qDebug() << "Scale found:" << map["scale"].toReal(); - output->setScale(map["scale"].toReal()); - map.remove(QLatin1Literal("scale")); + auto scale = QStringLiteral("scale"); + if (map.contains(scale)) { + qDebug() << "Scale found:" << map[scale].toReal(); + output->setScale(map[scale].toReal()); + map.remove(scale); } //Remove some extra properties that we do not want or need special treatment - map.remove(QLatin1Literal("edid")); + map.remove(QStringLiteral("edid")); Parser::qvariant2qobject(map, output.data()); return output; @@ -208,7 +209,7 @@ ModePtr mode(new Mode); Parser::qvariant2qobject(map, mode.data()); - mode->setSize(Parser::sizeFromJson(map["size"].toMap())); + mode->setSize(Parser::sizeFromJson(map[QStringLiteral("size")].toMap())); return mode; } @@ -218,8 +219,8 @@ const QVariantMap map = data.toMap(); QSize size; - size.setWidth(map["width"].toInt()); - size.setHeight(map["height"].toInt()); + size.setWidth(map[QStringLiteral("width")].toInt()); + size.setHeight(map[QStringLiteral("height")].toInt()); return size; } @@ -229,8 +230,8 @@ const QVariantMap map = data.toMap(); QPoint point; - point.setX(map["x"].toInt()); - point.setY(map["y"].toInt()); + point.setX(map[QStringLiteral("x")].toInt()); + point.setY(map[QStringLiteral("y")].toInt()); return point; } diff --git a/backends/kwayland/waylandoutput.cpp b/backends/kwayland/waylandoutput.cpp --- a/backends/kwayland/waylandoutput.cpp +++ b/backends/kwayland/waylandoutput.cpp @@ -189,7 +189,7 @@ QDebug operator<<(QDebug dbg, const WaylandOutput *output) { dbg << "WaylandOutput(Id:" << output->id() <<", Name:" << \ - QString(output->outputDevice()->manufacturer() + QStringLiteral(" ") + \ + QString(output->outputDevice()->manufacturer() + QLatin1Char(' ') + \ output->outputDevice()->model()) << ")"; return dbg; } diff --git a/backends/qscreen/qscreenbackend.cpp b/backends/qscreen/qscreenbackend.cpp --- a/backends/qscreen/qscreenbackend.cpp +++ b/backends/qscreen/qscreenbackend.cpp @@ -45,12 +45,12 @@ QString QScreenBackend::name() const { - return QString("QScreen"); + return QStringLiteral("QScreen"); } QString QScreenBackend::serviceName() const { - return QLatin1Literal("org.kde.KScreen.Backend.QScreen"); + return QStringLiteral("org.kde.KScreen.Backend.QScreen"); } diff --git a/backends/qscreen/qscreenoutput.cpp b/backends/qscreen/qscreenoutput.cpp --- a/backends/qscreen/qscreenoutput.cpp +++ b/backends/qscreen/qscreenoutput.cpp @@ -101,8 +101,8 @@ mode->setRefreshRate(m_qscreen->refreshRate()); mode->setSize(m_qscreen->size()); - const QString modename = QString::number(m_qscreen->size().width()) + QStringLiteral("x") + QString::number(m_qscreen->size().height()) \ - + QStringLiteral("@") + QString::number(m_qscreen->refreshRate()); + const QString modename = QString::number(m_qscreen->size().width()) + QLatin1String("x") + QString::number(m_qscreen->size().height()) \ + + QLatin1String("@") + QString::number(m_qscreen->refreshRate()); mode->setName(modename); ModeList modes; diff --git a/backends/utils.cpp b/backends/utils.cpp --- a/backends/utils.cpp +++ b/backends/utils.cpp @@ -33,35 +33,35 @@ } } - if (type.contains("VGA")) { + if (type.contains(QLatin1String("VGA"))) { return KScreen::Output::VGA; - } else if (type.contains("DVI")) { + } else if (type.contains(QLatin1String("DVI"))) { return KScreen::Output::DVI; - } else if (type.contains("DVI-I")) { + } else if (type.contains(QLatin1String("DVI-I"))) { return KScreen::Output::DVII; - } else if (type.contains("DVI-A")) { + } else if (type.contains(QLatin1String("DVI-A"))) { return KScreen::Output::DVIA; - } else if (type.contains("DVI-D")) { + } else if (type.contains(QLatin1String("DVI-D"))) { return KScreen::Output::DVID; - } else if (type.contains("HDMI")) { + } else if (type.contains(QLatin1String("HDMI"))) { return KScreen::Output::HDMI; - } else if (type.contains("Panel")) { + } else if (type.contains(QLatin1String("Panel"))) { return KScreen::Output::Panel; - } else if (type.contains("TV-Composite")) { + } else if (type.contains(QLatin1String("TV-Composite"))) { return KScreen::Output::TVComposite; - } else if (type.contains("TV-SVideo")) { + } else if (type.contains(QLatin1String("TV-SVideo"))) { return KScreen::Output::TVSVideo; - } else if (type.contains("TV-Component")) { + } else if (type.contains(QLatin1String("TV-Component"))) { return KScreen::Output::TVComponent; - } else if (type.contains("TV-SCART")) { + } else if (type.contains(QLatin1String("TV-SCART"))) { return KScreen::Output::TVSCART; - } else if (type.contains("TV-C4")) { + } else if (type.contains(QLatin1String("TV-C4"))) { return KScreen::Output::TVC4; - } else if (type.contains("TV")) { + } else if (type.contains(QLatin1String("TV"))) { return KScreen::Output::TV; - } else if (type.contains("DisplayPort") || type.startsWith("DP")) { + } else if (type.contains(QLatin1String("DisplayPort")) || type.startsWith(QLatin1String("DP"))) { return KScreen::Output::DisplayPort; - } else if (type.contains("unknown")) { + } else if (type.contains(QLatin1String("unknown"))) { return KScreen::Output::Unknown; } else { return KScreen::Output::Unknown; diff --git a/backends/xcbeventlistener.cpp b/backends/xcbeventlistener.cpp --- a/backends/xcbeventlistener.cpp +++ b/backends/xcbeventlistener.cpp @@ -96,34 +96,34 @@ { switch (rotation) { case XCB_RANDR_ROTATION_ROTATE_0: - return "Rotate_0"; + return QStringLiteral("Rotate_0"); case XCB_RANDR_ROTATION_ROTATE_90: - return "Rotate_90"; + return QStringLiteral("Rotate_90"); case XCB_RANDR_ROTATION_ROTATE_180: - return "Rotate_180"; + return QStringLiteral("Rotate_180"); case XCB_RANDR_ROTATION_ROTATE_270: - return "Rotate_270"; + return QStringLiteral("Rotate_270"); case XCB_RANDR_ROTATION_REFLECT_X: - return "Reflect_X"; + return QStringLiteral("Reflect_X"); case XCB_RANDR_ROTATION_REFLECT_Y: - return "REflect_Y"; + return QStringLiteral("REflect_Y"); } - return QString("invalid value (%1)").arg(rotation); + return QStringLiteral("invalid value (%1)").arg(rotation); } QString XCBEventListener::connectionToString(xcb_randr_connection_t connection) { switch (connection) { case XCB_RANDR_CONNECTION_CONNECTED: - return "Connected"; + return QStringLiteral("Connected"); case XCB_RANDR_CONNECTION_DISCONNECTED: - return "Disconnected"; + return QStringLiteral("Disconnected"); case XCB_RANDR_CONNECTION_UNKNOWN: - return "UnknownConnection"; + return QStringLiteral("UnknownConnection"); } - return QString("invalid value (%1)").arg(connection); + return QStringLiteral("invalid value (%1)").arg(connection); } bool XCBEventListener::nativeEventFilter(const QByteArray& eventType, void* message, long int* result) diff --git a/backends/xrandr/xrandroutput.cpp b/backends/xrandr/xrandroutput.cpp --- a/backends/xrandr/xrandroutput.cpp +++ b/backends/xrandr/xrandroutput.cpp @@ -247,9 +247,9 @@ KScreen::Output::Type XRandROutput::fetchOutputType(xcb_randr_output_t outputId, const QString &name) { - QByteArray type = typeFromProperty(outputId); + QString type = QString::fromUtf8(typeFromProperty(outputId)); if (type.isEmpty()) { - type = name.toLocal8Bit(); + type = name; } return Utils::guessOutputType(type, name); diff --git a/backends/xrandr1.1/xrandr11.cpp b/backends/xrandr1.1/xrandr11.cpp --- a/backends/xrandr1.1/xrandr11.cpp +++ b/backends/xrandr1.1/xrandr11.cpp @@ -171,7 +171,7 @@ const XCB::ScreenInfo info(xcbScreen->root); xcb_generic_error_t *err; - const int sizeId = mode->id().split("-").first().toInt(); + const int sizeId = mode->id().split(QLatin1Char('-')).first().toInt(); auto cookie = xcb_randr_set_screen_config(XCB::connection(), xcbScreen->root, XCB_CURRENT_TIME, info->config_timestamp, sizeId, (short) output->rotation(), mode->refreshRate()); diff --git a/src/backendmanager.cpp b/src/backendmanager.cpp --- a/src/backendmanager.cpp +++ b/src/backendmanager.cpp @@ -145,7 +145,7 @@ * */ QString backendFilter; - const auto env_kscreen_backend = qgetenv("KSCREEN_BACKEND"); + const auto env_kscreen_backend = QString::fromUtf8(qgetenv("KSCREEN_BACKEND")); if (!backend.isEmpty()) { backendFilter = backend; } else if (!env_kscreen_backend.isEmpty()) { @@ -234,10 +234,11 @@ if (mLoader == nullptr) { mLoader = new QPluginLoader(this); } + auto test_data_equals = QStringLiteral("TEST_DATA="); QVariantMap arguments; auto beargs = QString::fromLocal8Bit(qgetenv("KSCREEN_BACKEND_ARGS")); - if (beargs.startsWith("TEST_DATA=")) { - arguments["TEST_DATA"] = beargs.remove("TEST_DATA="); + if (beargs.startsWith(test_data_equals)) { + arguments[QStringLiteral("TEST_DATA")] = beargs.remove(test_data_equals); } auto backend = BackendManager::loadBackendPlugin(mLoader, name, arguments); //qCDebug(KSCREEN) << "Connecting ConfigMonitor to backend."; @@ -271,7 +272,7 @@ if (pos == -1) { continue; } - arguments.insert(arg.left(pos), arg.mid(pos + 1)); + arguments.insert(QString::fromUtf8(arg.left(pos)), arg.mid(pos + 1)); } } diff --git a/src/configoperation.cpp b/src/configoperation.cpp --- a/src/configoperation.cpp +++ b/src/configoperation.cpp @@ -134,7 +134,7 @@ { Q_ASSERT(BackendManager::instance()->method() == BackendManager::InProcess); Q_Q(ConfigOperation); - const QString &name = qgetenv("KSCREEN_BACKEND").constData(); + const QString &name = QString::fromUtf8(qgetenv("KSCREEN_BACKEND")); auto backend = KScreen::BackendManager::instance()->loadBackendInProcess(name); if (backend == nullptr) { const QString &e = QStringLiteral("Plugin does not provide valid KScreen backend"); diff --git a/src/doctor/doctor.cpp b/src/doctor/doctor.cpp --- a/src/doctor/doctor.cpp +++ b/src/doctor/doctor.cpp @@ -79,19 +79,19 @@ void Doctor::start(QCommandLineParser *parser) { m_parser = parser; - if (m_parser->isSet("info")) { + if (m_parser->isSet(QStringLiteral("info"))) { showBackends(); } - if (parser->isSet("json") || parser->isSet("outputs") || !m_positionalArgs.isEmpty()) { + if (parser->isSet(QStringLiteral("json")) || parser->isSet(QStringLiteral("outputs")) || !m_positionalArgs.isEmpty()) { KScreen::GetConfigOperation *op = new KScreen::GetConfigOperation(); connect(op, &KScreen::GetConfigOperation::finished, this, [this](KScreen::ConfigOperation *op) { configReceived(op); }); return; } - if (m_parser->isSet("dpms")) { + if (m_parser->isSet(QStringLiteral("dpms"))) { if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland"))) { cerr << "DPMS is only supported on Wayland." << endl; // We need to kick the event loop, otherwise .quit() hangs @@ -111,7 +111,7 @@ return; } - if (m_parser->isSet("log")) { + if (m_parser->isSet(QStringLiteral("log"))) { const QString logmsg = m_parser->value(QStringLiteral("log")); if (!Log::instance()->enabled()) { @@ -156,14 +156,14 @@ void Doctor::showBackends() const { cout << "Environment: " << endl; - auto env_kscreen_backend = (qgetenv("KSCREEN_BACKEND").isEmpty()) ? QStringLiteral("[not set]") : qgetenv("KSCREEN_BACKEND"); + auto env_kscreen_backend = (qgetenv("KSCREEN_BACKEND").isEmpty()) ? QStringLiteral("[not set]") : QString::fromUtf8(qgetenv("KSCREEN_BACKEND")); cout << " * KSCREEN_BACKEND : " << env_kscreen_backend << endl; - auto env_kscreen_backend_inprocess = (qgetenv("KSCREEN_BACKEND_INPROCESS").isEmpty()) ? QStringLiteral("[not set]") : qgetenv("KSCREEN_BACKEND_INPROCESS"); + auto env_kscreen_backend_inprocess = (qgetenv("KSCREEN_BACKEND_INPROCESS").isEmpty()) ? QStringLiteral("[not set]") : QString::fromUtf8(qgetenv("KSCREEN_BACKEND_INPROCESS")); cout << " * KSCREEN_BACKEND_INPROCESS : " << env_kscreen_backend_inprocess << endl; - auto env_kscreen_logging = (qgetenv("KSCREEN_LOGGING").isEmpty()) ? QStringLiteral("[not set]") : qgetenv("KSCREEN_LOGGING"); + auto env_kscreen_logging = (qgetenv("KSCREEN_LOGGING").isEmpty()) ? QStringLiteral("[not set]") : QString::fromUtf8(qgetenv("KSCREEN_LOGGING")); cout << " * KSCREEN_LOGGING : " << env_kscreen_logging << endl; - cout << "Logging to : " << (Log::instance()->enabled() ? Log::instance()->logFile() : "[logging disabled]") << endl; + cout << "Logging to : " << (Log::instance()->enabled() ? Log::instance()->logFile() : QStringLiteral("[logging disabled]")) << endl; auto backends = BackendManager::instance()->listBackends(); auto preferred = BackendManager::instance()->preferredBackend(); cout << "Preferred KScreen backend : " << green << preferred.fileName() << cr << endl; @@ -187,7 +187,7 @@ { //qCDebug(KSCREEN_DOCTOR) << "POSARGS" << m_positionalArgs; Q_FOREACH(const QString &op, m_positionalArgs) { - auto ops = op.split('.'); + auto ops = op.split(QLatin1Char('.')); if (ops.count() > 2) { bool ok; int output_id = -1; @@ -225,7 +225,7 @@ qCDebug(KSCREEN_DOCTOR) << "Output" << output_id << "set mode" << mode_id; } else if (ops.count() == 4 && ops[2] == QStringLiteral("position")) { - QStringList _pos = ops[3].split(','); + QStringList _pos = ops[3].split(QLatin1Char(',')); if (_pos.count() != 2) { qCWarning(KSCREEN_DOCTOR) << "Invalid position:" << ops[3]; qApp->exit(5); @@ -247,9 +247,9 @@ } } else if ((ops.count() == 4 || ops.count() == 5) && ops[2] == QStringLiteral("scale")) { // be lenient about . vs. comma as separator - qreal scale = ops[3].replace(QStringLiteral(","), QStringLiteral(".")).toDouble(&ok); + qreal scale = ops[3].replace(QLatin1Char(','), QLatin1Char('.')).toDouble(&ok); if (ops.count() == 5) { - const auto dbl = ops[3] + QStringLiteral(".") + ops[4]; + const QString dbl = ops[3] + QLatin1String(".") + ops[4]; scale = dbl.toDouble(&ok); }; // set scale @@ -293,11 +293,11 @@ { m_config = op->config(); - if (m_parser->isSet("json")) { + if (m_parser->isSet(QStringLiteral("json"))) { showJson(); qApp->quit(); } - if (m_parser->isSet("outputs")) { + if (m_parser->isSet(QStringLiteral("outputs"))) { showOutputs(); qApp->quit(); } @@ -345,21 +345,21 @@ Q_FOREACH (const auto &output, m_config->outputs()) { cout << green << "Output: " << cr << output->id() << " " << output->name(); - cout << " " << (output->isEnabled() ? green + "enabled" : red + "disabled"); - cout << " " << (output->isConnected() ? green + "connected" : red + "disconnected"); - cout << " " << (output->isPrimary() ? green + "primary" : QString()); + cout << " " << (output->isEnabled() ? green + QLatin1String("enabled") : red + QLatin1String("disabled")); + cout << " " << (output->isConnected() ? green + QLatin1String("connected") : red + QLatin1String("disconnected")); + cout << " " << (output->isPrimary() ? green + QLatin1String("primary") : QString()); auto _type = typeString[output->type()]; - cout << " " << yellow << (_type.isEmpty() ? "UnmappedOutputType" : _type); + cout << " " << yellow << (_type.isEmpty() ? QStringLiteral("UnmappedOutputType") : _type); cout << blue << " Modes: " << cr; Q_FOREACH (auto mode, output->modes()) { - auto name = QString("%1x%2@%3").arg(QString::number(mode->size().width()), + auto name = QStringLiteral("%1x%2@%3").arg(QString::number(mode->size().width()), QString::number(mode->size().height()), QString::number(qRound(mode->refreshRate()))); if (mode == output->currentMode()) { - name = green + name + "*" + cr; + name = green + name + QLatin1Char('*') + cr; } if (mode == output->preferredMode()) { - name = name + "!"; + name = name + QLatin1Char('!'); } cout << mode->id() << ":" << name << " "; } @@ -430,7 +430,7 @@ if (output->id() == id) { // find mode Q_FOREACH (const KScreen::ModePtr mode, output->modes()) { - auto name = QString("%1x%2@%3").arg(QString::number(mode->size().width()), + auto name = QStringLiteral("%1x%2@%3").arg(QString::number(mode->size().width()), QString::number(mode->size().height()), QString::number(qRound(mode->refreshRate()))); if (mode->id() == mode_id || name == mode_id) { diff --git a/src/doctor/main.cpp b/src/doctor/main.cpp --- a/src/doctor/main.cpp +++ b/src/doctor/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) { - const QString desc = "kscreen-doctor allows to change the screen setup from the command-line.\n" + const QString desc = QStringLiteral("kscreen-doctor allows to change the screen setup from the command-line.\n" "\n" "Setting the output configuration is done in an atomic fashion, all settings\n" "are applied in a single command.\n" @@ -61,7 +61,7 @@ "\n Set scale (note: fractional scaling is only supported on wayland)\n" " $ kscreen-doctor output.HDMI-2.scale.2 \n" "\n Set rotation (possible values: none, left, right, inverted)\n" - " $ kscreen-doctor output.HDMI-2.rotation.left \n"; + " $ kscreen-doctor output.HDMI-2.rotation.left \n"); /* "\nError codes:\n" " 2 : general parse error\n" @@ -72,32 +72,32 @@ " 8 : invalid output id\n" " 9 : invalid mode id\n"; */ - const QString syntax = "Specific output settings are separated by spaces, each setting is in the form of\n" + const QString syntax = QStringLiteral("Specific output settings are separated by spaces, each setting is in the form of\n" "output..[.]\n" "For example:\n" "$ kscreen-doctor output.HDMI-2.enable \\ \n" " output.eDP-1.mode.4 \\ \n" " output.eDP-1.position.1280,0\n" - "Multiple settings are passed in order to have kscreen-doctor apply these settings in one go.\n"; + "Multiple settings are passed in order to have kscreen-doctor apply these settings in one go.\n"); QGuiApplication app(argc, argv); KScreen::Doctor server; - QCommandLineOption info = QCommandLineOption(QStringList() << QStringLiteral("i") << "info", + QCommandLineOption info = QCommandLineOption(QStringList() << QStringLiteral("i") << QStringLiteral("info"), QStringLiteral("Show runtime information: backends, logging, etc.")); - QCommandLineOption outputs = QCommandLineOption(QStringList() << QStringLiteral("o") << "outputs", + QCommandLineOption outputs = QCommandLineOption(QStringList() << QStringLiteral("o") << QStringLiteral("outputs"), QStringLiteral("Show outputs")); - QCommandLineOption json = QCommandLineOption(QStringList() << QStringLiteral("j") << "json", + QCommandLineOption json = QCommandLineOption(QStringList() << QStringLiteral("j") << QStringLiteral("json"), QStringLiteral("Show configuration in JSON format")); - QCommandLineOption dpms = QCommandLineOption(QStringList() << QStringLiteral("d") << "dpms", + QCommandLineOption dpms = QCommandLineOption(QStringList() << QStringLiteral("d") << QStringLiteral("dpms"), QStringLiteral("Display power management (wayland only)"), QStringLiteral("off")); - QCommandLineOption log = QCommandLineOption(QStringList() << QStringLiteral("l") << "log", + QCommandLineOption log = QCommandLineOption(QStringList() << QStringLiteral("l") << QStringLiteral("log"), QStringLiteral("Write a comment to the log file"), QStringLiteral("comment")); QCommandLineParser parser; parser.setApplicationDescription(desc); - parser.addPositionalArgument("config", syntax, QStringLiteral("[output.. output..setting [...]]")); + parser.addPositionalArgument(QStringLiteral("config"), syntax, QStringLiteral("[output.. output..setting [...]]")); parser.addHelpOption(); parser.addOption(info); parser.addOption(json); diff --git a/src/edid.cpp b/src/edid.cpp --- a/src/edid.cpp +++ b/src/edid.cpp @@ -270,10 +270,10 @@ // load the PNP_IDS file and load the vendor name if (!pnpId.isEmpty()) { - QFile pnpIds(PNP_IDS); + QFile pnpIds(QStringLiteral(PNP_IDS)); if (pnpIds.open(QIODevice::ReadOnly)) { while (!pnpIds.atEnd()) { - QString line = pnpIds.readLine(); + QString line = QString::fromUtf8(pnpIds.readLine()); if (line.startsWith(pnpId)) { QStringList parts = line.split(QLatin1Char('\t')); if (parts.size() == 2) { @@ -374,7 +374,7 @@ // calculate checksum QCryptographicHash hash(QCryptographicHash::Md5); hash.addData(reinterpret_cast(data), length); - checksum = hash.result().toHex(); + checksum = QString::fromLatin1(hash.result().toHex()); valid = true; return valid; diff --git a/src/log.cpp b/src/log.cpp --- a/src/log.cpp +++ b/src/log.cpp @@ -31,9 +31,9 @@ void kscreenLogOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { - QByteArray localMsg = msg.toLocal8Bit(); - if (QString::fromLocal8Bit(context.category).startsWith(QLatin1String("kscreen"))) { - Log::log(localMsg.constData(), context.category); + auto category = QString::fromLocal8Bit(context.category); + if (category.startsWith(QLatin1String("kscreen"))) { + Log::log(msg, category); } sDefaultMessageHandler(type, context, msg); } @@ -67,17 +67,17 @@ const char* logging_env = "KSCREEN_LOGGING"; if (qEnvironmentVariableIsSet(logging_env)) { - const QString logging_env_value = qgetenv(logging_env).constData(); - if (logging_env_value != QStringLiteral("0") && logging_env_value.toLower() != QStringLiteral("false")) { + const QString logging_env_value = QString::fromUtf8(qgetenv(logging_env)); + if (logging_env_value != QLatin1Char('0') && logging_env_value.toLower() != QStringLiteral("false")) { d->enabled = true; } } if (!d->enabled) { return; } - d->logFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kscreen/kscreen.log"; + d->logFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kscreen/kscreen.log"); - QLoggingCategory::setFilterRules("kscreen.*=true"); + QLoggingCategory::setFilterRules(QStringLiteral("kscreen.*=true")); QFileInfo fi(d->logFile); if (!QDir().mkpath(fi.absolutePath())) { qWarning() << "Failed to create logging dir" << fi.absolutePath(); @@ -125,9 +125,9 @@ return; } auto _cat = category; - _cat.remove("kscreen."); - const QString timestamp = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss.zzz"); - QString logMessage = QString("\n%1 ; %2 ; %3 : %4").arg(timestamp, _cat, instance()->context(), msg); + _cat.remove(QStringLiteral("kscreen.")); + const QString timestamp = QDateTime::currentDateTime().toString(QStringLiteral("dd.MM.yyyy hh:mm:ss.zzz")); + QString logMessage = QStringLiteral("\n%1 ; %2 ; %3 : %4").arg(timestamp, _cat, instance()->context(), msg); QFile file(instance()->logFile()); if (!file.open(QIODevice::Append | QIODevice::Text)) { return; diff --git a/src/output.cpp b/src/output.cpp --- a/src/output.cpp +++ b/src/output.cpp @@ -142,7 +142,7 @@ } if (!biggest) { - return nullptr; + return QString(); } return biggest->id(); diff --git a/tests/kwayland/main.cpp b/tests/kwayland/main.cpp --- a/tests/kwayland/main.cpp +++ b/tests/kwayland/main.cpp @@ -27,17 +27,17 @@ KScreen::WaylandTestServer server; - QCommandLineOption config = QCommandLineOption(QStringList() << QStringLiteral("c") << "config", - QStringLiteral("Config file"), "config"); + QCommandLineOption config = QCommandLineOption(QStringList() << QStringLiteral("c") << QLatin1String("config"), + QStringLiteral("Config file"), QLatin1String("config")); QCommandLineParser parser; parser.addHelpOption(); parser.addOption(config); parser.process(app); if (parser.isSet(config)) { server.setConfig(parser.value(config)); } else { - server.setConfig(QString::fromLocal8Bit(TEST_DATA)+"/multipleoutput.json"); + server.setConfig(QString::fromLocal8Bit(TEST_DATA) + QLatin1String("/multipleoutput.json")); } server.start(); return app.exec(); diff --git a/tests/kwayland/waylandconfigreader.cpp b/tests/kwayland/waylandconfigreader.cpp --- a/tests/kwayland/waylandconfigreader.cpp +++ b/tests/kwayland/waylandconfigreader.cpp @@ -42,10 +42,10 @@ QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll()); QJsonObject json = jsonDoc.object(); - QJsonArray omap = json["outputs"].toArray(); + QJsonArray omap = json[QStringLiteral("outputs")].toArray(); Q_FOREACH(const QJsonValue &value, omap) { const QVariantMap &output = value.toObject().toVariantMap(); - if (output["connected"].toBool()) { + if (output[QStringLiteral("connected")].toBool()) { outputs << createOutputDevice(output, display); //qDebug() << "new Output created: " << output["name"].toString(); } else { @@ -60,7 +60,7 @@ { KWayland::Server::OutputDeviceInterface *outputdevice = display->createOutputDevice(display); - QByteArray data = QByteArray::fromBase64(outputConfig["edid"].toByteArray()); + QByteArray data = QByteArray::fromBase64(outputConfig[QStringLiteral("edid")].toByteArray()); outputdevice->setEdid(data); Edid edid(data, display); @@ -83,12 +83,12 @@ outputdevice->setManufacturer(edid.vendor()); outputdevice->setModel(edid.name()); } else { - outputdevice->setPhysicalSize(sizeFromJson(outputConfig["sizeMM"])); - outputdevice->setManufacturer(outputConfig["manufacturer"].toString()); - outputdevice->setModel(outputConfig["model"].toString()); + outputdevice->setPhysicalSize(sizeFromJson(outputConfig[QStringLiteral("sizeMM")])); + outputdevice->setManufacturer(outputConfig[QStringLiteral("manufacturer")].toString()); + outputdevice->setModel(outputConfig[QStringLiteral("model")].toString()); } auto uuid = QUuid::createUuid().toByteArray(); - auto _id = outputConfig["id"].toInt(); + auto _id = outputConfig[QStringLiteral("id")].toInt(); if (_id) { uuid = QString::number(_id).toLocal8Bit(); } @@ -102,22 +102,22 @@ {4, KWayland::Server::OutputDeviceInterface::Transform::Rotated90} }; - outputdevice->setTransform(transformMap[outputConfig["rotation"].toInt()]); - int currentModeId = outputConfig["currentModeId"].toInt(); - QVariantList preferredModes = outputConfig["preferredModes"].toList(); + outputdevice->setTransform(transformMap[outputConfig[QStringLiteral("rotation")].toInt()]); + int currentModeId = outputConfig[QStringLiteral("currentModeId")].toInt(); + QVariantList preferredModes = outputConfig[QStringLiteral("preferredModes")].toList(); int mode_id = 0; - Q_FOREACH (const QVariant &_mode, outputConfig["modes"].toList()) { + Q_FOREACH (const QVariant &_mode, outputConfig[QStringLiteral("modes")].toList()) { mode_id++; const QVariantMap &mode = _mode.toMap(); OutputDeviceInterface::Mode m0; - const QSize _size = sizeFromJson(mode["size"]); + const QSize _size = sizeFromJson(mode[QStringLiteral("size")]); - if (mode.keys().contains("refreshRate")) { - m0.refreshRate = qRound(mode["refreshRate"].toReal() * 1000); // config has it in Hz + if (mode.keys().contains(QStringLiteral("refreshRate"))) { + m0.refreshRate = qRound(mode[QStringLiteral("refreshRate")].toReal() * 1000); // config has it in Hz } - bool isCurrent = currentModeId == mode["id"].toInt(); - bool isPreferred = preferredModes.contains(mode["id"]); + bool isCurrent = currentModeId == mode[QStringLiteral("id")].toInt(); + bool isPreferred = preferredModes.contains(mode[QStringLiteral("id")]); OutputDeviceInterface::ModeFlags flags; if (isCurrent && isPreferred) { @@ -128,8 +128,8 @@ flags = OutputDeviceInterface::ModeFlags(OutputDeviceInterface::ModeFlag::Preferred); } - if (mode.keys().contains("id")) { - m0.id = mode["id"].toInt(); + if (mode.keys().contains(QLatin1String("id"))) { + m0.id = mode[QStringLiteral("id")].toInt(); } else { m0.id = mode_id; } @@ -142,8 +142,8 @@ } } - outputdevice->setGlobalPosition(pointFromJson(outputConfig["pos"])); - outputdevice->setEnabled(outputConfig["enabled"].toBool() ? OutputDeviceInterface::Enablement::Enabled : OutputDeviceInterface::Enablement::Disabled); + outputdevice->setGlobalPosition(pointFromJson(outputConfig[QStringLiteral("pos")])); + outputdevice->setEnabled(outputConfig[QStringLiteral("enabled")].toBool() ? OutputDeviceInterface::Enablement::Enabled : OutputDeviceInterface::Enablement::Disabled); outputdevice->create(); return outputdevice; @@ -225,8 +225,8 @@ QVariantMap map = data.toMap(); QSize size; - size.setWidth(map["width"].toInt()); - size.setHeight(map["height"].toInt()); + size.setWidth(map[QStringLiteral("width")].toInt()); + size.setHeight(map[QStringLiteral("height")].toInt()); return size; } @@ -236,8 +236,8 @@ QVariantMap map = data.toMap(); QPoint point; - point.setX(map["x"].toInt()); - point.setY(map["y"].toInt()); + point.setX(map[QStringLiteral("x")].toInt()); + point.setY(map[QStringLiteral("y")].toInt()); return point; } diff --git a/tests/kwayland/waylandtestserver.cpp b/tests/kwayland/waylandtestserver.cpp --- a/tests/kwayland/waylandtestserver.cpp +++ b/tests/kwayland/waylandtestserver.cpp @@ -36,7 +36,7 @@ WaylandTestServer::WaylandTestServer(QObject *parent) : QObject(parent) - , m_configFile(TEST_DATA + QStringLiteral("default.json")) + , m_configFile(QLatin1String(TEST_DATA) + QLatin1String("default.json")) , m_display(nullptr) , m_outputManagement(nullptr) , m_dpmsManager(nullptr) @@ -59,7 +59,7 @@ if (qgetenv("WAYLAND_DISPLAY").isEmpty()) { m_display->setSocketName(s_socketName); } else { - m_display->setSocketName(qgetenv("WAYLAND_DISPLAY").constData()); + m_display->setSocketName(QString::fromLatin1(qgetenv("WAYLAND_DISPLAY"))); } m_display->start(); @@ -71,8 +71,8 @@ connect(m_outputManagement, &OutputManagementInterface::configurationChangeRequested, this, &WaylandTestServer::configurationChangeRequested); KScreen::WaylandConfigReader::outputsFromConfig(m_configFile, m_display, m_outputs); - qCDebug(KSCREEN_WAYLAND_TESTSERVER) << QString("export WAYLAND_DISPLAY="+m_display->socketName()); - qCDebug(KSCREEN_WAYLAND_TESTSERVER) << QString("You can specify the WAYLAND_DISPLAY for this server by exporting it in the environment"); + qCDebug(KSCREEN_WAYLAND_TESTSERVER) << QStringLiteral("export WAYLAND_DISPLAY=") + m_display->socketName(); + qCDebug(KSCREEN_WAYLAND_TESTSERVER) << QStringLiteral("You can specify the WAYLAND_DISPLAY for this server by exporting it in the environment"); //showOutputs(); } @@ -168,7 +168,7 @@ bool enabled = (o->enabled() == KWayland::Server::OutputDeviceInterface::Enablement::Enabled); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " * Output id: " << o->uuid(); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Enabled: " << (enabled ? "enabled" : "disabled"); - qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Name: " << QString("%2-%3").arg(o->manufacturer(), o->model()); + qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Name: " << QStringLiteral("%2-%3").arg(o->manufacturer(), o->model()); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Mode: " << modeString(o, o->currentModeId()); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Pos: " << o->globalPosition(); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Edid: " << o->edid(); @@ -186,15 +186,15 @@ Q_FOREACH (const auto &_m, outputdevice->modes()) { _i++; if (_i < 6) { - ids.append(QString::number(_m.id) + ", "); + ids.append(QString::number(_m.id) + QLatin1String(", ")); } else { - ids.append("."); + ids.append(QLatin1Char('.')); } if (_m.id == mid) { - s = QString("%1x%2 @%3").arg(QString::number(_m.size.width()), \ + s = QStringLiteral("%1x%2 @%3").arg(QString::number(_m.size.width()), \ QString::number(_m.size.height()), QString::number(_m.refreshRate)); } } - return QString("[%1] %2 (%4 modes: %3)").arg(QString::number(mid), s, ids, QString::number(outputdevice->modes().count())); + return QStringLiteral("[%1] %2 (%4 modes: %3)").arg(QString::number(mid), s, ids, QString::number(outputdevice->modes().count())); } diff --git a/tests/testplugandplay.cpp b/tests/testplugandplay.cpp --- a/tests/testplugandplay.cpp +++ b/tests/testplugandplay.cpp @@ -27,7 +27,7 @@ { QGuiApplication app(argc, argv); - QCommandLineOption input = QCommandLineOption(QStringList() << QStringLiteral("m") << "monitor", + QCommandLineOption input = QCommandLineOption(QStringList() << QStringLiteral("m") << QStringLiteral("monitor"), QStringLiteral("Keep running monitoring for changes")); QCommandLineParser parser; parser.addHelpOption();