Rocs Plugin (kservice) suport
22 de março de 2010 Deixe um comentário
I wrote this post a month back, but just now I have decided to post it.
Well, some weeks back i commited an initial project for plugins on Rocs, and it’s almost finished… but i had a question about life, the universe and everything: Why i took too long (3 weeks) to put it to work ?
First, i have some others stuff to do, but, this is not a true answer…
Second, I started with QtPlugins, It worked very well! But, and it is a big but, how will Rocs know the location of the installed plugins? Since plugins are shared lib loaded at runtime, I had to make this work somehow. So at IRC, #kde-dev, Rakuko told me something about KServices, unknow by me till then. So, with a little search on the KDE api, i found the rigth way (or KDE way) to make it works flawessly.
So, I had to stop doing with Qt Plugins and rewriting everything to use KServices, back from line zero. =)
After some hack. i had a problem loading the plugins, they were found in the system, but not loaded. So i started to look at other plugins (from kopete for instance) , Plugin example from kdevelop (What if some KDE programs where closed source? Maybe i will be still boring people at IRC to resolve that =). But it worked, compiled in a charmingly and cute way, then I forgot to work on them for another week.
Until the end of last week Rocs was compiled with static libs, so Tomaz made a shared lib with core classes, including plugin manager and interfaces and i went back to hack today. Looking at TextEditor plugin example, i saw 2 things that i have not noticied back then:
-use of library export (KDE_EXPORT/KDE_IMPORT) and
-use of explicit at contructor, both at interface class declaration.
With this 2 things, plugins started to load :)
Now Rocs have import/export and initial tools plugins suport. In next post i will give all the info required for your own plugin… by now take a look in this screenshot of import/export and a set of nodes with some properties.