Support for QtQuick in libkdegames

Review Request #109365 - Created March 9, 2013 and submitted - Latest diff uploaded

Viranch Mehta
This is a copy of review request #7017 in SVN review board because I needed to update the patch (it won't accept git diffs). Updated description:

This patch contains support for QtQuick in libkdegames for future porting QML. Post this patch, libkdeclarative becomes a dependency for libkdegames.

We have some new classes:

1. KgImageProvider:
This is a QDeclarativeImageProvider, and a sort-of replacement for KGameRenderer for QML ports. This class is supplied with a KgThemeProvider which it uses to discover SVG locations, reads them using QSvgRenderer and returns the requested sprite pixmap. QDeclarativeImageProvider has inbuilt ability of caching and asynchronous loading of pixmaps, which is why can replace usages of KGameRenderer in QML ports.

2. KgDeclarativeView:
This is a QDeclarativeView with KDE-specific import paths for QML components configured and javascript functions bindings added (like i18n() methods) using the KDeclarative library. Game's KgThemeProviders are supplied to this class which in turn registers them with the underlying QML engine, and adds KgImageProviders corresponding to each KgThemeProvider.

3. KgItem QML component:
This is simple QML Image element wrapper for showing sprites on QML views using the KgImageProviders. We specify which one of the KgImageProviders we want to use and which sprite key we want to show, and it will be painted on the view.

The patch may not stay up-to-date, relevant code is in "viranch/qtquick" branch in libkdegames's git repo.
I'm using KBreakout to test all of this. The relevant port can be found in "qtquick/imageprovider" branch in KBreakout's git repo.