[bt-devel] new class
Martin Gruner
bt-devel@crosswire.org
Thu, 22 Nov 2001 20:44:06 +0100
Hi all,
just wanted to inform you about a change in the source.
I introduced a class called CBTConfig which contains all necessary methods
for writing to the GLOBAL BibleTime configuration file. Please do NOT access
KGLobal->config() any more. Only parts of BibleTime which have their own
configuration file (main index and printing) can use their own KConfig
objects. All other config settings should go through this class.
It has a very simple structure and static methods for retrieving and storing.
If you want to introduce a new option in BibleTime, you should extend one of
the enum's and the corresponding getKey() and getDefault() functions. That's
all.
Why?
-every Key name occurs only once in the source
-the compiler "knows" which setting you want to store/retrieve because you
have to use the appropriate enum value -> no typos any more.
-config code is centralized in one place -> easier to maintain
-static methods can be accessed without an instance of the class
-not a part of the optionsdialog for compiling speed reasons -> CBTConfig is
a small class
I tried to convert the whole existing configuration code to the new system.
I hope this will make the configuration stuff more easy and secure for you in
future. It is not a visible new feature. Please let me know if everything
works as expected, or if you have any change wishes etc.
Martin