KAutoConfig
KAutoConfig
Do you want to add a full fledged configure dialog to your Qt application by only writing one, twenty line function? If so than the KAutoConfig library is what you want.

KAutoConfig is several classes that enables a developer to easily create a configure dialog for their applications. It automatically syncs GUI widgets values with values in the configuration file. It does this by looking for keys and widgets that have the same name. It obtains the default values from the initial values of the widgets. KAutoConfigDialog also manages all of the buttons in a normal configure dialog.

Why do you want it?

Because KAutoConfigDialog does this, developers don't have to write any of the following code:

  • Loading the widgets with their setting values.
  • Store the widget values when the OK or Apply buttons are pressed.
  • Reseting the widgets when the Default button is pressed using the global defaults first and binary defaults second.
  • Disable widgets that are set immutable in the configuration.
  • Enable/Disable the Apply and Default buttons depending on if they actually do anything. (When you first pull up the dialog the Apply button is disabled because nothing has changed.)
  • Only stores settings if the value is different from the default (binary, or global if it exists) value. Thus cleaning up the cluttered config directories.
In fact as far as most developers are concerned the only work they have to do to utilize the KAutoConfigDialog configure dialog is to make some QtDesigner files. You can of course use hand generated widgets with layouts also. Either way KAutoConfigDialog provides a fantastic savings in time and effort. (For some applications I have converted the binary size dropped in half!)

In contrast to all of the home grown configure dialog, every application that use KAutoConfigDialog will present a constant look and feel for users:

  • The dialog can be open without blocking the rest of the application.
  • The caption is uniform across every application.
  • They all have the same look (currently using KJanusWidget when compiled for KDE).
  • All of the features from the first list help to further present a constant look and feel for the user.

What about KConfig_XT?

KConfig_XT which is part of KDE actually uses some of the same source from KAutoConfig. But KConfig_XT is much larger and without a lot of work will force you application to require KDE. KConfigXT provides the same functionality as KAutoConfig, but KAutoConfig is cross platform. If you are writing an application for KDE 3.2 or beyond and you only plan on having to work with KDE then KAutoConfig is not what you want, but for everyone else...

Does KAutoConfig require KDE?

Nope, KAutoConfig comes in two forms. The first form takes advantage of everything in KDE. KAutoConfig will automaticly recognize all of KDE's widgets, set the caption, icon, and uses the KConfig engine. The second form of KAutoConfig links only against Qt and uses QSettings on the back end. This is done by compiling in two replacement classes which extend QSettings and QDialog and provides the needed features that are in KDE while giving the developer source compatibility. Best of all the Qt only library can be used in Windows or Mac development. Compiling the library with or without KDE support is as simple as using the different Makefiles when compiling the library.

Can I use KAutoConfig in my commercial application?

The KAutoConfig library is licensed under the LGPL and so it can be linked to by commercial applications. GPL'd applications can link or compile in KAutoconfig. If you want to compile the classes directly into a commercial application contact me to acquire a non gpl licensed version for a small fee (support your friendly KDE developer :) ).

Is there an example, tutorial or docs?
An example application (and source) is included with the source code. Screenshots of the configure dialog from the example application are included in the screenshots section.
A tutorial can be found here
The API documentation is here.

Screenshots
File Downloads
License
Program Requirements
KDE > 3.1.4 or QT > 3.2