Skip to content

Fix support for themes packaged in subdirs, find sound files again

Things regressed when porting from the old KGameTheme class in 715ea1a8:

the old code to look up themed sound files relied on a "prefix" property of the theme class holding the path to the theme desktop file, relative to which the sound files then were looked up. The new code using the new KGameTheme (KgTheme at the time) class no longer provides the location of the desktop file. And as documented in the related TODO, the sound files were simply only searched in the direct subfolder of all the "themes/" locations.

Which missed that the two lonely older themes on store.kde.org both install into their sources into another subdirectoy. As result the simple look-up missed to spot them.

This commit uses the hook of subclassing KGameTheme and overriding KGameTheme::readFromDesktopFile(desktopFilePath) and registering the class with the 3rd arg of KGameThemeProvider::discoverThemes(). In the overriden method, with the path to the desktop file available, the absolute path are then calculated and stored with the theme instance.

Tested with built-in themes and the two themes from https://store.kde.org/browse?cat=406&ord=latest via the "Get New Themes" dialog. Those untar into "europe/" & "invaders/" subdirs, which otherwise is supported. Just broke for the sounds for the reasons given above.

Edited by Friedrich W. H. Kossebau

Merge request reports