From 16adb6a29872301376424c22de005384b447a8b7 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 12 Aug 2023 14:00:53 +0200 Subject: [PATCH] PluginLoader: Improve const corretness, remove unneeded qAsConst Because they are member variables, we do not need qAsConst in a method that is declared as const --- core/pluginloader.cpp | 8 ++++---- core/pluginloader.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/pluginloader.cpp b/core/pluginloader.cpp index 9115bf766..1ff1be45b 100644 --- a/core/pluginloader.cpp +++ b/core/pluginloader.cpp @@ -69,7 +69,7 @@ KdeConnectPlugin *PluginLoader::instantiatePluginForDevice(const QString &plugin QStringList PluginLoader::incomingCapabilities() const { QSet ret; - for (const KPluginMetaData &service : qAsConst(plugins)) { + for (const KPluginMetaData &service : plugins) { QStringList rawValues = service.value(QStringLiteral("X-KdeConnect-SupportedPacketType"), QStringList()); ret += QSet(rawValues.begin(), rawValues.end()); } @@ -79,20 +79,20 @@ QStringList PluginLoader::incomingCapabilities() const QStringList PluginLoader::outgoingCapabilities() const { QSet ret; - for (const KPluginMetaData &service : qAsConst(plugins)) { + for (const KPluginMetaData &service : plugins) { QStringList rawValues = service.value(QStringLiteral("X-KdeConnect-OutgoingPacketType"), QStringList()); ret += QSet(rawValues.begin(), rawValues.end()); } return ret.values(); } -QSet PluginLoader::pluginsForCapabilities(const QSet &incoming, const QSet &outgoing) +QSet PluginLoader::pluginsForCapabilities(const QSet &incoming, const QSet &outgoing) const { QSet ret; QString myDeviceType = KdeConnectConfig::instance().deviceType().toString(); - for (const KPluginMetaData &service : qAsConst(plugins)) { + for (const KPluginMetaData &service : plugins) { // Check if the plugin support this device type const QStringList supportedDeviceTypes = service.rawData().value(QStringLiteral("X-KdeConnect-SupportedDeviceTypes")).toVariant().toStringList(); if (!supportedDeviceTypes.isEmpty()) { diff --git a/core/pluginloader.h b/core/pluginloader.h index b49c79a89..0a9a9fbb9 100644 --- a/core/pluginloader.h +++ b/core/pluginloader.h @@ -31,7 +31,7 @@ public: QStringList incomingCapabilities() const; QStringList outgoingCapabilities() const; - QSet pluginsForCapabilities(const QSet &incoming, const QSet &outgoing); + QSet pluginsForCapabilities(const QSet &incoming, const QSet &outgoing) const; private: PluginLoader();