[Kde-games-devel] Theming suport

Ian Wadham ianw2 at optusnet.com.au
Thu Mar 15 04:14:47 CET 2007


On Thu, 15 Mar 2007 01:36 am, Tomasz Boczkowski wrote:
>   Most of KDE4 games will support themes. I am wondering how to provide
> theme selection for user. Do we need a common "theme" dialog in
> libkdegames or each game should have it's own?
>
Hmmmm ... I've seen the posts by Johann, Mauricio, Branan and Parker
on this topic.  Inspired by Mauricio's example with KMahjongg and KShisen,
I have been looking for a way to bring in themes and the ability to change
themes during play (and download new themes) that is *simple* for everyone
to understand and use.

In particular, I think artists should be able to add a theme without requiring
any program changes and without having to know XML or understand
KConfigXT, etc.  (I'm still struggling with the finer points of ui.rc files, 
after several years :-) ).

It would also be nice to be able to release themes and other game data
(such as new levels) between KDE Games releases and with the same
comments applying to game-data authors as to artists.  Is that what
khotnewstuff will do?  Where do I find out more?

So I've been thinking of a purely data-oriented approach for KGoldrunner,
with very little procedural or dialog code.  Maybe I am being simplistic or
simple-minded, but here goes ...

1. Have a /pics area, parallel to /src and /gamedata, to contain the released
    themes and graphics (whether SVG or other).
2. Allow a /pics area in $HOME/.kde/share/apps/appname for locally
    composed themes, test-versions of themes and downloaded themes.
3. The main /pics area should contain a README file, to document the
    meaning and usage of metadata and SVG element names in this game,
    or better still it could be added as an Appendix to the game handbook.
4. Following Mauricio, have a .desktop file for each theme, containing
    metadata, and one or two other files containing graphics (pointed to by
    the metadata).  It would be nice to use ".theme" as an extension for
    this file rather than ".desktop", if the authors of scripty would agree.
5. In KGoldrunner, I am proposing to replace the current Landscapes menu
    with a Themes menu, for which the ui.rc will read:
                <Menu name="themes" > <text>&amp;Themes</text>
                        <ActionList name="theme_list" />
    This menu will contain an open-ended list of whatever themes are installed
    or in $HOME/.kde/share/apps/kgoldrunner/pics when KGr executes.
6. In kgoldrunner.cpp, after setupGUI(), I'll retrieve all files *.desktop,
    make a lookup table of them for use when themes are selected, make
    an action for each one, with a (translated) text taken from the file, put
    all the actions into a QList<QAction *> themeList, then do:
                unplugActionList ("theme_list");
                plugActionList   ("theme_list", themeList);
    That fills the Themes menu with a list of available themes and away we go.
    The methods are in the kdeui->KXMLGUIClient class.
7. To download a new theme, simply copy the files to your
    $HOME/.kde/share/apps/appname/pics from any site at all.

Why use a special menu, rather than a dialog?  Well, I think themes are going
to be a major new feature of KDE Games, so if you've got it, flaunt it ... :-)
Also a menu is easier to program than a dialog ... ;-)

All the best, Ian W.





More information about the kde-games-devel mailing list