A Qt replacement for KGlobal::ref and deref

Stephen Kelly steveire at gmail.com
Thu Feb 17 21:51:48 GMT 2011


Stefan Majewsky wrote:

> On Wed, Feb 16, 2011 at 5:31 PM, Aaron J. Seigo <aseigo at kde.org> wrote:
>> which begs the question: "is KConfig (as ane exmple) platform or app
>> dev"? fun conversations to be had and digging to be done :)
> 
> From my experience, KConfig is actually two things at once:
> 
> 1. framework for reading and writing INI-like files
> 2. utility for locating and merging user-specific plus system-wide
> configuration
> 
> Only part 2 is platform. Part 1 is already a great thing in itself
> even if applied to single files. Usages of KConfig for the purpose of
> defining custom, human-readable file formats include (here in
> kdegames) KGameTheme description files, Palapeli puzzle metadata,
> Palapeli collections, Kolf courses, etc.pp. Part 2 is "just" a bonus
> for application configuration files, just like KConfigXT which is not
> useful for custom file formats.
> 
> So a possible idea could be to refactor the KConfig class into two
> classes, one for stand-alone config files and one for application
> configuration in KStandardDirs' "config" prefix. The latter class
> would then move into the KDE platform thingy, while the other one does
> not have any KStandardDirs dependency. (Dunno about other low-level
> dependencies, though.)

To see how that kind of thing can work, see here:

http://websvn.kde.org/trunk/playground/pim/contacts/kgrantleeintegration.cpp?revision=1221333&view=markup

Grantlee has API for setting where to look for stuff like templates and 
plugins. In a KDE application you don't want to have to specify those things 
explicitly because KStandardDirs knows the right places to look.

So the KGrantleeIntegration simply calls all the necessary Grantlee APIs 
with the output from KStandardDirs. This way we achieve platform integration 
(kaddressbook only needs to create a KGrantleeIntegration object, but 
doesn't need to tell it where to look for stuff), and Grantlee remains a Qt 
only library, something that belongs on Tier1 on my diagram.








More information about the kde-core-devel mailing list