[Kde-games-devel] Draft for the core KgTheme API

Stefan Majewsky stefan.majewsky at googlemail.com
Wed Mar 14 23:23:04 UTC 2012


Moin moin,

this evening, when without internet connection, I finally sat down to
write the UI-independent core of the KgTheme API. For an early API
review, I have attached kgtheme.h and kgthemeprovider.h plus a patch
on kgamerenderer.h for integration. There is also an implementation
for this, but I won't post a review until I got kdegames to compile
again. This fails at the moment because of source-incompatible changes
in KGameRenderer.

The main difference between KGameTheme and KgTheme is that there are
two classes: KgTheme is a single theme, KgThemeProvider is a set of
themes. The provider is responsible for maintaining the theme
selection and communicating that to KGameRenderer. This development is
identical to KgDifficulty, where (compared to KGameDifficulty) the
responsibility for storing the difficulty selection has moved into the
library.

KgTheme turns out to be more difficult than KgDifficulty because there
are more legacy variants to support. I especially intent to turn
libkmahjongg into an as-thin-as-possible wrapper around KgTheme, so it
needs compatibility API e.g. for the config group names: KGameTheme
themes use [KGameTheme], while libkmahjongg parses
[KMahjonggBackground] and [KMahjonggTileset].

As a simple example, there's some code in kgtheme.h that shows how I
intend to solve these problem by additional static methods that enable
compatibility behavior, wrapped in #ifdef
KGTHEME_PROVIDE_COMPATIBILITY_API. KMahjonggTileset and
KMahjonggBackground can then become subclasses of KgThemeProvider to
implement the few application-specific parts that
KgTheme+KGameRenderer does not provide.

Anyway, when the first review request appears, it will only contain
the core (i.e. non-gui) API sketched above. I'll temporarily enable
KGameThemeSelector to use KgThemeProvider, so porting can start. There
will also be a KgThemeSelector; I have some interesting sketches on my
desk concerning this topic.

End of the braindump. Any thoughts on anything?

Greetings
Stefan

P.S. There's an initial build of a libkdegames repo in
dewey:~git/majewsky/libkdegames/, if you're interested.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kgtheme.h
Type: text/x-chdr
Size: 5896 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120315/f15de4d3/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kgthemeprovider.h
Type: text/x-chdr
Size: 4704 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120315/f15de4d3/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kgamerenderer+kgtheme.patch
Type: text/x-patch
Size: 5771 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120315/f15de4d3/attachment.patch>


More information about the kde-games-devel mailing list