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