-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
This commit is contained in:
Nick Shaforostoff 2015-11-06 13:39:18 +00:00
parent f32677b8e0
commit db7f198a19
3 changed files with 6 additions and 5 deletions

View File

@ -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);

View File

@ -815,7 +815,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
apiMinor = 0;
apiRevision = 0;
if (!apiVersion.isEmpty()) {
QStringList parts = apiVersion.split('.');
QVector<QStringRef> parts = apiVersion.splitRef('.');
if (!parts.isEmpty()) {
apiMajor = parts.value(0).toInt();
}

View File

@ -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<KPluginMetaData> plugins = KPluginLoader::findPlugins("plasma/scriptengines", filter);
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"), filter);
if (plugins.isEmpty()) {
return -1;
}