Beispiel #1
0
void FrameBufferManager::loadPlugins()
{
    //qDebug();

    const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb"), [](const KPluginMetaData & md) {
            return md.serviceTypes().contains(QStringLiteral("krfb/framebuffer"));
        });

    QVectorIterator<KPluginMetaData> i(plugins);
    i.toBack();
    QSet<QString> unique;
    while (i.hasPrevious()) {
	KPluginMetaData data = i.previous();
        // only load plugins once, even if found multiple times!
        if (unique.contains(data.name()))
            continue;
	KPluginFactory *factory = KPluginLoader(data.fileName()).factory();
	
	if (!factory) {
		qDebug() << "KPluginFactory could not load the plugin:" << data.fileName();
	} else {
		qDebug() << "found plugin at " << data.fileName();
	}
	
	FrameBufferPlugin *plugin = factory->create<FrameBufferPlugin>(this);
	if (plugin) {
		m_plugins.insert(data.pluginId(), plugin);
		qDebug() << "Loaded plugin with name " << data.pluginId();
	} else {
		qDebug() << "unable to load pluign for " << data.fileName();
	}
        unique.insert (data.name());
    }
}
Beispiel #2
0
ThemeInfo::ThemeInfo( const KPluginMetaData& data )
    : id( data.pluginId() )
    , name( data.name() )
    , description( data.description() )
    , widget( nullptr )
{
}
Beispiel #3
0
void PanelPlugin::setPluginInfo(KPluginMetaData info)
{
    d->name=info.name();
    d->requiredExtensions=info.value(QLatin1String("RequiredExtensions")).split(QLatin1Char(','));
}