MADDE/QtCreator integration for linux

= QtCreator and MADDE on Linux =

This is a guide on how to enable MADDE in QtCreator. This is part of the technology preview. After following this guidance you are able to build your sources within QtCreator for your device, and deploy, run and debug your applications with few mouse clicks from your Linux installation (Ubuntu was used for this tutorial).

Requires:


 * MADDE installed on your Linux machine
 * If you want to compile your code natively then you have to have "make" installed on your machine. If it is not install yet you can do that with:

sudo apt-get install make

General advice
As this is a technology preview, remember that bugs can occur. If some of the components don't work as expected, please add your question to the talk-thread and follow up the discussion.

Install latest QtCreator on your Linux computer
'''You cannot use the latest official QtCreator for this. The version has to be >= 1.3.80! For these instructions the version of the 2010-03-04 is used!''' Find the latest build of QtCreator for Linux here:

http://qt.nokia.com/developer/qt-snapshots

Add Qt for Maemo5
You can change the configuration of the Qt-version in your QtCreator installation by clicking:

QtCreator -> Preferences -> Qt4 -> Qt Versions

Tip: If you do not see any Qt version by default here, you most likely haven't installed the needed Qt libraries to compile your Qt application for your Linux environment.

In the next step you have to add the Qt version for Maemo5 to the configuration of QtCreator. It is needed to compile your sources for your Maemo device. Click on the "+" in the upper-right corner. The configuration form will ask you to enter a "Version name" and to locate "qmake". You can find it in your MADDE installation folder under:

/targets//bin

For the standard installation it would be for example:

Version name: Maemo Qt4.5 qmake Location: /home/ /.madde/0.6.14/targets/fremantle-qt-0951/bin/qmake

Tip: You cannot find the folder if you click on "Choose...", as it is hidden. But after entering "/home/ /.madde/" in the text-field "qmake Location" you can select the rest via the "Choose..." button.



Now you will see Qt for Maemo as a new Qt Version in Qt Creator. But first you will see the red cross next to the Qt Version in the column "Debugging Helper". The last step you have to do now is clicking on "Rebuild" and after a while (you can follow the status in the QtCreator main window) it should look like this:



Configure device run-time in Qt Creator
After setting up the connection between your Linux computer and your device, you will be able to compile, deploy, test and debug your application with a single mouse-click. The description shows the configuration for USB-networking and WLAN and is for each divided into two parts. It shows:


 * what to install on device, and
 * how to set-up your Linux machine

General device set-up
Please find the instructions on how to set up the device runtime from here:


 * Install the client

Device configuration
The following guide shows you, what to do on your device to set up the USB connection. This has to be done before you connect your device with the Linux computer:


 * Configure the client for USB networking

Linux configuration
Connect the device with your Linux machine. Then you click on "PC Suite mode" as connection mode. Now you should be able to see the device as a new wired network connection named "Auto usb0". Now you can configure the connection as follows.

1. Open the network connection settings:



2. Change the method from "DHCP" to "Manual" and enter the details as shown in the screen-shot:



After you have done this your connection should be established and the set-up ready to be used with QtCreator.

Connect via WLAN
If both devices are connected to the same wireless network the configuration is a bit easier, but be aware that the IP address might not be the same all the time. This effects the set up of your QtCreator configuration.

Device configuration
Please open the mad-developer application. If you are connected already to the wireless network, you can find the IP address in the initial window of the application:



Linux configuration
Please just make sure, that your Linux computer and device are connected to the same network.

QtCreator Configuration
After the connection between your PC and the device is set up, you can configure QtCreator to deploy and run the built applications on device. You can add your device in the configuration. You will find it in:

QtCreator -> Preferences -> Qt4 -> Maemo Device Configurations

First get the password from the Mad Developer application. You get it by clicking on "Developer Password" in the main view. Be aware that each time you click on the button, a new password will be created and that the password is only valid for the time it is shown in the application.



Instructions for USB-network
Add the password and all the data you see in the screenshot below. Check the box, that you want to use the password as the authentication method. After that click on "test" and see if the connection can be set up.



Instructions for WLAN
If your device is using the WLAN interface, please enter the IP address you can see in the mad-developer application on device.



Tip You can use your ssh key for the connection. Click on "Deploy Key ..." and select your key. If the other settings are correct the key will be automatically deployed on your device, so that you don't have to worry about the passwords anymore.

Deploy SSH key
If you have already created a key for other purposes you don't have to create a new one and you can ignore the description on how to create the key and just continue with the deployment of the key.

Create a key
To create a key please open terminal and run:

ssh-keygen -t rsa -b 1024

Then please follow the instructions. If you don't choose a new location, the key will be stored in the standard location in the home folder (recommended). The terminal should look like this:



Deploy the key from QtCreator
To be able to connect to your device by using the key, you have to:


 * deploy your public key on your device, and
 * specify in QtCreator, where to find the private key

You can configure these settings in the Maemo Device Configurations

Tools -> Options... -> Qt4 -> Maemo Device Configurations

Note:  For these steps your device has to be connected to the PC and the password has to be valid. By clicking "Test" button, you can check if that is the case.

Now you click on "Deploy..." and select the public key you have created before.



Once the key is deployed correctly you can set up your device-configuration to use the key to connect to the device. Change now the "Authentication type" from "Password" to "Key".



Now click on "Apply" and your QtCreator installation is set up to connect to the device via SSH key.

Use Maemo5 build settings
Now all the configuration is done and you can select Maemo as a build configuration. If you have a project, which you want to compile for Maemo, then click on the project button in the menu of the left side. Now you should seen a screen, like in the screen shot below. If you have the Qt libraries installed, then you will have the "Desktop" as the default option selected.



Tip:


 * It might be that you don't see the "Desktop" widget in your project configuration. In this case it might be that the configuration of the MADDE is not correct, or that a little bug prevents the widget from showing up. In this case click on "Dependencies" and then go back to "Build".


 * If you start a new project you can add the Maemo build-configuration at the beginning:


 * [[Image:13_linux_start_new_project.png|300px]]

Now press the plus in the widget, which shows, that "Desktop" is selected as default. This should open a new dialog, where you select "Maemo". After that you will find a new build-configuration. Now click in "Maemo" on "Run" and select your device, which you have configured before. In the example it was called Maemo 5.



Finally you can now set in the down left corner, which build configuration you want to use:



Now you can click on the run button, and your application will be automatically compiled for the Maemo device, delpoyed, and started.