XML configuration files for KDE

Since KBoard needed a powerful hierarchical configuration system and QSettings was too limited for our needs, we decided to implement an XML-based configuration framework from scratch.
Hence, Settings was born.

Today, I’ve decided to write a bit of documentation for Settings, and to eliminate all references in it to the rest of KBoard, so that other KDE (or Qt) developers not satisfied with QSettings/KConfig can benefit.

You can find the code and a sketched documentation on the kboard wiki.

Advertisements

2 Responses to “XML configuration files for KDE”

  1. superstoned Says:

    wouldn’t the Kconfig framework be a solution here?

  2. pcapriotti Says:

    Unfortunately not, because:
    1) KConfig does not support nested config groups
    2) KConfig has no concept of config array or config map
    3) Settings has a nicer syntax. Compare the following snippet using KConfig


    QFont f;
    if (config->hasKey("console-font")) {
    f = config->readFontEntry("console-font");
    }
    else {
    f = defaultFont;
    config->writeFontEntry("console-font", f);
    }

    with this line using Settings:

    QFont f = settings["console-font"] |= defaultFont;

    Actually, I would prefer to see the Settings features integrated in KConfig, but in the meanwhile, it is perfectly usable as it is, and is a reasonable solution for those who needs complicated setting hierarchies in their applications (and don’t mind being forced to store the configuration as XML).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: