GIT_SILENT: Use QLatin1String in QString::contains etc. Fix replace

usage
This commit is contained in:
Laurent Montel 2019-08-29 07:23:49 +02:00
parent 069b4e95c1
commit f53365633c
16 changed files with 58 additions and 58 deletions

View File

@ -163,7 +163,7 @@ WindowThumbnail::WindowThumbnail(QQuickItem *parent)
setFlag(ItemHasContents);
if (QGuiApplication *gui = dynamic_cast<QGuiApplication *>(QCoreApplication::instance())) {
m_xcb = (gui->platformName() == QStringLiteral("xcb"));
m_xcb = (gui->platformName() == QLatin1String("xcb"));
if (m_xcb) {
gui->installNativeEventFilter(this);
#if HAVE_XCB_COMPOSITE

View File

@ -19,7 +19,7 @@
#include "appbackgroundprovider_p.h"
#include <QLatin1Literal>
#include <QLatin1String>
#include <QPixmap>
#include <QSize>
#include <QStandardPaths>

View File

@ -787,7 +787,7 @@ Applet *Applet::loadPlasmoid(const QString &path, uint appletId)
if (md.isValid()) {
QStringList types = md.serviceTypes();
if (types.contains(QStringLiteral("Plasma/Containment"))) {
if (types.contains(QLatin1String("Plasma/Containment"))) {
return new Containment(md, appletId);
} else {
return new Applet(md, nullptr, appletId);

View File

@ -47,7 +47,7 @@ public:
if (!package->metadata().isValid()) {
return;
}
if (package->metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) {
if (package->metadata().serviceTypes().contains(QLatin1String("Plasma/Containment"))) {
package->addFileDefinition("compactapplet", QStringLiteral("applet/CompactApplet.qml"), i18n("Custom expander for compact applets"));
} else {
package->removeDefinition("compactapplet");

View File

@ -215,7 +215,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
QVariantList allArgs;
allArgs << QVariant::fromValue(p) << p.metadata().fileName() << appletId << args;
if (p.metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) {
if (p.metadata().serviceTypes().contains(QLatin1String("Plasma/Containment"))) {
applet = new Containment(nullptr, allArgs);
} else {
applet = new Applet(nullptr, allArgs);
@ -637,7 +637,7 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type,
KConfigGroup group(KSharedConfig::openConfig(), "General");
auto filter = [&type, &category, &parentApp](const KPluginMetaData &md) -> bool
{
if (!md.serviceTypes().contains(QStringLiteral("Plasma/Containment"))) {
if (!md.serviceTypes().contains(QLatin1String("Plasma/Containment"))) {
return false;
}
if (!parentApp.isEmpty() && md.value(QStringLiteral("X-KDE-ParentApp")) != parentApp) {

View File

@ -136,8 +136,8 @@ Storage::Storage(QObject *parent)
}
}
m_clientName = m_clientName.replace(QLatin1Char('.'), QLatin1Char('_'));
m_clientName = m_clientName.replace(QLatin1Char('-'), QLatin1Char('_'));
m_clientName.replace(QLatin1Char('.'), QLatin1Char('_'));
m_clientName.replace(QLatin1Char('-'), QLatin1Char('_'));
setName(QStringLiteral("storage"));
}

View File

@ -246,11 +246,11 @@ void StorageThread::retrieve(QPointer<StorageJob> wcaller, const QVariantMap &pa
if (success) {
QSqlRecord rec = query.record();
const int keyColumn = rec.indexOf(QStringLiteral("id"));
const int textColumn = rec.indexOf(QStringLiteral("txt"));
const int intColumn = rec.indexOf(QStringLiteral("int"));
const int floatColumn = rec.indexOf(QStringLiteral("float"));
const int binaryColumn = rec.indexOf(QStringLiteral("binary"));
const int keyColumn = rec.indexOf(QLatin1String("id"));
const int textColumn = rec.indexOf(QLatin1String("txt"));
const int intColumn = rec.indexOf(QLatin1String("int"));
const int floatColumn = rec.indexOf(QLatin1String("float"));
const int binaryColumn = rec.indexOf(QLatin1String("binary"));
QVariantMap data;
while (query.next()) {

View File

@ -303,7 +303,7 @@ void ThemePrivate::onAppExitCleanup()
QString ThemePrivate::imagePath(const QString& theme, const QString& type, const QString& image)
{
QString subdir = QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % type % image;
QString subdir = QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % type % image;
return QStandardPaths::locate(QStandardPaths::GenericDataLocation, subdir);
}
@ -699,7 +699,7 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
void ThemePrivate::processWallpaperSettings(KConfigBase *metadata)
{
if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != QStringLiteral(DEFAULT_WALLPAPER_THEME)) {
if (!defaultWallpaperTheme.isEmpty() && defaultWallpaperTheme != QLatin1String(DEFAULT_WALLPAPER_THEME)) {
return;
}
@ -784,7 +784,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
themeName = theme;
// load the color scheme config
const QString colorsFile = realTheme ? QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/colors"))
const QString colorsFile = realTheme ? QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/colors"))
: QString();
//qCDebug(LOG_PLASMA) << "we're going for..." << colorsFile << "*******************";
@ -800,12 +800,12 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
complementaryColorScheme = KColorScheme(QPalette::Active, KColorScheme::Complementary, colors);
const QString wallpaperPath = QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/wallpapers/");
const QString wallpaperPath = QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/wallpapers/");
hasWallpapers = !QStandardPaths::locate(QStandardPaths::GenericDataLocation, wallpaperPath, QStandardPaths::LocateDirectory).isEmpty();
// load the wallpaper settings, if any
if (realTheme) {
const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/metadata.desktop")));
KConfig metadata(metadataPath, KConfig::SimpleConfig);
pluginInfo = KPluginInfo(metadataPath);
@ -821,7 +821,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
while (!fallback.isEmpty() && !fallbackThemes.contains(fallback)) {
fallbackThemes.append(fallback);
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % fallback % QLatin1Literal("/metadata.desktop")));
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % fallback % QLatin1String("/metadata.desktop")));
KConfig metadata(metadataPath, KConfig::SimpleConfig);
KConfigGroup cg(&metadata, "Settings");
fallback = cg.readEntry("FallbackTheme", QString());
@ -832,7 +832,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
}
foreach (const QString &theme, fallbackThemes) {
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/metadata.desktop")));
KConfig metadata(metadataPath, KConfig::SimpleConfig);
processWallpaperSettings(&metadata);
}

View File

@ -41,8 +41,8 @@ static QVector<KPluginMetaData> listEngines(Types::ComponentTypes types, std::fu
if (!filter(plugin))
continue;
const QStringList componentTypes = KPluginMetaData::readStringList(plugins.first().rawData(), QStringLiteral("X-Plasma-ComponentTypes"));
if (((types & Types::AppletComponent) && componentTypes.contains(QStringLiteral("Applet")))
||((types & Types::DataEngineComponent) && componentTypes.contains(QStringLiteral("DataEngine")))) {
if (((types & Types::AppletComponent) && componentTypes.contains(QLatin1String("Applet")))
||((types & Types::DataEngineComponent) && componentTypes.contains(QLatin1String("DataEngine")))) {
ret << plugin;
}
}

View File

@ -186,7 +186,7 @@ bool SvgPrivate::setImagePath(const QString &imagePath)
QString actualPath = imagePath;
if (imagePath.startsWith(QLatin1String("file://"))) {
//length of file://
actualPath = actualPath.mid(7);
actualPath.remove(0, 7);
}
bool isThemed = !actualPath.isEmpty() && !QDir::isAbsolutePath(actualPath);

View File

@ -149,12 +149,12 @@ QString Theme::imagePath(const QString &name) const
return QString();
}
const QString svgzName = name % QLatin1Literal(".svgz");
const QString svgzName = name % QLatin1String(".svgz");
QString path = d->findInTheme(svgzName, d->themeName);
if (path.isEmpty()) {
// try for an uncompressed svg file
const QString svgName = name % QLatin1Literal(".svg");
const QString svgName = name % QLatin1String(".svg");
path = d->findInTheme(svgName, d->themeName);
// search in fallback themes if necessary
@ -215,10 +215,10 @@ QString Theme::wallpaperPath(const QSize &size) const
// to override the theme?
if (d->hasWallpapers) {
// check in the theme first
fullPath = d->findInTheme(QLatin1Literal("wallpapers/") % image, d->themeName);
fullPath = d->findInTheme(QLatin1String("wallpapers/") % image, d->themeName);
if (fullPath.isEmpty()) {
fullPath = d->findInTheme(QLatin1Literal("wallpapers/") % defaultImage, d->themeName);
fullPath = d->findInTheme(QLatin1String("wallpapers/") % defaultImage, d->themeName);
}
}
@ -256,8 +256,8 @@ bool Theme::currentThemeHasImage(const QString &name) const
return false;
}
return !(d->findInTheme(name % QLatin1Literal(".svgz"), d->themeName, false).isEmpty()) ||
!(d->findInTheme(name % QLatin1Literal(".svg"), d->themeName, false).isEmpty());
return !(d->findInTheme(name % QLatin1String(".svgz"), d->themeName, false).isEmpty()) ||
!(d->findInTheme(name % QLatin1String(".svg"), d->themeName, false).isEmpty());
}
KSharedConfigPtr Theme::colorScheme() const
@ -337,7 +337,7 @@ bool Theme::findInRectsCache(const QString &image, const QString &element, QRect
}
KConfigGroup imageGroup(d->svgElementsCache, image);
rect = imageGroup.readEntry(element % QLatin1Literal("Size"), QRectF());
rect = imageGroup.readEntry(element % QLatin1String("Size"), QRectF());
if (rect.isValid()) {
return true;
@ -394,7 +394,7 @@ void Theme::insertIntoRectsCache(const QString &image, const QString &element, c
if (rect.isValid()) {
KConfigGroup imageGroup(d->svgElementsCache, image);
imageGroup.writeEntry(element % QLatin1Literal("Size"), rect);
imageGroup.writeEntry(element % QLatin1String("Size"), rect);
} else {
QHash<QString, QSet<QString> >::iterator it = d->invalidElements.find(image);
if (it == d->invalidElements.end()) {

View File

@ -27,31 +27,31 @@
QString typeFromLegacy(const QString &type)
{
if (type == QStringLiteral("plasmoid")) {
if (type == QLatin1String("plasmoid")) {
return QStringLiteral("Plasma/Applet");
} else if (type == QStringLiteral("package")) {
} else if (type == QLatin1String("package")) {
return QStringLiteral("Plasma/Generic");
} else if (type == QStringLiteral("theme")) {
} else if (type == QLatin1String("theme")) {
return QStringLiteral("Plasma/Theme");
} else if (type == QStringLiteral("wallpaper")) {
} else if (type == QLatin1String("wallpaper")) {
return QStringLiteral("Plasma/ImageWallpaper");
} else if (type == QStringLiteral("dataengine")) {
} else if (type == QLatin1String("dataengine")) {
return QStringLiteral("Plasma/DataEngine");
} else if (type == QStringLiteral("runner")) {
} else if (type == QLatin1String("runner")) {
return QStringLiteral("Plasma/Runner");
} else if (type == QStringLiteral("wallpaperplugin")) {
} else if (type == QLatin1String("wallpaperplugin")) {
return QStringLiteral("Plasma/Wallpaper");
} else if (type == QStringLiteral("lookandfeel")) {
} else if (type == QLatin1String("lookandfeel")) {
return QStringLiteral("Plasma/LookAndFeel");
} else if (type == QStringLiteral("shell")) {
} else if (type == QLatin1String("shell")) {
return QStringLiteral("Plasma/Shell");
} else if (type == QStringLiteral("layout-template")) {
} else if (type == QLatin1String("layout-template")) {
return QStringLiteral("Plasma/LayoutTemplate");
} else if (type == QStringLiteral("kwineffect")) {
} else if (type == QLatin1String("kwineffect")) {
return QStringLiteral("KWin/Effect");
} else if (type == QStringLiteral("windowswitcher")) {
} else if (type == QLatin1String("windowswitcher")) {
return QStringLiteral("KWin/WindowSwitcher");
} else if (type == QStringLiteral("kwinscript")) {
} else if (type == QLatin1String("kwinscript")) {
return QStringLiteral("KWin/Script");
} else {
return type;
@ -67,12 +67,12 @@ int main(int argc, char **argv)
//plasmapkg2 had some hardcoded types, kpackagetool5 requires the servicetype passed as the type parameter
//convert between the two
//user passed -t typeName
int typeIndex = params.indexOf(QStringLiteral("-t"));
int typeIndex = params.indexOf(QLatin1String("-t"));
if (typeIndex > -1 && params.length() > typeIndex + 1) {
params[typeIndex + 1] = typeFromLegacy(params.value(typeIndex + 1));
} else {
//user passed --type typeName
typeIndex = params.indexOf(QStringLiteral("--type"));
typeIndex = params.indexOf(QLatin1String("--type"));
if (typeIndex > -1 && params.length() > typeIndex + 1) {
params[typeIndex + 1] = typeFromLegacy(params.value(typeIndex + 1));
} else {

View File

@ -62,9 +62,9 @@ AppletQuickItemPrivate::AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickIte
if (qEnvironmentVariableIsSet("PLASMA_PRELOAD_POLICY")) {
const QString policy = QString::fromUtf8(qgetenv("PLASMA_PRELOAD_POLICY")).toLower();
if (policy == QStringLiteral("aggressive")) {
if (policy == QLatin1String("aggressive")) {
s_preloadPolicy = Aggressive;
} else if (policy == QStringLiteral("none")) {
} else if (policy == QLatin1String("none")) {
s_preloadPolicy = None;
}
}
@ -95,7 +95,7 @@ int AppletQuickItemPrivate::preloadWeight() const
const QStringList provides(KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides")));
//some applet types we want a bigger weight
if (provides.contains(QStringLiteral("org.kde.plasma.launchermenu"))) {
if (provides.contains(QLatin1String("org.kde.plasma.launchermenu"))) {
defaultWeight = DefaultLauncherPreloadWeight;
} else {
defaultWeight = DefaultPreloadWeight;

View File

@ -92,8 +92,8 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
//qDebug() << "Intercepted URL:" << path << type;
//we assume we never rewritten qml/qmldir files
if (path.path().endsWith(QStringLiteral("qml")) || path.path().endsWith(QStringLiteral("qmldir"))
|| path.path().endsWith(QStringLiteral("/inline"))) {
if (path.path().endsWith(QLatin1String("qml")) || path.path().endsWith(QStringLiteral("qmldir"))
|| path.path().endsWith(QLatin1String("/inline"))) {
return path;
}
const QString prefix = QString::fromUtf8(prefixForType(type, path.path()));
@ -104,7 +104,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
QString rewritten = plainPath.replace(match, QStringLiteral("/%1/\\1").arg(prefix));
//search it in a resource or as a file on disk
if (!(rewritten.contains(QStringLiteral("qrc")) &&
if (!(rewritten.contains(QLatin1String("qrc")) &&
QFile::exists(QStringLiteral(":") + QUrl(rewritten).path())) &&
!QFile::exists(QUrl(rewritten).path())) {
return path;

View File

@ -74,14 +74,14 @@ public:
//failed by type, let's try by extension
const QString &extension = fileName.mid(fileName.lastIndexOf(QLatin1Char('.')) + 1).toLower();
if (extension == QStringLiteral("svg") || extension == QStringLiteral("svgz") ||
extension == QStringLiteral("png") || extension == QStringLiteral("gif") ||
extension == QStringLiteral("jpg") || extension == QStringLiteral("jpeg")) {
if (extension == QLatin1String("svg") || extension == QStringLiteral("svgz") ||
extension == QLatin1String("png") || extension == QStringLiteral("gif") ||
extension == QLatin1String("jpg") || extension == QStringLiteral("jpeg")) {
return QByteArray("images");
//FIXME: are those necessary? are they *always* caught by type?
} else if (extension == QStringLiteral("js")) {
} else if (extension == QLatin1String("js")) {
return QByteArray("code");
} else if (extension == QStringLiteral("qml") || extension == QStringLiteral("qmldir")) {
} else if (extension == QLatin1String("qml") || extension == QStringLiteral("qmldir")) {
return QByteArray("ui");
//everything else, throw it in "data"
} else {

View File

@ -915,7 +915,7 @@ QList<QObject *> ContainmentInterface::actions() const
i = 0;
foreach (QAction *a, m_containment->corona()->actions()->actions()) {
if (a->objectName() == QStringLiteral("lock widgets") || a->menu()) {
if (a->objectName() == QLatin1String("lock widgets") || a->menu()) {
//It is up to the Containment to decide if the user is allowed or not
//to lock/unluck the widgets, so corona should not add one when there is none
//(user is not allow) and it shouldn't add another one when there is already