[PATCH] Make kconfig_compiler work correctly with parametrized entries.
Waldo Bastian
bastian at kde.org
Mon Apr 12 16:24:53 BST 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun April 11 2004 00:31, Reinhold Kainhofer wrote:
> Any comments?
You say:
"Make mutators for enum parameters work by adding them with $(..) replaced
by the param index (int), instead of being replaced by the actual param name.
The check for isImmutable in the set* functions doesn't have the param name
available, just the corresponding enum value (int)."
Which is indeed a smart way to solve this problem, but I'm afraid it breaks
backwards compatibility. See for example kdegames/kmines which uses:
<entry name="$(Button)MouseAction" type="Enum" key="mouse $(Button)">
<choices>
<choice name="Reveal"/>
<choice name="AutoReveal"/>
<choice name="ToggleFlag"/>
<choice name="ToggleUncertainFlag"/>
<choice name="None"/>
</choices>
<parameter name="Button" type="Enum">
<values>
<value>left</value>
<value>mid</value>
<value>right</value>
</values>
</parameter>
<label>Mouse button actions</label>
<default param="left">Reveal</default>
<default param="mid">AutoReveal</default>
<default param="right">ToggleFlag</default>
</entry>
And then has code in dialogs.cpp that refers to "kcfg_leftMouseAction",
"kcfg_midMouseAction" and "kcfg_rightMouseAction".
If I understand your patch correctly, the names of the items would now become
"0MouseAction", "1MouseAction" and "2MouseAction" which would then break the
above code since that would still expect to have "leftMouseAction",
"midMouseAction" and "rightMouseAction".
So I guess the solution is to do it the hard way and define something like:
const *char const buttonEnumToString[] = { "left", "mid", "right" };
and then the code can become:
if ( !self()->isImmutable(
QString("%1MouseButton" ).arg(buttonEnumToString[i])
))
Or for consistency it might be better to use
QValueList<KConfigSkeleton::ItemEnum::Choice> valuesButton;
instead of const * const char[], although that is less efficient.
Cheers,
Waldo
- --
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
^ bastian at kde.org | Is your software SUSE LINUX READY? | bastian at suse.com
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFAerTFN4pvrENfboIRAqNPAJ9Fdo89QQSz6HTnGQTMrPT7z4FJiwCePmri
ieuvsZDxm96muXBtllJsUaM=
=7UGE
-----END PGP SIGNATURE-----
More information about the kde-core-devel
mailing list