Nokia Qt SDK, we write the first application and run it in the emulator and on the device

    Kind time of day I continue to write about the Maemo platform (so far for Maemo Fremantle). This article focuses on the news in the world of Nokia - the Nokia Qt SDK. So far this is TP (Technical Preview, it has been trying to translate into Russian for a long time, it did not work, so “TP” will be empty hereinafter). But writing on this is already possible, but there are a few caveats. Details are further in order. I’ll also tell you more about MADDE, since it is this part of the Nokia Qt SDK that is responsible for the development for Maemo.

    image

    As a result, we will write the application (very loudly said :-), generally speaking, the application), collect and run it on the emulator and on the device (more precisely, on the Nokia N900). Anyway, we’ll figure out what and how to write for Nokia devices now and in the future.



    First of all, let's figure out what's what. Who for what and why released the Nokia Qt SDK.
    So Nokia has been preparing this step for a long time and now the first release can already be tested today. And so, we meet: Nokia Qt SDK.
    Official information (there are two more links in this article).

    Official video (weird at all).


    Now I summarize. This is an SDK for development for all officially supported mobile platforms with Qt on board (currently Symbian and Maemo 5 are officially supported, what will happen next is not yet clear). The bottom line is that this is a single tool for developing mobile applications for devices from Nokia.
    Components:
    1. The heart of everything is Qt-Creator.
    2. Under each platform, an SDK and toolchain are installed for building the application, packaging and debugging on the device.
    3. Qt Simulator - for debugging without a device.


    Sounds great. A few details for each of the components:
    1. Qt Creator:
    - a special assembly
    - out of the box custom integration with target SDKs, toolchains and debuggers.
    - built-in emulator support
    - added templates for mobile projects
    - I was very surprised and pleased with the presence of the “update” plugin, which modularly updates the SDK (now Qt Creator is updated only completely, a new version has been released - download it completely and put it near or instead of the old one). I hope this "update" will migrate to the desktop version of Qt SDK
    - support for Quick / QML technology.
    - support for the debugger assistant in python (what’s the charm, you can see here, the last example is especially impressive - debugging rendering, all this is possible thanks to macros on python in GDB), although the device does not yet have gdb 7.x (a prerequisite for supporting Python macros), but it will be
    - you can still write desktop ones in it applications, this is normal Qt-Creator :-)

    2. SDK + toolchain
    - for Symbian - this is a stripped-down version of the previous SDK (heavily stripped-down, since I demolished the development environment for Symbian that I had to try - Symbian SDK + Carbon + Plugins - it took me about 5 gig per disk). All you need to build and debug on the device.
    - MADDE is used for Maemo, it itself is still in beta testing, but it will allow you to write applications not only under Linux, but also under any other platforms. In this way, it is better than the current Fremantle SDK (which is still an official tool for development, and for at least half a year it will be such).
    - everything is much more compact than the brothers and is glad that there is an “update”.

    3. Qt Simulator
    Interesting enough gizmo. In fact, I expected to see a really emulator, but the guys cheated. This is not quite an emulator, it is a “sandbox” with a separate screen buffer and behavior similar to that of a telephone (charge, coordinates, accelerometer, calls, etc.). It does not emulate the phone, it actually emulates the Qt Mobility API (which by the way came out of beta testing and was recently released )
    Here is what it includes:

    • Service framework
    • Bearer management
    • Messaging
    • Contacts
    • Versit
    • Publish and Subscribe
    • Location
    • System information
    • Sensors

    Well, plus Multimedia, the only part that remained in beta state, but still quite functional.
    The task of the emulator is to just emulate the behavior of all these APIs, and they will all work the same on all devices with Qt Mobility API support (I believe in that :-)). So if you need to implement something outside this API - “native”, then the emulator will not help here.
    Plus, the emulator supports scripting and triggering of various system situations - an incoming call, a low battery, and so on.
    Of course, this can upset many people, but on the other hand, more than 90% of the code when writing a mobile application will use the pure QT API, everything that is “outside” will have to debug on the device. Since the Nokia QT SDK is a tool for cross-platform development, we can assume that only cross-platform functionality can be debugged in the emulator (I believe that this principle is in place). On the other hand, the emulator has become easily portable to other platforms and very light compared to a real emulator.
    Another task of the emulator is to see how it will look on the device (on different ones, there are N95, N97, N900 and ghostly Harmattan (MeeGo) on the list - ghostly because there is no device, there is only Qt-style).
    Maybe this will make the developer think twice before writing non-portable code.
    Well, in the end, not what I expected, but the emulator pleased me.

    Well, here's a brief and messy description of the new KFOR. Now the bad news:
    • SDK is only for PR 1.2 firmware, which is not yet (I hope to wait not long left).
    • Under Linux, only development for the N900 is available (using MADDE).
    • Under Mac OS, there is nothing at all.


    But since we are writing only for N900 in you, only Mac OS users remain in the span (and I am among them :-)). But do not be discouraged, MADDE is available for MAC OS, so everything is fine, it will just take a little more manual work and we will remain on the Mac OS without an emulator (it can somehow be screwed, I didn’t try to dig in that direction at all, if there is info or experience - write).

    Thus, I will show how to install the SDK, write an application, build it and run it on the emulator. Then how to configure the device and run on the device. Although it will not work out for me on the device (it will fall off with SIGFAULT, since the libraries on the device and in the SDK are different), but in the near future, when I upgrade the device to PR 1.2 it will work (in general, comrade manufacturers of these libraries, it should be a shame, because you need to think about the binary compatibility of new versions). All this under Windows. Under Linux, this is done the same way, only the network interface is configured differently, but I will give a link with pictures on how to do this.
    And for Mac OS users, I'll show you how to configure MADDE + Qt Creator to get the same bunch for development. I’ll collect the application and run it on the device (here it will already work). This solution is universal and will work the same on all platforms. Therefore, it can be used as an alternative to the Nokia Qt SDK, so as not to drag too much (for example, you don’t care either the emulator or the Symbian) or to start debugging on the device right now.

    But they promise an official release for the official release of MeeGo, 3-4 quarter of 2010, not so long and wait.

    Well, immediately the official link , with a bunch of demo information and the SDK itself.

    1. Nokia Qt SDK on Windows.



    Firstly, I’ll clarify that I have Windows XP SP3 32bit. I do not know how this will work on other versions, but if there are differences, then write and discuss. I’m even ready to deal with possible problems on Windows 7 myself (if any) if someone gives me a license :-).
    Here is a traditional video:



    Instructions:
    1. We follow the forum.nokia.com link and there we find the section from the SDK or go directly to the SDK page .
    2. Download the SDK for the desired platform - Windows, Offline-version.
    3. Run the installer.
    4. We accept the license agreement.
    5. We select the installation path and select the "custom" installation.
    6. You can study the installed components in the list (I removed the source codes from Qt, they are needed only if you are going to debug Qt itself).
    7. We press the button for installation and wait a couple of minutes.

    Congratulations!!! The SDK is installed and ready for use (isn’t it easy, compared to previous articles).

    Next, we write the application:
    1. Open the Qt Creator from the Nokia Qt SDK. And create a session. If you do not know what this is and why, then I strongly advise you to get acquainted , because without them the development of several projects turns into hemorrhoids.
    2. We are creating a new mobile project (integration with the Mobility API).
    3. Create a form with a button.
    4. We make the application. Its meaning is that when you click on the button, the text in the input line "wraps" in Label.
    5. We are building for the emulator with MinGW 4.4, you can ask me why I started the assembly before I wrote the year. It's simple, I just wanted the .ui file compiler to start and generate the corresponding .h file for me, so that the tooltip for writing my code would work (there’s nothing to suggest before, there is no instance of the ui class yet).
    6. Run in the emulator and play a little there.


    We set up the environment on the device (point 2 of this article, I made it separately, since setting up the environment on the device is the same for both the Windows Nokia Qt SDK and the "clean" MADDE).

    Great, now we will debug on the device via USB (turn on the imagination and imagine that PR 1.2 has already been released and I already installed it :-)).
    1. We connect the N900 in PS Suite mode via USB.
    2. We go into network connections and look for the interface with the device name "Linux USB Ethernet / RND ...."
    3. We set the static address and network on this interface (in all examples it is 192.168.2.14/24).
    4. I assume that you have configured everything already on the device, so we ping it. (Let it not bother me with the 192.168.3.0 subnet in the video, I reconfigured later, since I had local WiFi on the 192.168.2.0 network).
    5. We configure our device in Qt Creator. Password authorization is selected, if you do not want to enter a password each time, then mono exchange keys. To do this, it is enough to have the generated keys and set up password authentication and after that click on the “Deploy Key ...” button and specify the public key. Qt Creator will connect with a password and pick up the public key from the device, and put your public key on the device. If you log in with a password, then in this tab you will need to enter the password each time that mad-developer generated.
    6. To check the connection with the device, by clicking on the "Test" button, a list of installed Qt libraries on the device should be displayed.
    7. I skipped one more step on the video, go to Projects and see if the runtime we need is selected in the Maemo tab (we have one there, called N900, this is what we set up in the previous two steps). If it’s not clear, look at point 3, where we will configure the Qt Creator + MADDE bundle on Mac OS manually.
    8. We start it and, alas, it doesn’t work, but it will certainly work when the device is upgraded to version PR 1.2.


    2. Setting up the environment on the phone.


    Shooting a phone is very difficult for me, in this case it was more difficult, since I had forgotten the stand in Moscow and I had to make up a stationary shooting system from improvised materials. Do not pay attention to my shaking hands with a stylus - this is not from fear, but from inconvenience :-)

    And now to the point, all we need to do is install and master the mad-developer package from the extras repository.

    1. We go to the Application Dispatcher. Click "download" and go to the "development" directory.
    2. We are looking for the mad-developer package and install it (if it is not in the list, check if it is already standing and check if you have an extras repository connected).
    3. We start mad-developer.
    4. We configure the USB network interface (we introduce static addresses - in my case 192.168.3.15, since the second subnet is already taken).
    5. When developing from under Windows, you need to manually download the USB module g_ether, on Mac OS and Linux this is not necessary, your network interfaces will rise and so on.
    6. The developer console is available (why is it, it's not entirely clear).
    7. The most important thing is the password generation button, while the password is visible on the screen - it is valid, as soon as you click the close button - you can no longer connect to the device with a password.

    The operational state of the application is this: open mad-developer and open a window with a password, launch Qt Creator and go to the Maemo settings tab of the device and enter this password. After that, you can debug on the device. If you exchange keys as described in the previous chapter, then all this is not necessary.

    3. Configuring Qt Creator + MADDE on Mac OS.


    By and large, if you do not need an emulator, then even on Windows and SDK auto-update, then you can use this path instead of the SDK. In fact, for Maemo, the Nokia Qt SDK and MADDE development are not just synonyms, but the same thing. So if you are not going to write under Symbian and do not need an emulator, then I advise you to use pure MADDE in order to save space.

    However, at the moment the Nokia Qt SDK is not for Mac OS, which is why I decided to demonstrate the installation of MADDE + QtCreator.
    Here's a video:


    Plus video how to add Madde's qmake to Qt-Creator (forgot to include in the first video):


    Everything is simple here.
    1. Download the MADDE installer script and run it.
    2. Download and install the latest Qt Creator (either the last “snapshot” from here or download the latest official release 2.0 beta from here (there are links to assemblies for different OSs at the bottom of the page)).
    3. Configuring mad-developer on the N900 (previous chapter).
    4. Configure Qt-creator, add Qt from the MADDE package.
    5. Set up the startup environment on the device.
    6. We are writing the application itself.
    7. We start and debug it on the computer.
    8. We launch and debug it on the device.


    Although everything is simple, but there are a couple of nuances.
    • In qmake.conf in MADDE, the -g flag for gcc is not specified when building the application in debug mode. Therefore, you need to add the following line to the .pro file:
    • QMAKE_CXXFLAGS_DEBUG + = - g
    • this one is flags for gcc when building in debug mode.
    • You need to "manually" add qmake, which is needed to build the application to run on the device.
    • It is necessary to rebuild (debugger assistant).


    4. Debugging, live video.


    Well, here is another video, what the last paragraph looked like with my eyes. The whole process of starting and debugging on the device.



    Conclusion



    In the end, I can say Bravo !, Nokia. Everything is done very efficiently and well, even considering that it is beta, you can still develop applications even for a commercial project.
    The installation and configuration process is very simple. Development for mobile and desktop applications is carried out by one tool. Qt Mobility API brought the ability to abstract from the level of mobile OS to the level of "communicator".
    The article I hope will be out of date soon, but the principles laid down in the beta version of the products should not change. In fact, you will need to do the same, only the installer files will have other versions.

    Here, in principle, we can consider a series of articles on the topic "how to install and configure so that you can write an applet" I consider complete. In the following articles, we will finally start writing the application, the application will hopefully be interesting and useful, but the fact that it will cover almost all topics (not deeply, but enough to understand where to dig further, in which case) - I promise.

    Good luck to everyone coding / hacking.

    UPD: of course there are bugs, this is the first official release (albeit beta). So those who are interested and who found errors, have questions or just want to find out more, here are the necessary links:
    The official WiKi page.
    The official page of the project.
    Quick Start Guide.
    A forum dedicated to the tools included with this SDK.

    And of course Qt bug-tracker.

    Also popular now: