jump to navigation

Subsurface – What the heck? November 29, 2013

Posted by tumaix in planetkde-tomazcanabrava.

It’s well known fact that the Linux mascot is a penguin, named Tux, but did anyone wondered how did the tux became the linux mascot? I’ll tell one thing about Linus Torvalds, He likes to Dive. I mean, he really likes to dive. and Penguins also dive. Proof?


 So Linus was diving around and realized that Linux didn’t have a proper Opensource Software for organizing Penguins sightseeings, What he did? He wrote one. That’s what subsurface is all about. A Dive Log application from Divers, for Divers that works on Linux ( And on Mac and Windows too ). It supports acquiring the dive – data from most of the dive computers that are selled around the world via the awesome libdivecomputer, and also is pretty sleek. It was mainly written in Gtk till version 3.0, but now it’s ported to Qt ( 4.0 for the time being, since we rely on marble for the globe ) but plans for 5.x are being discussed.

But since Subsurface is not a ‘KDE’ app, why the hell it’s here on planetkde?

  1. I’m syndicated, yeah, really.
  2. We use KDE Code ( had to fork some classes because didn’t want to rely on the whole kdelibs just for 2 little widgets, but I’m mainly sure this will change in KF5 )
  3. We use Marble
  4. KDE is about the People that creates code too. 🙂

And While we prepared Subsurface we also killed a few Qt and Marble bugs ( upstreamed ), what about that?

If you are a diver, If you are a wannabe diver, if you know someone that dives, Tell them that there’s an awesome Dive Logging Application

More information? Go to the subsurface webpage.

Subsurface Switches to Qt November 28, 2013

Posted by tumaix in planetkde-tomazcanabrava.

It’s been a long, long while since I don’t blog here, and most of my old blogposts were about Rocs, well.. not anyomore. I joined the Subsurface team about six months ago. It was a program written in Gtk mostly by Linus Torvalds and Dirk Hohndel, and they were opened to switch to Qt, why… why shouldn’t we jump ahead and help the transition to be smooth as it could? So Thiago Macieira and Myself jumped in to help, And it’s been a lot of learning from all sides.

It’s been quite a while – but we have been hard at work. We have migrated Subsurface from Gtk to Qt over the past 6 months. And given the magnitude of this change, we decided to go with a public beta (or two, or three, depending on how things go) before releasing Subsurface 4.

New in version 3.9.1 (compared to Subsurface 3.1):

I don’t even know where to begin. This is a complete rewrite of the UI. The basic concepts are the same, most of the basic features are the same, but trying to create a concise list of changes that summarizes the more than 1200 commits that have gone in since 3.1 seems a daunting task.

Maybe we’ll come up with something better in time for the final release of Subsurface 4.0. 🙂

Known issues:

  • integration with divelogs.de is still missing
  • we have reports of occasional crashes on Windows when trying to close the window by clicking on the little x in the window decoration instead of using Alt-F4, Ctrl-q, or File->Quit
  • Filter->Select Events is not implemented
  • Translations are extremely incomplete
  • Documentation has just been started

These last two points are important. Because if you have always wondered “oh I wish I could contribute, too bad I can’t program” – this is your chance. ANYONE can help us with Documentation, and almost anyone (ok, this
does require that you speak a language besides English) can help with translations. Please send us email at subsurface@hohndel.org if you would like to contribute.

You can find Windows and Mac binaries at the usual downloads location. Linux users are more likely to have to build from source. Get the source from git and follow the instructions in the INSTALL file (not from this website, those are still for the Gtk version).

A few words from Dirk:

Working with the Qt community has been a blast.
+Linus Torvalds still may not be a huge C++ fan – but even he submitted C++/Qt patches. Who would have thought.



How cute can modeling be ? November 18, 2013

Posted by Sandro Andrade in planetkde-sandroandrade, planetqt-sandroandrade.

Heya planet,

It’s been a long time since my last post (as usual 🙂 – hopefully that’s going to change in next months). A lot of things have happened in QtModeling land tough. In case you haven’t read my previous ‘call for arms‘ and ‘XMI serialization and metamodel plugins‘ posts, QtModeling is intended to provide a complete and flexible infrastructure for software (meta)modeling, (automated) architecture design and analysis, model recovery, and whatever comes in mind when you think about software models. Although we are still far from have those features fully available, some interesting capabilities are quite functional.

