Development in QtCreator for Maemo SDK

    Some time ago, Qt4.6.2 was released for Maemo. Under the cat, instructions are expected on how to install the SDK in Linux Debian and configure the development environment for Qt (based on QtCreator).

    Installation


    So, the first thing we need to download scripts to install the SDK. This is done by the commands:
    wget http://repository.maemo.org/stable/5.0/maemo-scratchbox-install_5.0.sh 
    wget http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh 

    We expose them the right to execute:
    chmod + x ./maemo-scratchbox-install_5.0.sh ./maemo-sdk-install_5.0.sh

    And we launch the first one under the root indicating the user who will be given access to the sandbox with the SDK:
    sudo ./maemo-scratchbox-install_5.0.sh -u tass

    The script will install the “sandbox” through apt, and he will install it in / scratchbox. I was not happy with this state of affairs, and I made this directory a link to / home / scratchbox (due to the constant lack of space on the root partition).
    Also, the script will add the specified user to the sbox group , but in order for it to be visible in this group you need to either log in or simply tell the system that we are in it:
    newgrp sbox

    Now run the second script:
    ./maemo-sdk-install_5.0.sh

    Now we need to go into the "sandbox" and put the necessary packages on the emulator.
    Logging in is simple:
    / scratchbox / login

    In order to download packages, we first need to confirm our agreement with EULA . After confirmation, the site will give us a line similar to
    deb http://repository.maemo.org/ fremantle / 0123456789abcdef0123456789abcdef nokia-binaries

    In the “sandbox” we need to add it and another line to the /etc/apt/sources.list file
    deb http://repository.maemo.org/extras-devel/ fremantle free non-free

    Now we are ready to deliver packages:
    apt-get update
    fakeroot apt-get install nokia-binaries nokia-apps libqt4-maemo5 *

    Upon completion, we have a Maemo emulator completely ready for development.

    Launch


    To run, we need Xephyr:
    apt-get install xserver-xephyr

    Now run it
    Xephyr: 2 -host-cursor -screen 800x480x16 -dpi 96 -ac &

    A black 800x480 window will appear on the screen.
    Now you need to start the Maemo environment, for this, log in to the sandbox and execute the launch script:
    / scratchbox / login
    export DISPLAY =: 2
    af-sb-init.sh start

    The n900 desktop will appear in the black window of Xephyr (I advise you to leave the English language, since the Russian translation is incomplete for some reason and many labels will be displayed by their identifiers). There is also a certain problem with the colors (sometimes where the blue color should be orange, the icons have a "ribbon" on top and other similar artifacts. But this does not affect the overall work and you can test the applications fairly well).

    QtCreator


    I’ll clarify right away that all development should be done in the user's home folder in the “sandbox”, so that you can reach the necessary files from within the “sandbox”.
    Afaik full support for Maemo (and MADDE) is only available in self-assembled creators, but I use snapshots that have menus for choosing a Maemo device, but there’s nothing more to do. Well, yes this is not a problem, the assembly and launch of the project can always be completely reconfigured to custom steps. This is what we will do.
    First, we need a script in our home directory in the sandbox that will allow us to run applications in the sandbox.
    Create an sbox-run file with the following contents:
    #! / bin / sh -l
    # go to directory given as first arg and execute rest of the args there
    cd $ 1
    shift
    # export here environment variables required by the command to execute
    export DISPLAY =: 2
    $ *

    This script takes the first argument the directory where you want to execute the command and the rest of the parameters what you need to execute (that is, for example, the name of the binary with the parameters of this binary).
    We also need a mechanism to run this script from outside the sandbox. A script called sbox-command is included in a small set of sbox-utils utilities, a link to which is at the end of the article. The script takes the same parameters as above.
    Run QtCreator and create a new project. We need to change all the steps of assembling, cleaning and launching to proxy calls through sbox-command. Doing this a little tedious every time, so another create-qtc-project-file script was written, which is also in sbox-utils. It must be run in the project folder without parameters and it will create a .pro.user file with minimal settings for QtCreator.
    Now you can safely use QtCreator as a development tool for Maemo (do not forget to first run Xephyr and the Maemo environment through the commands mentioned above). The only thing that is not covered by this setting is debugging, but in this direction I just haven’t digged yet.

    Qt test application in desktop and maemo environments


    A test application was also written quickly without any logic (only the designer was used) to compare the display of applications on the desktop and in Maemo. Below are his screenshots.
    Application itself:



    Open application menu:



    References


    sbox-utils
    test application sources

    Also popular now: