<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/109365/">http://git.reviewboard.kde.org/r/109365/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 9th, 2013, 8:26 a.m. UTC, <b>Viranch Mehta</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">David Edmundson (Aug. 9, 2012, 10:50 p.m.):
I can see why you've done this, but for me this doesn't really work.

However - what I think we can do is make a wrapper round KGameRenderer and turn it into an QML ImageProvider, which may (I've not thought everything through) be a much nicer solution.

Viranch Mehta (Aug. 11, 2012, 12:54 p.m.):
That was my first approach, but the problem with it is that the image does not get updated when the theme is changed. A new pixmap is requested only when the "source" property changes, simply changing the theme does not involve changing the source, and hence the image cannot be updated. Also, there is no way to internally trigger an update so a new pixmap is requested when the theme is changed.

So this is the alternative approach I had to choose. What isn't working for you?

David Edmundson (Aug. 11, 2012, 1:10 p.m.):
Good point.</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Now that we have name of the current theme as part of the "source" property, new pixmap is automatically requested whenever theme changes as the source property is updated.

(See KgItem.qml: source: "image://"+provider.name+"/"+provider.currentThemeName+"/"+spriteKey+"/"width+"x"+height)</pre>
<br />










<p>- Viranch</p>


<br />
<p>On March 9th, 2013, 8:11 a.m. UTC, Viranch Mehta wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for KDE Games.</div>
<div>By Viranch Mehta.</div>


<p style="color: grey;"><i>Updated March 9, 2013, 8:11 a.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm using KBreakout to test all of this. The relevant port can be found in "qtquick/provider" branch in KBreakout's git repo.</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>CMakeLists.txt <span style="color: grey">(67b8b40)</span></li>

 <li>declarativeimports/CMakeLists.txt <span style="color: grey">(PRE-CREATION)</span></li>

 <li>declarativeimports/corebindingsplugin.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>declarativeimports/corebindingsplugin.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>declarativeimports/qml/KgItem.qml <span style="color: grey">(PRE-CREATION)</span></li>

 <li>declarativeimports/qml/qmldir <span style="color: grey">(PRE-CREATION)</span></li>

 <li>includes/CMakeLists.txt <span style="color: grey">(8756a50)</span></li>

 <li>includes/KgDeclarativeView <span style="color: grey">(PRE-CREATION)</span></li>

 <li>kgdeclarativeview.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>kgdeclarativeview.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>kgimageprovider.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>kgimageprovider.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>kgthemeprovider.h <span style="color: grey">(6ca9b63)</span></li>

 <li>kgthemeprovider.cpp <span style="color: grey">(e186106)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/109365/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>