MOF/UML Metamodel Implementation

The new refactored templates for automatic metamodel implementation make programmatic model manipulation easier by taking ownership of properties with ‘composite’ aggregation and automatically removing elements from all involved property lists when it’s deleted. While Qt properties features described in QTBUG-17301 are still being considered, QtModeling extends Qt property system by defining roles for aggregation, opposite association ends, redefined and subsetted properties, and derived and derived union constructors. Some UML functionalities defined as derived properties/operations still miss implementation but basic features involving class and components diagrams are already in place. XMI serialization, profiles and stereotypes definitions/applications, and imported elements/packages are also currently available.

When building QtModeling, the following Qt Add-ons modules will be available:

  • QtModeling: defines base classes for model elements (QModelingElement and QModelingObject) and QXmiWriter/QXmiReader classes for XMI serialization.
  • QtModelingWidgets: provides two new model classes (QModelingObjectModel and QModelingObjectPropertyModel) and two new view classes (QModelingObjectView and QModelingObjectPropertyEditor) for manipulating models and model element’s properties.
  • QtUml: implements the full UML 2.4.1 metamodel. It comprises 239 classes which are 91.83% automatically implemented by templates. The remaining code represents derived properties and are being implemented on demand.
  • QtMof: implements the full MOF (Meta Object Facility) 2.4.1 metamodel. It comprises 51 classes also almost entirely implemented automatically.
  • QtDuSE: implements the DuSE language/metamodel (part of my PhD research) for automated software architecture design and analysis.
  • QtSADuSEProfile: defines an UML Profile for automated software architecture design of self-adaptive systems. This is required by SADuSE – a specific DuSE design space instance devoted to self-adaptive systems design.
  • Qt metamodel plugins: bind the previous model modules as Qt plugins used during XMI serialization.


DuSE-MT is a software modeling framework built on top of QtModeling which provide underlying mechanisms for defining new modeling languages (metamodels), creating models described in available languages (currently UML, MOF, and DuSE), manipulate models via JavaScript, and basic constructs for UML diagrams.


DuSE-MT defines a plugin-based architecture (shamelessly 🙂 inspired by Qt Creator’s one), which supports not only Qt metamodel plugins but also extensions implementing new DuSE-MT functionalities such as concrete syntax handling, architecture recovery, automated architecture design, and so on. One of the good things of being a professor is to have students eager to graduate 🙂 and willing to do their final projects in some Qt/KDE related project. Let’s see what happens …

DuSE-MT Plugins

Model Scripting

DuSE-MT’s JavaScript Console allows for defining scripts which might, for example, verify well-formedness rules and/or extend/change the currently opened model. For instance, if you know in advance you are going to use Java to implement the currently modeled system, you might use the following script to verify if any multiple inheritance was found in your model:

DuSE-MT JavaScript Console

While a full OCL parser isn’t already available, such kind of scripts can be really useful (actually it’s even more expressive than OCL since it’s not limited to read-only operations).

QML for UML Concrete Syntax

It’s really amazing how QML seems to be born to make certain things real without much pain 🙂 Even in such highly dynamic cases with many requirements for integrating with C++ objects, QML property binding and some new defined QML items can rapidly gives you some nifty diagrams:

DuSE-MT UML Concrete Syntax

Wondering how much QML code was required to do that ? Here it is:

import QtQuick 2.0

