1. I have been meaning to try QML for a while, and a couple of weeks ago I managed to finally do it, the result being a simple memory game for small children, a clone of the GCompris railway activity. In this post I'll summarize my short experience with Ubuntu click app development.

    TL;DR


    QML + Javascript is the easiest way I have seen so far to program a small interactive app. The extra tooling I did not test, I used vim and click from the command line. Documentation is so and so. App deployment and installation on Ubuntu for Phones is working well enough, even if is has rough edges.

    The game itself

    The game is about watching cartoon trains composed of a locomotive and a small number of different wagons scroll on the screen and then trying to reconstruct them from memory. There are no written or spoken instructions given. Let figuring out the rules be part of the game :)

    Unlike GCompris, this clone works with touch input, the lack of availability of a touch-based railway game being the secondary motivation behind the exercise :) All sounds and most images, much like the game idea are lifted from GCompris and credited accordingly.

    If you're impatient and happen to have Ubuntu running on a phone but preferably on a tablet you can install it by searching for 'railroad' in the application screen. If not, apt-get install gcompris :)

    The source code with full non-rebased git history is here, GPLv3 licensed
    https://github.com/janimo/railroad

    File issues there if you find a bug or want a feature.

    QML and QtQuick

    I finally found out that QML stands for only the Javascriptish language and runtime, while QtQuick is the core of the 'stdlib' that comes with Qt/QML, itself mostly written in QML.

    This combo is surprisingly pleasant to work with, yielding quick results from a comparatively small effort and few lines of code. The built in support for animations and multimedia in QtQuick and the reactive programming feature of property binding in QML were all very welcome. As things evolved though, I often found myself having to and even wanting to move most of the logic into a separate JavaScript file and give up on some the nice declarative features given by QML. For example it turned out that while a Grid that would automatically lay out train images given the number of rows and columns to use was very convenient and concise, I eventually used a dumb Rectangle as the container and calculated x and y explicitly for each train as they did in the 70's in order to have more control over where they end up to match the SVG background image.

    This is not unusual, I understand that the idea of using QML only for the graphics and doing the rest in C++ is a popular view among developers with experience. IMHO that is very bad idea to hold onto though if you want to encourage quick prototyping and having a chance to compete with Android or FirefoxOS for developer's attention. There will always be a need for code that cannot or should not be done in QML, but that should be the exception, and even then I'd rather see Go-QML be the glue between QML and the OS. That too relies on C++ but mostly hides it along with the build system from the developer.

    Tooling

    In order not to learn too many new things at once, and to avoid pitfalls unrelated to actual programming I decided to just use vim to edit and qmlscene to test and run the app.
    The only change in vim's configuration was adding syntax highlighting for QML via this snippet in ~/.vimrc

    Bundle 'peterhoeg/vim-qml'

    and then running the BundleInstall vim command.

    It's that easy since I started using  Vundle :)

    I find the Click packaging format refreshingly simple and to the point.

    Documentation

    I used the official Qt documentation site mostly. It is comprehensive but not easy to navigate, it is a collection of rather disconnected islands covering QML, QtQuick, etc, but with quite some overlapping content. I used the in-site search functionality often, and even global googling to find me something on the site I was already on :) Regarding the Ubuntu documentation I agree with all that Stuart had already said

    App building and deployment

    I used the click command line tool on the development computer to build the click package.
    I may have missed out on important packaging scaffolding and validation tools since I did not use the SDK. I wished I could do click newpackage and later click check (or using equivalent tools if not click itself) to get a basic skeleton working and to catch errors such as malformed developer email address, before uploading.  I found out about reviewer-tools only recently.

    The link I followed on the Ubuntu app developer site to publish the already built click package turned out to be the wrong one and non-working, but only after going through the 5 page wizard. I _think_ this is fixed now.
    The app was let into the appstore no more than 30 minutes after it being uploaded the first time. There was a need for a second time and for the obligatory version bump in order to correct the email address typo mentioned above.

    So while these steps seemed confusing it can be partly ascribed to me being new to it all.

    App install and update

    Since I still find the Ubuntu phone interface and navigation confusing and since there are still bugs in the implementation I spent too much time trying to get the app installed by it not showing up in search, or a stubborn on screen keyboard hiding the Install button from view when I found it.
    I made a minor bugfix release of the game yesterday (0.1.2) but I am not sure how to upgrade to it on the device. Still lots of things to learn about and fix on Ubuntu for phones :)
    0

    Add a comment

Blog Archive
About Me
About Me
Loading