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
This commit is contained in:
Alexander Lohnau 2023-08-12 14:00:53 +02:00 committed by Albert Vaca Cintora
parent b70de1eb21
commit 16adb6a298
2 changed files with 5 additions and 5 deletions

View file

@ -69,7 +69,7 @@ KdeConnectPlugin *PluginLoader::instantiatePluginForDevice(const QString &plugin
QStringList PluginLoader::incomingCapabilities() const QStringList PluginLoader::incomingCapabilities() const
{ {
QSet<QString> ret; QSet<QString> ret;
for (const KPluginMetaData &service : qAsConst(plugins)) { for (const KPluginMetaData &service : plugins) {
QStringList rawValues = service.value(QStringLiteral("X-KdeConnect-SupportedPacketType"), QStringList()); QStringList rawValues = service.value(QStringLiteral("X-KdeConnect-SupportedPacketType"), QStringList());
ret += QSet<QString>(rawValues.begin(), rawValues.end()); ret += QSet<QString>(rawValues.begin(), rawValues.end());
} }
@ -79,20 +79,20 @@ QStringList PluginLoader::incomingCapabilities() const
QStringList PluginLoader::outgoingCapabilities() const QStringList PluginLoader::outgoingCapabilities() const
{ {
QSet<QString> ret; QSet<QString> ret;
for (const KPluginMetaData &service : qAsConst(plugins)) { for (const KPluginMetaData &service : plugins) {
QStringList rawValues = service.value(QStringLiteral("X-KdeConnect-OutgoingPacketType"), QStringList()); QStringList rawValues = service.value(QStringLiteral("X-KdeConnect-OutgoingPacketType"), QStringList());
ret += QSet<QString>(rawValues.begin(), rawValues.end()); ret += QSet<QString>(rawValues.begin(), rawValues.end());
} }
return ret.values(); return ret.values();
} }
QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString> &incoming, const QSet<QString> &outgoing) QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString> &incoming, const QSet<QString> &outgoing) const
{ {
QSet<QString> ret; QSet<QString> ret;
QString myDeviceType = KdeConnectConfig::instance().deviceType().toString(); 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 // Check if the plugin support this device type
const QStringList supportedDeviceTypes = service.rawData().value(QStringLiteral("X-KdeConnect-SupportedDeviceTypes")).toVariant().toStringList(); const QStringList supportedDeviceTypes = service.rawData().value(QStringLiteral("X-KdeConnect-SupportedDeviceTypes")).toVariant().toStringList();
if (!supportedDeviceTypes.isEmpty()) { if (!supportedDeviceTypes.isEmpty()) {

View file

@ -31,7 +31,7 @@ public:
QStringList incomingCapabilities() const; QStringList incomingCapabilities() const;
QStringList outgoingCapabilities() const; QStringList outgoingCapabilities() const;
QSet<QString> pluginsForCapabilities(const QSet<QString> &incoming, const QSet<QString> &outgoing); QSet<QString> pluginsForCapabilities(const QSet<QString> &incoming, const QSet<QString> &outgoing) const;
private: private:
PluginLoader(); PluginLoader();