📜 ⬆️ ⬇️

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

Good day habra users. I continue to write about the Maemo platform (for Maemo Fremantle yet). This article is devoted to news in the world of Nokia - the release of the Nokia Qt SDK. So far this is TP (Technical Preview, it took a long time to translate into Russian, it didn't work out, so “TP” will be empty hereinafter). But writing on this is already possible, but there are a few reservations. Details further in order. I will also tell you more about MADDE, since it is this part in the Nokia Qt SDK that is responsible for the development for Maemo.

image

As a result, we will write the application (it says very loudly :-), in general, the application), build it and run it on the emulator and on the device (more precisely, on the Nokia N900). And in general we will understand 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 issue 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 summarized. This is the SDK for development for all officially supported mobile platforms with Qt on board (at the moment Symbian and Maemo 5 are officially supported, what’s next is not clear yet). The bottom line is that this is a unified tool for developing mobile applications for Nokia devices.
Components:
  1. The heart of everything is Qt-Creator.
  2. An SDK and a toolchain are put under each platform for building the application, packaging and debugging on the device.
  3. Qt Simulator - for debugging without a device.


Sounds like great. A few details for each of the components:
1. Qt Creator:
- special assembly
- out of the box, customized 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” plug-in, which modularly updates the SDK (now Qt Creator is updated only completely, a new version is released - download it completely and put it next to or instead of the old one). I hope this "update" will be moved to the desktop version of the Qt SDK
- support for technology Quick / QML.
- support for the debugging assistant in python (which is nice, you can see here , the last example is especially impressive - debugging the rendering, all this is possible thanks to macros on python in GDB), although the device does not have gdb 7.x (a prerequisite for Python macros), but it will be the same
- it is still possible to write desktop applications in it, this is normal Qt-Creator :-)

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

3. Qt Simulator
Quite an interesting thing. In fact, I expected to see a real emulator, but the guys cheated. This is not exactly an emulator, it is a sandbox with a separate screen buffer and phone-like behavior (charge, coordinates, accelerometer, calls, etc.). It does not emulate a phone, it actually emulates the Qt Mobility API (which, by the way, came out of beta testing and was released recently )
This is what it includes:


Well, plus Multimedia, the only part that remained in the beta state, but still quite efficient.
The task of the emulator is to 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 it :-)). So if you need to implement something outside of 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 battery sits down, and so on.
Of course, this can be frustrating for many, but on the other hand, more than 90% of the code when writing a mobile application will be used by the pure QT API, all that “outside” will have to be debugged on the device. Since Nokia QT SDK is a tool for cross-platform development, it can be assumed 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 is very light compared to a real emulator.
Another emulator task is to see how it all looks on the device (on different ones, there are N95, N97, N900 and ghostly Harmattan (MeeGo) in the list - ghostly because there is no device, there is only Qt-style).
Maybe this will make the developer think three times before writing non-portable code.
Well, in the end, not what I expected, but I was pleased with the emulator.

Well, this is a concise and messy description of the new KFOR. Now the bad news:


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

