From 017da144442f8270abfd6e450b8b40c788ccb424 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sun, 2 Apr 2023 07:42:00 +0200 Subject: [PATCH] plugins/kpackage: Modernize code using initializer list syntax --- src/plugins/kpackage/aurorae/aurorae.cpp | 14 +------------- src/plugins/kpackage/decoration/decoration.cpp | 8 ++------ src/plugins/kpackage/effect/effect.cpp | 6 +++--- src/plugins/kpackage/scripts/scripts.cpp | 8 ++------ .../kpackage/windowswitcher/windowswitcher.cpp | 8 ++------ 5 files changed, 10 insertions(+), 34 deletions(-) diff --git a/src/plugins/kpackage/aurorae/aurorae.cpp b/src/plugins/kpackage/aurorae/aurorae.cpp index 2ce0b9090d..209e75d4f3 100644 --- a/src/plugins/kpackage/aurorae/aurorae.cpp +++ b/src/plugins/kpackage/aurorae/aurorae.cpp @@ -15,28 +15,16 @@ void AuroraePackage::initPackage(KPackage::Package *package) package->setRequired("decoration", true); package->addFileDefinition("close", QStringLiteral("close.svgz")); - package->addFileDefinition("minimize", QStringLiteral("minimize.svgz")); - package->addFileDefinition("maximize", QStringLiteral("maximize.svgz")); - package->addFileDefinition("restore", QStringLiteral("restore.svgz")); - package->addFileDefinition("alldesktops", QStringLiteral("alldesktops.svgz")); - package->addFileDefinition("keepabove", QStringLiteral("keepabove.svgz")); - package->addFileDefinition("keepbelow", QStringLiteral("keepbelow.svgz")); - package->addFileDefinition("shade", QStringLiteral("shade.svgz")); - package->addFileDefinition("help", QStringLiteral("help.svgz")); - package->addFileDefinition("configrc", QStringLiteral("configrc")); - - QStringList mimetypes; - mimetypes << QStringLiteral("image/svg+xml-compressed"); - package->setDefaultMimeTypes(mimetypes); + package->setDefaultMimeTypes(QStringList{QStringLiteral("image/svg+xml-compressed")}); } void AuroraePackage::pathChanged(KPackage::Package *package) diff --git a/src/plugins/kpackage/decoration/decoration.cpp b/src/plugins/kpackage/decoration/decoration.cpp index 39d8a8d9c7..7d3ddf4062 100644 --- a/src/plugins/kpackage/decoration/decoration.cpp +++ b/src/plugins/kpackage/decoration/decoration.cpp @@ -11,9 +11,7 @@ void DecorationPackage::initPackage(KPackage::Package *package) package->setDefaultPackageRoot(QStringLiteral("kwin/decorations/")); package->addDirectoryDefinition("config", QStringLiteral("config")); - QStringList mimetypes; - mimetypes << QStringLiteral("text/xml"); - package->setMimeTypes("config", mimetypes); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); package->addDirectoryDefinition("ui", QStringLiteral("ui")); @@ -22,9 +20,7 @@ void DecorationPackage::initPackage(KPackage::Package *package) package->addFileDefinition("mainscript", QStringLiteral("code/main.qml")); package->setRequired("mainscript", true); - mimetypes.clear(); - mimetypes << QStringLiteral("text/plain"); - package->setMimeTypes("decoration", mimetypes); + package->setMimeTypes("decoration", QStringList{QStringLiteral("text/plain")}); } void DecorationPackage::pathChanged(KPackage::Package *package) diff --git a/src/plugins/kpackage/effect/effect.cpp b/src/plugins/kpackage/effect/effect.cpp index a8cf3a04c0..797c6a6073 100644 --- a/src/plugins/kpackage/effect/effect.cpp +++ b/src/plugins/kpackage/effect/effect.cpp @@ -16,16 +16,16 @@ void EffectPackageStructure::initPackage(KPackage::Package *package) package->setDefaultPackageRoot(QStringLiteral("kwin/effects/")); package->addDirectoryDefinition("code", QStringLiteral("code")); - package->setMimeTypes("code", {QStringLiteral("text/plain")}); + package->setMimeTypes("code", QStringList{QStringLiteral("text/plain")}); package->addFileDefinition("mainscript", QStringLiteral("code/main.js")); package->setRequired("mainscript", true); package->addFileDefinition("config", QStringLiteral("config/main.xml")); - package->setMimeTypes("config", {QStringLiteral("text/xml")}); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); package->addFileDefinition("configui", QStringLiteral("ui/config.ui")); - package->setMimeTypes("configui", {QStringLiteral("text/xml")}); + package->setMimeTypes("configui", QStringList{QStringLiteral("text/xml")}); } void EffectPackageStructure::pathChanged(KPackage::Package *package) diff --git a/src/plugins/kpackage/scripts/scripts.cpp b/src/plugins/kpackage/scripts/scripts.cpp index 598e00848a..ba6821ee49 100644 --- a/src/plugins/kpackage/scripts/scripts.cpp +++ b/src/plugins/kpackage/scripts/scripts.cpp @@ -11,9 +11,7 @@ void ScriptsPackage::initPackage(KPackage::Package *package) package->setDefaultPackageRoot(QStringLiteral("kwin/scripts/")); package->addDirectoryDefinition("config", QStringLiteral("config")); - QStringList mimetypes; - mimetypes << QStringLiteral("text/xml"); - package->setMimeTypes("config", mimetypes); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); package->addDirectoryDefinition("ui", QStringLiteral("ui")); @@ -22,9 +20,7 @@ void ScriptsPackage::initPackage(KPackage::Package *package) package->addFileDefinition("mainscript", QStringLiteral("code/main.js")); package->setRequired("mainscript", true); - mimetypes.clear(); - mimetypes << QStringLiteral("text/plain"); - package->setMimeTypes("scripts", mimetypes); + package->setMimeTypes("scripts", QStringList{QStringLiteral("text/plain")}); } void ScriptsPackage::pathChanged(KPackage::Package *package) diff --git a/src/plugins/kpackage/windowswitcher/windowswitcher.cpp b/src/plugins/kpackage/windowswitcher/windowswitcher.cpp index 07940029c5..210f0fa4ec 100644 --- a/src/plugins/kpackage/windowswitcher/windowswitcher.cpp +++ b/src/plugins/kpackage/windowswitcher/windowswitcher.cpp @@ -11,9 +11,7 @@ void SwitcherPackage::initPackage(KPackage::Package *package) package->setDefaultPackageRoot(QStringLiteral("kwin/tabbox/")); package->addDirectoryDefinition("config", QStringLiteral("config")); - QStringList mimetypes; - mimetypes << QStringLiteral("text/xml"); - package->setMimeTypes("config", mimetypes); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); package->addDirectoryDefinition("ui", QStringLiteral("ui")); @@ -22,9 +20,7 @@ void SwitcherPackage::initPackage(KPackage::Package *package) package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml")); package->setRequired("mainscript", true); - mimetypes.clear(); - mimetypes << QStringLiteral("text/plain"); - package->setMimeTypes("windowswitcher", mimetypes); + package->setMimeTypes("windowswitcher", QStringList(QStringLiteral("text/plain"))); } void SwitcherPackage::pathChanged(KPackage::Package *package)