From db7f198a19c1222e0105e5ac16e2d1b2c2246409 Mon Sep 17 00:00:00 2001 From: Nick Shaforostoff Date: Fri, 6 Nov 2015 13:39:18 +0000 Subject: [PATCH] -use QStringLiteral and QLatin1String in the code that is executed multiple times (avoids utf8->utf16 conversions) -use splitRef when converting parts of qstring to ints to avoid redundant memory allocations -warnings--: remove redundant ';' CCMAIL: notmart@gmail.com --- src/declarativeimports/platformcomponents/application.h | 4 ++-- src/plasma/private/theme_p.cpp | 2 +- src/scriptengines/qml/plasmoid/appletinterface.cpp | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/declarativeimports/platformcomponents/application.h b/src/declarativeimports/platformcomponents/application.h index 8da770371..defd7692d 100644 --- a/src/declarativeimports/platformcomponents/application.h +++ b/src/declarativeimports/platformcomponents/application.h @@ -43,13 +43,13 @@ class Application: public QObject /** * The name or path of the applications */ - Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY applicationChanged); + Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY applicationChanged) /** * Indicates whether the user wants the application to be running or not. * It does not refer to the actual state of the application. */ - Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged); + Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged) public: Application(QObject *parent = Q_NULLPTR); diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index 31a651275..f34634392 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -815,7 +815,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings apiMinor = 0; apiRevision = 0; if (!apiVersion.isEmpty()) { - QStringList parts = apiVersion.split('.'); + QVector parts = apiVersion.splitRef('.'); if (!parts.isEmpty()) { apiMajor = parts.value(0).toInt(); } diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index 6573d9817..60b7fa52b 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -500,9 +500,10 @@ int AppletInterface::apiVersion() const // Look for C++ plugins first auto filter = [](const KPluginMetaData &md) -> bool { - return md.value("X-Plasma-API") == "declarativeappletscript" && md.value("X-Plasma-ComponentTypes").contains("Applet"); + return md.value(QStringLiteral("X-Plasma-API")) == QLatin1String("declarativeappletscript") + && md.value(QStringLiteral("X-Plasma-ComponentTypes")).contains(QLatin1String("Applet")); }; - QVector plugins = KPluginLoader::findPlugins("plasma/scriptengines", filter); + QVector plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"), filter); if (plugins.isEmpty()) { return -1; }