UmlElement {
    UmlSlot {
        id: nameSlot
        anchors.top: parent.top
        Text {
            id: label
            text: element.name
            anchors.centerIn: parent
    UmlSlot {
        id: attributeSlot
        anchors { top: nameSlot.bottom; topMargin: -1 }
        height: (parent.height - nameSlot.height)/2
        ListView {
            model: element.ownedAttributes
            anchors { fill: parent; margins: 4 }
            delegate: Text {
                text: visibility(modelData.visibility) + modelData.name + ": " + (modelData.type ? modelData.type.name:"<no type>")
    UmlSlot {
        anchors { top: attributeSlot.bottom; topMargin: -1; bottom: parent.bottom }
        ListView {
            model: element.ownedOperations
            anchors { fill: parent; margins: 4 }
            delegate: Text {
                text: visibility(modelData.visibility) + modelData.name
    function visibility(visibilityEnum)
        switch (visibilityEnum) {
        case 0: return " "
        case 1: return "+"
        case 2: return "-"
        case 3: return "#"
        case 4: return "~"

… and for UML associations:

import QtQuick 2.0
import QtModeling.Uml 1.0
import "util.js" as Util

Relationship {
    name: element.name
    relationshipType: "association"
    source: Util.findQuickItem(parent, element.memberEnds[0].class_.name)
    target: Util.findQuickItem(parent, element.memberEnds[0].type.name)
    sourceAggregation: aggregation(element.memberEnds[0].aggregation);
    targetAggregation: aggregation(element.memberEnds[1].aggregation);
    sourceMultiplicity: element.memberEnds[0].lowerValue.value + ".." + element.memberEnds[0].upperValue.value
    targetMultiplicity: element.memberEnds[1].lowerValue.value + ".." + element.memberEnds[1].upperValue.value
    function aggregation(aggregationEnum)
        switch (aggregationEnum) {
        case 0: return "none"
        case 1: return "shared"
        case 2: return "composite"

… where Relationship is a new QML item we implemented based on QPainter API (I still need to learn how to use the new SG API). With such things done, UML concrete syntax implementation becomes the simple creation of QML files with names matching the corresponding UML metamodel element (UmlNode, UmlState, and so on).


Supporting automated architecture design involves, among other things, the use of some search-based approach to find out several candidate architectures and then choose one that satisfies some specific quality attribute criteria. Elitist population-based algorithms have been successfully applied in such scenario because of their improved performance and fast convergence. If you’ve already played before with JMetal or some other framework for multi-objective optimization, that’s exactly what QtOptimization is intended to be. Currently, only NSGA-II (Nondominated Sorting Genetic Algorithm) is implemented (QNsga2 class), in conjunction with classes for bitwise mutation (QBitwiseMutationOperator), crossover (QCrossoverOperator), polynomial mutation (QPolynomialMutationOperator), simulated binary crossover (QSbxCrossoverOperator), and tournament selection (QTournamentSelectionOperator) operators.

Here is a brief description on how to use QtOptimization for a single-variable/two-objective optimization problem:

// Define objective function 1
class MyObjectiveFunction1 : public QObjectiveFunction
    explicit MyObjectiveFunction1(QtOptimization::OptimizationGoal optimizationGoal = QtOptimization::OptimizationMinimizes) :
        QObjectiveFunction(optimizationGoal) {}
    virtual qreal evaluateOnIndividual(const QIndividual *individual) const
        qreal x = individual->realVariableValue(0);
        return x*x;

// Define objective function 2
class MyObjectiveFunction2 : public QObjectiveFunction
    explicit MyObjectiveFunction2(QtOptimization::OptimizationGoal optimizationGoal = QtOptimization::OptimizationMinimizes) :
        QObjectiveFunction(optimizationGoal) {}
    virtual qreal evaluateOnIndividual(const QIndividual *individual) const
        qreal x = individual->realVariableValue(0);
        return (x-2)*(x-2);

QNsga2 nsga2;
MyObjectiveFunction1 *f1 = new MyObjectiveFunction1;
MyObjectiveFunction2 *f2 = new MyObjectiveFunction2;
nsga2.setObjectiveFunctions(QList<QObjectiveFunction *>() << f1 << f2);

nsga2.setSelectionOperator(new QTournamentSelectionOperator);
nsga2.setCrossoverOperator(new QSbxCrossoverOperator(0.9, 5.0));
nsga2.setMutationOperator(new QPolynomialMutationOperator(0.5, 10.0));

// Improve population by 250 generations
for (int i = 0; i < 250; ++i) {

We’re currently implementing some quality indicators for Pareto-fronts and finish integration of such features in DuSE-MT in order to support better automated architecture design and analysis.

So, interesting stuff coming … I’d really love to see those things effectively integrated in QtCreator, KDevelop, and Umbrello. If you are willing to join the effort, fell free to try it from gitorious and don’t hesitate to contact me if you face any trouble.

See you,