More foss stuff

It is busy days at the moment – but in a positive way.

First of all – a huge thanks to everyone who submitted to the Call for Papers for foss-north 2020. We have over 70 hours (!!!) of contents to squeeze into two tracks over two days. As always, it will be hard to pick the speakers to create the very best program.

Other foss-north activities includes starting to populate the community day activities, as well as getting a whole bunch on sponsors onboard. An extra big thanks to Luxoft and Red Hat Ansible for helping us by picking up the Gold Sponsorship packages. Ansible are even running their European Contributor Summit as a part of the foss-north Community Day together with events by KDE, Gnome, FreeBSD, Debian, and a hardware hacking workshop. I’m really looking forward to this – if you want to join in with your own project, workshop, hackaton, etc – just ping me!

The other big foss-north change for this year is that we are finally abandoning Eventbrite for a self-hosted system. Big thanks to Magnus Hagander helping us getting the pgeu-system up and running. At the moment, we offer login via Github and Google OAUTH. We’re looking into setting up a self-hosted OAUTH service as well, to let you log in locally, but that will not happen for the 2020 event due to time reasons.

Closer in time is the next local foss-gbg meetup. We are running an event around React together with our good friends at Edument. We already have 50+ registered attendees, so it will be fun!

In other news – I’ve also released Ordmonster – if anyone has kids who wants to get started reading. This is a complement to the Mattemonster app for basic maths launched earlier. Both are made with Godot, a tool that I enjoy more and more.

gbgcpp – Ribbons using Qt

I’ve been involved in the gbgcpp group, a part of the larger Sweden C++ community, for a couple of years. It is fun to see that there is a lot of C++ developers out there, once you start looking for them.

In the next meetup, this Wednesday, there will be both C++ and Qt. The topic is to implement Ribbons in Qt, based on a seminar by Dag Brück. If you happen to be in the vicinity of Gothenburg, I recommend you to go there!

I’d also like reach out and thank Sylog for hosting the event!

foss-north 2019: Community Day


I don’t dare to count the days until foss-north 2019, but it is very soon. One of the changes to this year is that we expand the conference with an additional community day.

The idea with the community day here is that we arrange for conference rooms all across town and invite open source projects to use them for workshops, install fests, hackathons, dev sprints or whatever else they see fit. It is basically a day of mini-conferences spread out across town.

The community day is on April 7, the day before the conference days, and is free of charge.

This part of the arrangements has actually been one of the most interesting ones, as it involves a lot of coordination. I’d like to start by thanking all our room hosts. Without them, the day would not be possible!

The other half of the puzzle is our projects. I am very happy to see such a large group of projects willing to try this out for the first time, and I hope for lots and lots of visitors so that they will want to come back in the future as well.

The location of each project, as well as the contents of each room can be found on the community day page. Even though the day is free of charge, some of the rooms want you to pre-register as the seats might be limited, or they want to know if they expect five or fifty visitors. I would also love for you to register at our community day meetup, just to give me an indication of the number of participants.

Also – don’t forget to get your tickets for the conference days – and combine this with a training. We’re already past the visitor count of the 2018 event, so we will most likely be sold out this year!

TableView and Qt 5.12 / Qt Creator 4.8

I finally got around to doing the final merge for QmlBook this year.

I just merged the chapter on the brand new TableView. This let’s you show 2D data tables in an efficient way.

I also merged the version upgrade, so the text should now reflect what is available from Qt 5.12 and be based on menus and screens from Qt Creator 4.8.

During this update of the text, we took the decision not to upgrade all import statements to QtQuick 2.12. Instead, we use different versions in different places. However, the contents of Qt 5.12 is covered.

There are still two things left for the 5.12 branch. The first is to use the new input handlers, e.g. TapHandler instead of MouseArea. The second is to setup a release branch in the CI system so that there is a 5.12 version of the book built separately. I suspect that this will force me to learn more Travis tricks :-)

Merging QmlBook Contents

What better way to spend a lazy Christmas day than to merge some of the new chapters to the QmlBook?

Since having updated the CI system, there is a bit of manual merging forth and back to get each new piece of contents on-line. Specifically, rebase my fork’s master to upstream/master, then rebase my working branch on my master, and then pushing.

