dbus adaptors (Re: KDE/kdelibs)

David Faure faure at kde.org
Sat Jul 8 15:47:44 BST 2006


On Saturday 08 July 2006 09:16, Thiago Macieira wrote:
> David Faure wrote:
> >Let's stop generating adaptors that completely fail at runtime
> > (qinvokemethod -> no compile-time checking). QT4_ADD_DBUS_ADAPTORS is
> > deprecated, use QT4_ADD_DBUS_ADAPTOR() instead, which now takes in its
> > arguments the header file and the classname of the parent object being
> > adapted. The methods in the adaptor simply call the methods in the
> > parent object, which means we know at compile-time that the xml and the
> > C++ match.
> 
> I oppose the very existence of this macro.
> 
> Adaptors are meant to be generated by the developer at development time, 
> not by the user at compile-time. Those files should be then checked in to 
> the Subversion server or whatever source control system you are using.
> 
> This macro will be an incentive for people to generate adaptors at 
> compile-time.

Yes that's the idea ;)
Modifying generated files is a long-term maintainance nightmare. Whenever the
interface changes, you can't just launch qdbusxml2cpp again, you need to manually
write the new methods or copy paste from qdbusxml2cpp's output ... all a bit messy.
I think most of the code in kde has now switched to generated adaptors, except
for those where the QDBusMessage is needed.

Anyway, in konqueror I even decided to do otherwise... Since the adaptors need
code that is specific to those exported methods (which I don't really want in the main qobject),
the adaptor is hand written (and does not just forward calls, it actually has logic).
It's the xml that I regenerate from the adaptor when modifying the interface...
I think this approach makes more sense since I can modify the interface using C++,
which is more convenient/intuitive than writing xml (which requires knowing the
dbus type codes etc.).

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kde-core-devel mailing list