Archive for August, 2012

In this third and last example I will show the KTutorial implementation of a tutorial for Gwenview.

Like the previous tutorial for Kdenlive, this tutorial was made after the release of KTutorial 0.5, so nothing had to be changed in KTutorial to implement it. Unlike the Kdenlive tutorial, for this one I had to modify Gwenview code for something else than just to use KTutorial. But it was not to add object names like for the showFoto tutorial. In this case, I added a little hack to reparent KActions from the main KActionCollection to the main application window.

The KActionCollection created by KXmlGuiWindow (the base class of the main application window) is not parented to the main application window. However, the KActions are parented to the KActionCollection. KTutorial scripted tutorials (like those exported from the editor) can only find objects that are descendants of the main application window, so the KActions have to be reparented to the main Gwenview window to be found by KTutorial.

Note that reparenting the KActions is not mandatory for KTutorial to work with Gwenview (or any other application). However, it provides a more interactive experience, at least with the tutorial I implemented in this example. If the KActions could not have been used the tutorial could have been written anyway, but it would have contained more “Continue” buttons to change to the new step, instead of changing when the user does what he is asked to do.

As I have already said, the changes made to Gwenview are the same that for Kdenlive, but also reparenting the KActions: Gwenview is linked against KTutorial (if found), the tutorial itself is added as a Javascript file, the tutorial script is included in the message extraction for i10n and the KActions are reparented to the main application window. If you want to try this patch yourself, here it is: Gwenview patch (against current master at the time of this writing, which is ef544ad9).

I hope you have liked this three example series and, who knows, maybe become interested about KTutorial 🙂

This time, instead of adapting for KTutorial an already existing tutorial, I wrote the tutorial myself from scratch. I was not sure of what license the Kdenlive tutorials are under, so I made my own CC by-sa tutorial showing how to add a slide transition between two clips.

There are other two differences worth being mentioned. The first is that I made the Kdenlive tutorial once I released KTutorial 0.5. The showFoto tutorial was made during the KTutorial 0.5 development, and it was used to identify problems when using KTutorial in applications other than the KTutorial editor itself. But the Kdenlive tutorial was made using the released KTutorial 0.5 instead. That is, nothing had to be changed or fixed on KTutorial to implement this tutorial.

The other difference is that the Kdenlive code was modified just to use KTutorial. No object names were set this time. I could have added object names, or properties to Kdenlive classes, or custom WaitFors, or even made a C++ tutorial, and get an even more interactive tutorial. But I wanted to adapt to just what Kdenlive code provided. I think that the result was pretty good 🙂 (although it would not have been so good if Kdenlive code did not contain already a lot of object names 😉 ).

Like with showFoto, I have patched Kdenlive to record the video. The changes are the same that for showFoto, but for adding the object names: Kdenlive is linked against KTutorial (if found), the tutorial itself is added as a Javascript file and the tutorial script is included in the message extraction for i10n. If you want to try this patch yourself, here it is: Kdenlive patch (against current master at the time of this writing, which is 34f17213).

As said in the previous post, this KTutorial release (0.5) was focused on getting KTutorial ready to be used by other applications besides the KTutorial editor itself. How was it done? Well, using KTutorial on other applications besides the KTutorial editor itself 🙂

Specifically, a real showFoto tutorial from KDE UserBase was implemented in KTutorial. And not only that; the tutorial was implemented entirely using KTutorial editor. Even if C++ tutorials are more powerful than scripted ones, the goal was to ensure that just using the editor (which creates Javascript tutorials) and without any manual tweaking of the generated code, a tutorial useful for a real application could be done. And, guess what? It can be done 🙂

Cool! So, does showFoto support KTutorial now? Well, no, it does not. I had to patch showFoto to record that video 😉

However, the changes are pretty simple: showFoto is linked against KTutorial (if found), the tutorial itself is added as a Javascript file, the tutorial script is included in the message extraction for i10n and the name of the QObjects referenced in the tutorial are set. If you want to try this patch yourself, here it is: digiKam/showFoto patch (against current master at the time of this writing, which is 9744d0d3).