One of the newly added chapters cover Qt Quick Controls 2, which is the recommended way to create controls such as buttons, sliders, checkboxes, menues, and so on. Here we look at how you target various form factors such as desktop and mobile, but also how to maintain a common code base between the two.

The other new chapter has a look at Qt for Python from a QML perspective. This chapter goes from the very basic all the way to exposing a Qt model representing the data of an existing Python module to QML.

QmlBook gets CI/CD

Christmas is coming and a long and exciting fall is coming to and end. One of my projects during this fall has been to update the QmlBook. This was made possible by The Qt Company who generously stepped in and sponsored my work on this – thank you all!

I’ve worked away during the fall adding a whole bunch of new contents and the documentation people over at The Qt Company has joined in and helped with a language review. One frustrating aspect of the QmlBook project has unfortunately been that the CI/CD system has been broken for a very long time. This means that even the small typo fixes made over the past months has not made it beyond the source git repository.

All this changed tonight! After fighting with Travis, trying to understand why things around Sphinx Docs has broken, realizing that Travis has quirks – as has the old QmlBook deployment setup, I could finally merge pull request #221 – Implementing CI/CD (and then fiddled around with the last quirks). Big thanks to my co-author, Jürgen Bocklage-Ryannel, who reviewed and helped me through this.

To celebrate this, I took the liberty of changing the style of the page. This way, you will recognize that you are browsing the new, updated QmlBook.

There were unfortunately a few sacrifices made during this transition. We lost support for generating QtHelp (it can most likely be fixed) and we dropped support for translations during a transitional period. There is a plan for both translations and different parallel versions of the book. The idea is to tune each version of the book to a specific Qt version.

To sum things up: expect broken links. Expect missing contents. But know that the contents is up-to-date!

Now – go enjoy Christmas! God Jul på er alla!

Working on QML Book

Do you remember QML Book? It started as a project between me and Jürgen Bocklage-Ryannel where we tried to fix the problem that there is no QML book out there.

Back in the Qt 5.2 days, we spent wrote about a year. Unfortunately, the project has mainly been sitting idle since then. I’ve poked at issues every now and then, and Jürgen has done various fixes as well.

Thanks to The Qt Company, this is changing. This autumn, it sponsors me to work on the project. The current plan is to add a chapter to Qt Quick Controls 2, and to update the entire contents to Qt 5.12 and Qt Creator 4.8. By doing so, many of the remaining bug reports will be resolved.

Other things in the backlog are getting the CI system back into shape and having a native speaker edit the language. All in all, this will result in an up-to-date book on QML. If you want to help out, just reach out to me or send me your pull requests. All help is welcome!

QML Weather

I recently took some time to develop a photo frame style home automation control panel. The idea is to control some common tasks of my home assistant setup from a panel instead of having to rely on the phone. To hide the panel, it currently act as a photo frame until touched.

The build is based on a Raspberry Pi 2 with the official touch screen attached and a USB wifi dongle. Nothing fancy, but still good enough.

One of the features that I wanted was a weather forecast, so I decided to use Yr’s xml weather as a base for this. The result is the YrWeatherModel QML item.

The weather forecast overlay.

The presentation side of things is the fairly straight forward piece of QML shown below, resulting in the overlay shown above.

Row {
    anchors.bottom: dateText.bottom
    anchors.right: parent.right
    anchors.rightMargin: 40

    spacing: 20
    Repeater {
        delegate: Column {
            spacing: 2
            Text {
                anchors.horizontalCenter: parent.horizontalCenter
                color: "white"
                font.pixelSize: 16
                font.bold: true
                text: {
                    switch (period) {
                    case 0:
                        "00 - 06"
                        break;
                    case 1:
                        "06 - 12"
                        break;
                    case 2:
                        "12 - 18"
                        break;
                    case 3:
                    default:
                        "18 - 00"
                        break;
                    }
                }
            }
            Image {
                anchors.horizontalCenter: parent.horizontalCenter
                source: symbolSource
            }
            Text {
                anchors.horizontalCenter: parent.horizontalCenter
                color: "white"
                font.pixelSize: 16
                font.bold: true
                text: precipitation + "mm"
            }
            Text {
                anchors.horizontalCenter: parent.horizontalCenter
                color: "white"
                font.pixelSize: 16
                font.bold: true
                text: temperature + "°C"
            }
        }

        model: weatherModel.model
    }
}

