Comments, Code and Qt. Some words about the wonderful world of software engineering

5Sep/128

How to set up a desktop development target to contribute to Nemo apps

If you want to contribute to the Nemo Mobile apps, you might feel like me in the beginning: a bit lost about where to start and what's needed in order to set up a development environment. Nemo has already quite a detailed wiki page, but I felt like something was missing for a n00b like me. But thanks to w00t I managed to set up a development environment on my Ubuntu desktop so that I can compile and run the Nemo QmlContacts  application. This blog post will hopefully clarify what's needed in order to contribute to Nemo apps in general. Oh, and this is for Ubuntu Linux. In this blog post I will only go through installing the QmlContacts application. But I imagine the other Nemo apps requiring similar steps.

Why a desktop development target?

As described on the Nemo wiki page and also in Vesku's blog post, you can create your own applications for Nemo using the Harmattan target readily available in QtSDK. But the Nemo apps have some extra dependencies that you need to fulfill and adding them to the Harmattan target requires some additional work. Also developing directly for the desktop is just easier. So let's get started.

 Setting it all up

It's worth noting that the components mentioned below are available from multiple sources. But the versions can vary and some patches are required that are available in the repositories mentioned below. So until we get a Nemo SDK, it's just best to go with the flow and use these repositories 😉

Qt

First you obviously need Qt. You want to use Qt 4.8.1 (or later 4.x). It probably doesn't matter how you install it, but I used the Qt SDK in which case I needed to add that Qt version to my PATH. Qt SDK can be fetched from http://qt.nokia.com/downloads/sdk-linux-x11-32bit-cpp-offline.
echo export PATH=$PATH:$HOME/QtSDK/Desktop/Qt/4.8.1/gcc/bin >> ~/.bashrc
source ~/.bashrc

Qt Mobility

Use the latest snapshot of Qt Mobility from Git. The latest released and packaged version (version 1.2.0) won't work. For QmlContacts you need the contacts and the versit modules.
git clone git://gitorious.org/qt-mobility/qt-mobility.git
cd qt-mobility
./configure -prefix /usr -modules "contacts versit"
make
sudo make install
cd ..

Qt Components

You need the Qt Components from the Nemo Mobile repository. If you already haven't, you also need to install the OpenGL development package for X11 as Qt Components requires that. Then you want to configure Qt Components to build the MeeGo components. You will see a warning while doing so, but that's ok. And when you compile it with make, at least I got a compilation error while compiling the tests. But that's ok, we don't need them.
git clone https://github.com/nemomobile/qt-components
sudo apt-get install libgl1-mesa-dev
cd qt-components
./configure -meego
...
“Project WARNING: mlite is not available; theme detection won't work”

make
...
tst_mlocalthemedaemonclient.cpp: In member function ‘void tst_MLocalThemeDaemonClient::init()’:
tst_mlocalthemedaemonclient.cpp:128:71: error: no matching function for call to ‘MLocalThemeDaemonClient::MLocalThemeDaemonClient(QString)’
...
sudo make install
cd ..

Qt Components theme

Qt Components needs a theme to work with. We'll use Nemo's default theme which is a fork of the MeeGo Harmattan theme. The install instructions below are taken from Sage's blog post, but for the sake of completeness, I'll copy them here as well [I used a Git URL that points to Nemo's GitHub repo].
git clone https://github.com/nemomobile/meegotouch-theme-darko.git
cd meegotouch-theme-darko
sudo mkdir /usr/share/themes/darko
sudo cp -r meegotouch/ index.theme /usr/share/themes/darko/
sudo cp -r blanco/ /usr/share/themes/
# Blanco has links to meegotouch which we add from darko theme
sudo ln -s darko/meegotouch /usr/share/themes/meegotouch
cd ..

Nemo QML Plugins

Nemo QML apps have a set of shared C++ plugins. The project currently depends on the qrencode library (could be more dependencies in the future) for QR code reading, so we need to install it as well.
git clone https://github.com/nemomobile/nemo-qml-plugins
sudo apt-get install libqrencode-dev
cd nemo-qml-plugins
qmake
make
sudo make install
cd ..

Nemo QmlContacts

We've finally installed all the dependencies and now it's time to install the Nemo app that we want to develop. In this case I am using the QmlContacts application. The QmlContacts application provides its own API (org.nemomobile.contacts) and plugin, so we need to do a install before we run the application for the first time (and of course after we make changes to the QmlContacts plugin). It's easiest to do this from the command line, but after the initial install, we can build and launch the app from Qt Creator as well.
git clone https://github.com/nemomobile/qmlcontacts.git
cd qmlcontacts
qmake
make 
sudo make install
cd ..
And now you can open the qmlcontacts project in Qt Creator, do a rebuild and run it! Happy hacking!

Technorati Tags: , , , , ,

  • mbo

    Thanks!

  • Appreciate the post. Small request though if you feel like extending the tutorial ? How about small modification and installing to non-default destination so that keep qt stuff out of possible os versions of the libs ? Not very likely scenario but benefit would also be easier uninstallation/upgrade/version testing process.

    Ps. Nice favicon 😉

    • Well, yes I see your point. But as far as I recall, the only component installed into the system dirs is Qt Mobility (as I specify the /usr as prefix). You could install that also under your Qt installation in your $HOME (sorry, can’t say the exact dir of the bat :)). The other components are installed already under your Qt installation dir.

      Except, of course, for the theme. That path is (for now at least) hard coded. Sorry, don’t know why. But it’s probably related to the fact that I did not install any MeeGo Touch Framework components in which case the theme would be (possibly) detected where ever MTF is installed.

  • A little error :

    In “Qt Components theme section” ,

    cd meego-theme-darko

    should be :

    cd meegotouch-theme-darko

    • Yep, thanks for pointing this out! Fixed.

  • cckwes

    Thanks, it’s very useful

  • MMrriicc

    cool, this was usefull 🙂