MCPcopy Create free account
hub / github.com/KDE/kdevelop / PluginPreferences

Method PluginPreferences

kdevplatform/shell/settings/pluginpreferences.cpp:24–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22{
23
24PluginPreferences::PluginPreferences(QWidget* parent)
25 : ConfigPage(nullptr, nullptr, parent)
26{
27 auto* lay = new QVBoxLayout(this );
28 lay->setContentsMargins(0, 0, 0, 0);
29 selector = new KPluginWidget( this );
30 KConfigGroup cfgGroup(Core::self()->activeSession()->config(), QStringLiteral("Plugins"));
31 selector->setConfig(cfgGroup);
32 lay->addWidget( selector );
33 QMap<QString, QVector<KPluginMetaData>> plugins;
34 const QMap<QString, QString> categories = {
35 { QStringLiteral("Core"), i18nc("@title:group", "Core") },
36 { QStringLiteral("Project Management"), i18nc("@title:group", "Project Management") },
37 { QStringLiteral("Version Control"), i18nc("@title:group", "Version Control") },
38 { QStringLiteral("Utilities"), i18nc("@title:group", "Utilities") },
39 { QStringLiteral("Documentation"), i18nc("@title:group", "Documentation") },
40 { QStringLiteral("Language Support"), i18nc("@title:group", "Language Support") },
41 { QStringLiteral("Debugging"), i18nc("@title:group", "Debugging") },
42 { QStringLiteral("Testing"), i18nc("@title:group", "Testing") },
43 { QStringLiteral("Analyzers"), i18nc("@title:group", "Analyzers") },
44 { QStringLiteral("Runtimes"), i18nc("@title:group", "Runtimes") },
45 { QStringLiteral("Other"), i18nc("@title:group", "Other") }
46 };
47 const auto pluginInfos = Core::self()->pluginControllerInternal()->allPluginInfos();
48 for (const KPluginMetaData& info : pluginInfos) {
49 const QString loadMode = info.value(QStringLiteral("X-KDevelop-LoadMode"));
50 if( loadMode.isEmpty() || loadMode == QLatin1String("UserSelectable") )
51 {
52 QString category = info.category();
53 if (!categories.contains(category)) {
54 if (!category.isEmpty()) {
55 qCWarning(SHELL) << "unknown category for plugin" << info.name() << ":" << info.category();
56 }
57 category = QStringLiteral("Other");
58 }
59 plugins[category] << info;
60 } else
61 qCDebug(SHELL) << "skipping..." << info.pluginId() << info.value(QStringLiteral("X-KDevelop-Category")) << loadMode;
62 }
63
64 for (auto it = plugins.constBegin(), end = plugins.constEnd(); it != end; ++it) {
65 selector->addPlugins(it.value(), categories.value(it.key()));
66 }
67 connect(selector, &KPluginWidget::changed, this, &PluginPreferences::changed);
68}
69
70void PluginPreferences::defaults()
71{

Callers

nothing calls this directly

Calls 15

setConfigMethod · 0.80
allPluginInfosMethod · 0.80
pluginIdMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
configMethod · 0.45
activeSessionMethod · 0.45
addWidgetMethod · 0.45
valueMethod · 0.45
isEmptyMethod · 0.45
categoryMethod · 0.45

Tested by

no test coverage detected