This is followed by the model itself, and a small notice of the data source.

YrWeatherModel {
    id: weatherModel
    place: "Sweden/V%C3%A4stra_G%C3%B6taland/Alings%C3%A5s"
}

Text {
    anchors.bottom: parent.bottom
    anchors.right: parent.right
    anchors.bottomMargin: 5
    anchors.rightMargin: 40
    text: weatherModel.dataSourceNotice
    color: "white"
    font.pixelSize: 16
    font.italic: true
}

Diving into the model itself, we hit the interesting parts. The structure looks like this:

Item {
    id: root

    property alias model: weatherModel
    property int refreshHour: 1     // How often is the model refreshed (in hours)
    property int dataPoints: 6      // How many data points (max) are expected (in 6h periods)
    property string place           // Place, URL encoded and according to Yr web site, e.g. Sweden/V%C3%A4stra_G%C3%B6taland/Alings%C3%A5s
    readonly property string dataSourceNotice: "Data from MET Norway"

    ListModel {
        id: weatherModel
    }

    Timer {
        interval: 3600000 * root.refreshHour
        running: true
        repeat: true
        onTriggered: {
            _innerModel.reload();
        }
    }

    XmlListModel {
        id: _innerModel

        query: "/weatherdata/forecast/tabular/time"

        source: (place.length === 0)?"":("https://www.yr.no/place/" + root.place + "/forecast.xml")

        XmlRole { name: "period"; query: "string(@period)" }
        XmlRole { name: "symbol"; query: "symbol/string(@number)"; }
        XmlRole { name: "temperature"; query: "temperature/string(@value)"; }
        XmlRole { name: "precipitation"; query: "precipitation/string(@value)"; }

        onStatusChanged: {
            // ...
        }
    }
}

As you can see, the model consists of an inner model of the type XmlListModel. This model is refreshed by a timer (don’t refresh too often – you will most likely be auto-banned by Yr). At the top, there is also a ListModel that is the actual model used by the user interface.

The reason for the ListModel to exist is that I wanted to be able to limit how many data points I show. Each data point represents a six hour window, and I’d like 6 of them, i.e. one and a half day of forecasting.

The onStatusChanged handler in the XmlListModel takes care of this in the following for loop:

onStatusChanged: {
    if (status === XmlListModel.Ready)
    {
        for(var i = 0; i< root.dataPoints && i < count; ++i)
        {
            var symbol = get(i).symbol;
            var period = parseInt(get(i).period);
            var is_night = 0;

            if (period === 3 || period === 0)
                is_night = 1;

            weatherModel.set(i, {
               "period":period,
               "symbol":symbol,
               "symbolSource":"https://api.met.no/weatherapi/weathericon/1.1/?symbol=" + symbol + "&is_night=" + is_night + "&content_type=image/png",
                "temperature":get(i).temperature,
                "precipitation":get(i).precipitation
                });
        }
    }
    else if (status === XmlListModel.Error)
    {
        console.warn("Weather error")
        console.warn(errorString());
    }
}

As you can tell, this code has *very* limited error handling. It is almost as it has been designed to break, but it works. The code also shows how convenient it is to connect to online services via QML to build simple, reusable, models that can be turned into beautiful user interfaces.

Next time I have some free time, I’ll look at interfacing with the public transport APIs. Then I will have to deal with JSON data and make explicit XmlHttpRequest calls.

Five days left

I use to joke that the last week before foss-north is the worst – everything is done, all that is left is the stress.

This year, we have the broadest program yet. 25 speakers talking about everything from community policies, GPU isolation, blockchain, historical KDE software, retro computers, IoT, Android, SailfishOS, bug triaging, crowd funding, software updates, yocto, home automation, design to sub-atomic particles.

You can still get a ticket (and make sure to bring a friend) at foss-north . Welcome!

foss-north – the count down

At this year’s foss-north event FSFE will revive the Nordic Free Software Award and the conference will host the prize ceremony. Get your tickets for a great opportunity to meet with the FOSS community, learn new things and visit Gothenburg.

It is just 9 more days left of the Call for Papers. With the help of our great sponsors we have the opportunity to transport you to our conference if you are selected to speak. Make sure to make your submission before March 11 and you are in the race.