hi..

currently libplasma uses the KDE plugin loading mechanisms *extensively*. they 
have also been 
marked as deprecated. the goal for frameworks, as i undestand it, is to move to 
a QPluginLoader.

QPluginLoader has a major limitation, however: it only returns a single 
instance of a class from 
the loaded library. one. ever. only. :)

obviously, applications such as Plasma Desktop need to load the same plugin 
many times, as 
needed. the solution is obvious: create a factory class that returns new 
instances of the class(es) 
inside of the library.

during our weekly plasma-workspaces meeting this topic came up and i suggested 
an approach 
(which I've also discussed with Thiago in passing) which i plan to implement at 
least for plasma-
workspace as a short-term solution to get away from the KDE plugin loading.

i will introduce a new macro (so that it remains source compatible, at least 
for libplasma) that 
creates a QObject subclass which itself provides a factory method to create new 
instances of the 
class(es) in the library.

i would also like to fold in version compatibility checks. the resulting API of 
the generated object 
will look something like:

template<class T> T *create(QObject *parent = 0) const;
bool isVersionCompatible(quint32 minVersion, quint32 maxVersion);

the version check method will help remove some boilerplate code from the 
library.

create will be used similarly to how it KPluginLoader is now: create<Foo>()

the QVariantList parameter will be removed as it seems to serve little real 
world purpose with 
how we design APIs now.

thoughts, before i go write some code?

-- 
Aaron J. Seigo

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to