Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwincompositing/model.cpp
Show All 19 Lines | |||||
20 | 20 | | |||
21 | #include "model.h" | 21 | #include "model.h" | ||
22 | #include "effectconfig.h" | 22 | #include "effectconfig.h" | ||
23 | #include "compositing.h" | 23 | #include "compositing.h" | ||
24 | #include <config-kwin.h> | 24 | #include <config-kwin.h> | ||
25 | #include <kwin_effects_interface.h> | 25 | #include <kwin_effects_interface.h> | ||
26 | #include <effect_builtins.h> | 26 | #include <effect_builtins.h> | ||
27 | 27 | | |||
28 | #include <KLocalizedString> | 28 | #include <KLocalizedString> | ||
29 | #include <KService> | | |||
30 | #include <KServiceTypeTrader> | | |||
31 | #include <KSharedConfig> | 29 | #include <KSharedConfig> | ||
davidedmundson: can we drop these? | |||||
32 | #include <KCModuleProxy> | 30 | #include <KCModuleProxy> | ||
31 | #include <KPackage/PackageLoader> | ||||
33 | #include <KPluginTrader> | 32 | #include <KPluginTrader> | ||
34 | #include <kdeclarative/kdeclarative.h> | 33 | #include <kdeclarative/kdeclarative.h> | ||
35 | #include <KPluginLoader> | 34 | #include <KPluginLoader> | ||
36 | #include <KPluginMetaData> | 35 | #include <KPluginMetaData> | ||
37 | #include <KAboutData> | 36 | #include <KAboutData> | ||
38 | 37 | | |||
39 | #include <QAbstractItemModel> | 38 | #include <QAbstractItemModel> | ||
40 | #include <QDBusConnection> | 39 | #include <QDBusConnection> | ||
▲ Show 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | 227 | for (auto builtin : builtins) { | |||
258 | effect.configurable = it != configs.end(); | 257 | effect.configurable = it != configs.end(); | ||
259 | 258 | | |||
260 | m_effectsList << effect; | 259 | m_effectsList << effect; | ||
261 | } | 260 | } | ||
262 | } | 261 | } | ||
263 | 262 | | |||
264 | void EffectModel::loadJavascriptEffects(const KConfigGroup &kwinConfig) | 263 | void EffectModel::loadJavascriptEffects(const KConfigGroup &kwinConfig) | ||
265 | { | 264 | { | ||
266 | KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect", QStringLiteral("[X-Plasma-API] == 'javascript'")); | 265 | const auto plugins = KPackage::PackageLoader::self()->listPackages(QStringLiteral("KWin/Effect"), QStringLiteral("kwin/effects")); | ||
267 | for(KService::Ptr service : offers) { | 266 | for (const KPluginMetaData &metaData : plugins) { | ||
268 | const QString effectPluginPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kservices5/"+ service->entryPath(), QStandardPaths::LocateFile); | 267 | KPluginInfo plugin(metaData); | ||
269 | KPluginInfo plugin(effectPluginPath); | | |||
270 | EffectData effect; | 268 | EffectData effect; | ||
271 | 269 | | |||
272 | effect.name = plugin.name(); | 270 | effect.name = plugin.name(); | ||
273 | effect.description = plugin.comment(); | 271 | effect.description = plugin.comment(); | ||
274 | effect.authorName = plugin.author(); | 272 | effect.authorName = plugin.author(); | ||
275 | effect.authorEmail = plugin.email(); | 273 | effect.authorEmail = plugin.email(); | ||
276 | effect.license = plugin.license(); | 274 | effect.license = plugin.license(); | ||
277 | effect.version = plugin.version(); | 275 | effect.version = plugin.version(); | ||
278 | effect.category = translatedCategory(plugin.category()); | 276 | effect.category = translatedCategory(plugin.category()); | ||
279 | effect.serviceName = plugin.pluginName(); | 277 | effect.serviceName = plugin.pluginName(); | ||
280 | effect.effectStatus = effectStatus(kwinConfig.readEntry(effect.serviceName + "Enabled", plugin.isPluginEnabledByDefault())); | 278 | effect.effectStatus = effectStatus(kwinConfig.readEntry(effect.serviceName + "Enabled", plugin.isPluginEnabledByDefault())); | ||
281 | effect.enabledByDefault = plugin.isPluginEnabledByDefault(); | 279 | effect.enabledByDefault = plugin.isPluginEnabledByDefault(); | ||
282 | effect.enabledByDefaultFunction = false; | 280 | effect.enabledByDefaultFunction = false; | ||
283 | effect.video = service->property(QStringLiteral("X-KWin-Video-Url"), QVariant::Url).toUrl(); | 281 | effect.video = plugin.property(QStringLiteral("X-KWin-Video-Url")).toUrl(); | ||
284 | effect.supported = true; | 282 | effect.supported = true; | ||
285 | effect.exclusiveGroup = service->property(QStringLiteral("X-KWin-Exclusive-Category"), QVariant::String).toString(); | 283 | effect.exclusiveGroup = plugin.property(QStringLiteral("X-KWin-Exclusive-Category")).toString(); | ||
286 | effect.internal = service->property(QStringLiteral("X-KWin-Internal"), QVariant::Bool).toBool(); | 284 | effect.internal = plugin.property(QStringLiteral("X-KWin-Internal")).toBool(); | ||
287 | effect.scripted = true; | 285 | effect.scripted = true; | ||
288 | 286 | | |||
289 | if (!service->pluginKeyword().isEmpty()) { | 287 | const QString pluginKeyword = plugin.property(QStringLiteral("X-KDE-PluginKeyword")).toString(); | ||
288 | if (!pluginKeyword.isEmpty()) { | ||||
290 | // scripted effects have their pluginName() as the keyword | 289 | // scripted effects have their pluginName() as the keyword | ||
291 | effect.configurable = service->property(QStringLiteral("X-KDE-ParentComponents")).toString() == service->pluginKeyword(); | 290 | effect.configurable = plugin.property(QStringLiteral("X-KDE-ParentComponents")).toString() == pluginKeyword; | ||
292 | } else { | 291 | } else { | ||
293 | effect.configurable = false; | 292 | effect.configurable = false; | ||
294 | } | 293 | } | ||
295 | 294 | | |||
296 | m_effectsList << effect; | 295 | m_effectsList << effect; | ||
297 | } | 296 | } | ||
298 | } | 297 | } | ||
299 | 298 | | |||
▲ Show 20 Lines • Show All 362 Lines • Show Last 20 Lines |
can we drop these?