Thus, I will show you how to install the SDK, write the 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 down with SIGFAULT, since the libraries on the device and in the SDK are different), but in the near future, when I update the device to PR 1.2, this will all work (and in general, the companions manufacturers of these libraries, Should be ashamed, 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 how to do it.
And for Mac OS users, I'll show you how to configure MADDE + Qt Creator to get the same bundle for development. I will assemble 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 pull too much (for example, you don’t have to have a Symbian emulator) 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, and it’s not long to wait.

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

1. Nokia Qt SDK on Windows.



First of all, I clarify that I have Windows XP SP3 32bit. I do not know how it will work on other versions, but if there are differences, then write - we will discuss. I'm even ready to deal with possible problems on Windows 7 (if they will), if someone gives me a license :-).
Here is a traditional video:



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

Congratulations!!! The SDK is installed and ready for operation (is it not easy, compared to previous articles).

Next, write the application:
  1. Open Qt Creator from Nokia Qt SDK. And create a session. If you do not know what it is and why, then I strongly advise you to get acquainted , because without them the development of several projects turns into hemorrhoids.
  2. Create a new mobile project (integration with the Mobility API).
  3. Create a mold with a button.
  4. Making an application. Its meaning is that when you click on a button, the text in the input line is “transferred” to the Label.
  5. We collect 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 to start the .ui file compiler and generate the corresponding .h file for me to pop up a hint for writing my code (there’s nothing to suggest before that, ui class instance is not yet available).
  6. We start in the emulator and play a little there.


We set up the environment on the device (point 2 of this article, I took out separately, since the setting of the environment on the device is the same as for the Windows Nokia Qt SDK and for the “clean” MADDE).

Ok, now we will debug on the device via USB (let's turn on the imagination and imagine that PR 1.2 is already out and I have already installed it :-)).
  1. We connect the N900 in PS Suite mode via USB.
  2. Go to the network connections and look for an interface with the device name "Linux USB Ethernet / RND ...."
  3. We install a static address and a network on this interface (in all examples it is 192.168.2.14/24).
  4. I suppose that you have already set everything up on the device, so we ping it (though it doesn’t bother the subnet 192.168.3.0 in the video, I reconfigured it, since I had local WiFi on the 192.168.2.0 network).
  5. We configure our device in Qt Creator. Authorization is selected by password, if you do not want to enter a password each time, then you can exchange keys with mono. To do this, it is enough to have generated keys and configure password authorization and then click on the “Deploy Key ...” button and specify the public key. Qt Creator will connect with a password and take the public key from the device, and put your public key on the device. If you authenticate with a password, then in this tab you will need to enter the password generated by mad-developer each time.
  6. Checking the connection to the device by clicking on the "Test" button should display a list of installed Qt libraries on the device.
  7. I missed one more step on the video, but go to “Projects” and see that we select the runtime we need in the “Maemo” tab (we have one there, called the N900, this is what we configured in the previous two steps). If it’s not clear, check out point 3 where we’ll configure Qt Creator + MADDE on Mac OS manually.
  8. We start and everything unfortunately does not work, but it will certainly work when the device is flashed 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 was shaky the stand in Moscow and had to fence a stationary system of shooting from improvised materials. Do not pay attention to my shaking hands with the stylus - this is not from fear, but from inconvenience :-)

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

  1. Go to the Application Manager. Click "download" and go to the directory "development".
  2. We are looking for the mad-developer package and install it (if it is not on the list, check if it can already be installed and check if you have the extras repository connected).
  3. We start mad-developer.
  4. We configure the USB network interface (we enter static addresitions - in my case 192.168.3.15, since the second subgrid is already occupied).
  5. When developing from under Windows, it is necessary to manually load the g_ether USB module, on Mac OS and Linux this is not necessary, your network interfaces will rise and so.
  6. The developer console is available (why it is not entirely clear).
  7. The most important thing is the button for generating a password, until the password is visible on the screen - it is valid, as soon as you press the “close” button - you can no longer connect to the device with a password.

The operating status 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 indicated in the previous chapter, then all this is not necessary.

3. Qt Creator + MADDE Bundle Setup on Mac OS.


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

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


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


It's simple.
  1. Download MADDE installer script and run it.
  2. Download and install the latest Qt Creator (either the latest “snapshot” from here or download the latest official release 2.0 beta from here (there are links to builds for different operating systems at the bottom of the page)).
  3. We configure mad-developer on N900 (previous chapter).
  4. Configure Qt-creator, add Qt from the MADDE package.
  5. Configure the launch environment on the device.
  6. We write the application itself.
  7. Run and debug it on the computer.
  8. Run and debug it on the device.


Although everything is simple, but there are a couple of nuances.


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 this is a 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 conducted by some tools. Qt Mobility API brought the opportunity to abstract from the level of mobile OS to the level of "communicator".
The article I hope will soon become obsolete, but the principles laid down in the beta version of the products should not change. In fact, you will need to do the same thing, only in the installer files there will be 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 a program”, I consider it complete. In the next 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 deep, but enough for you to understand where to dig further, if anything happens) - this is my promise.

All successful coding / hacking.

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

And of course Qt bug-tracker.

Source: https://habr.com/ru/post/94075/


All Articles