a blog about my KDE adventures

January Update for KTouch

| Comments

This also includes the work done on KTouch in December. With the expected Christmas-related development hiatus I didn’t feel overly compelled to write a dedicated update.

And it is also the very last update before the upcoming KDE SC 4.10 release. The final tag freeze was already yesterday, so this report pretty much reflects the state KTouch will be released in.


Since November another dozen of different mostly smallish issues have been fixed, among them the very last crash bug I am aware of. It took me forever to get to the bottom of the issue, even if the solution was always right in front of me. In the end it turned out KTouch’s resource editor was another victim of kdelibs Bug 303228, a bug report I have stumbled over very early on during my investigations. Too bad if one can’t match two backtraces.

Another significant fix is that KTouch is now able to render properly under a Plasma theme with light text on dark backgrounds (Bug 312082). No more impossible-to-read labels because of lack of contrast.


Thanks to Ludo Beckers KTouch has gained support for the Belgian keyboard layout. As of now we don’t have matching course for this layout yet, so unfortunately it is difficult for the user to directly profit from it.

I think the overall data situation may improve, though, once the first release of KTouch 2.0 is out. I hope the new training experience combined with the completely overhauled authoring tools are enough of an impetus for new contributors to get some movement in that area.

November Update for KTouch

| Comments

It has been a quite month for KTouch, with the Feature Freeze in place for the greater part of the month. But this doesn’t mean nothing has been done at all.

Last Features

First, I did some work on the layouting code for the training screen.

Previously KTouch picked a font and laid out the sheet so the lesson text fit into it. This approach had a few problems:

  • If the lesson contains very long lines the sheet didn’t fit into the view port.
  • If the window is maximized on large screens the sheet used only a small amount of the available space.

The new version does it the other way around: the sheet will always fill the horizontally available space and we scale the text so it fits perfectly in there. Especially the latter was way more complicated to implement when I imagined. Calculating the required scaling factor is easy, but naïvely applying a value to the scale attribute to an QML text element results in severely degraded rendering quality. The default transformation origin is the center. With what, fonts will look very blurry. After setting it to top left corner rendering quality was okay, but still not that crisp like without scaling. Any hints to further improve the quality are welcome. I still think the gained flexibility is worth the price.

Secondly, one thing I have repeatedly observed is that users new to KTouch had problems grasping the training mechanisms of KTouch. Two characteristics in particular stood out in that way:

  • Users have to correct their errors with Backspace.
  • Finished lines have to be confirmed with Return.

The keyboard layout visualization always highlights the key the user has to press to go on, but in this cases this has been proven to be ineffective. Therefore I have implemented an additional hint system to help the user to overcome these hurdles: After three key presses after the users has entered one of the aforementioned conditions the key he has press to solve the problem will be displayed right under the current training line.

I think those hints are hard to ignore and users accustomed to the behavior won’t get distracted by them since they won’t see them ever.


With these two features done I’ve spend most of my time on fixing bugs. A good dozen of small and not-so-small issues have been resolved. But one pair of fixes is especially important to the user.

With German being my native tongue—a language which only seldomly requires accented characters—I have only realized very late that handling dead key events in QML alone is impossible right now. This is a problem for KTouch because the event handling for the trainer was implemented in QML only. Many languages KTouchs offers courses for are really depended on working dead keys so I have considered that bug of show stopper severity. Now that I’ve moved the implementation of the event handling to C++, dead keys are no longer a problem.

While I was active in that particular corner of the codebase I also made sure KTouch works fine with CJK input methods. At least in the past their was some interest in creating a Chinese course for KTouch, now the technical requirements for that are there.


Last but not least KTouch got a new handbook. The version of KTouch to be released with KDE SC 4.10 is a complete rewrite having only few similarities to the previous version. So a rewrite was also due for the handbook. Huge kudos go to Yuri Chornoivan who has stepped up to support me in that area and has been the one doing at least 90% of the work. This was not a small task by any means and I think the results speak for themselves.

With that done we are one step closer to the quality I think is required for a successful initial release. Replacing a peace of established software is always a risky endeavor, so I really don’t want to release something half-baked. Having a complete and up-to-date handbook is important part of that to me.

New Version of KTouch Merged

| Comments

Today I’ve finally merged my next branch into the master branch. Lately the differences between the two branches became increasingly huge:

$ git log origin/master..origin/next --oneline --no-merges | wc -l
$ git --no-pager diff origin/master..origin/next --shortstat -- src/
 252 files changed, 23468 insertions(+), 14282 deletions(-)

Merging all that into the master branch took a huge pressure from me. After spending all that time I spend on working on KTouch it’s really important to me get the fruits of my work out to the end-users. Getting my stuff in the the branch KDE SC 4.10 will be released from is first the important step towards that goal.

My next step is clearing out the Bugzilla entries against KTouch. The vast majority of the bug reports can be closed since they don’t apply anymore, and also a fair share of the reported wishes are met by the new version.

KTouch Got a New Score Screen

| Comments

So after finishing a lesson that’s that the user is going to see now:

With the help of the screen the user can review his learning progress and identify his weaknesses. For that a bar diagram visualizing the errors he has made during the training can be summoned:

If he has passed the lesson he may choose to start training on the next lesson right away. Otherwise he can repeat the current lesson or return to the home screen.

The score screen was the last large outstanding feature I am targeting for the initial release. With that one done only a few small ones remain I can easily finish until the Feature Freeze on October 25. So it looks like the new version of KTouch will be actually released with KDE SC 4.10 on January 23, 2013.

Line Graphs for Qt Quick

| Comments

After finishing the keyboard layout editor here in Randa I’ve started working on the last remaining big task of the upcoming new version of KTouch: the summary screen which will be shown after the user has completed a lesson. For that I want to display the user’s learning progress with pretty diagrams. As there are no ready-made components for Qt Quick for that purpose right now, I’ve sat down and started to implement my own:

My QML component to render such graphs is actually pretty generic. Here is the complete code for the screenshot above:

import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.ktouch.graph 0.1 as Graph
import ktouch 1.0

Rectangle {
    width: 800
    height: 300
    anchors.centerIn: parent
    color: "white"

    Column {
        anchors {
            fill: parent
            topMargin: 2 * spacing + legend.height
            leftMargin: spacing
            rightMargin: spacing
            bottomMargin: spacing

        spacing: 20

        Graph.LineGraph {
            width: parent.width
            height: parent.height - legend.height - parent.spacing
            model: learningProgressModel

            dimensions: [
                Graph.Dimension {
                    id: accuracyDimension
                    dataColumn: 5
                    color: "#ffb12d"
                    maximumValue: 1.0
                    label: i18n("Accuracy")
                    unit: "%"
                    unitFactor: 100
                Graph.Dimension {
                    id: charactersPerMinuteDimension
                    dataColumn: 6
                    color: "#38aef4"
                    maximumValue: 400
                    label: i18n("Characters per Minute")

        Row {
            id: legend
            anchors.horizontalCenter: parent.horizontalCenter
            spacing: 20

            Graph.LegendItem {
                dimension: accuracyDimension
            Graph.LegendItem {
                dimension: charactersPerMinuteDimension

The model used as the data source for the graph—learningProgressModel—is just a normal QAbstractTableModel descendant.