Introduction
This article will give an introduction to developing applications for the MeeGo platform. Starting from the very beginning, installing and configuring auxiliary software, and ending with debugging and deploying the application. We will create a simple application that performs the basic operations on numbers (calculator), this application is quite simple and has many ways to implement, and we will consider an example of a non-standard solution presented in the book [7].
Meego
MeeGo is an open platform, announced by Intel and Nokia at the Barcelona Mobile Congress, which will be a hybrid of Moblin mobile systems (Mobile Linux) and Maemo. The first version (1.0) of MeeGo appeared on May 26, 2010, and OS-based devices will appear before the end of 2010.
MeeGo is designed to work on a wide range of devices, including smartphones, tablets and netbooks. This will allow you to create applications that without adaptation will work on several types of devices at once. The app store for MeeGo will be owned by the Nokia Ovi Store.
MeeGo is an independent operating system that, however, uses the groundwork of projects such as Maemo, Moblin, Fedora and Debian.
The MeeGo system is fully open, its source codes are published. Intel and Nokia said that all hardware companies will have equal access to MeeGo.
MeeGo will coexist with the Symbian platform, which is now used for smartphones. The new OS may be installed in the leading models of mobile phones. In particular, it can be installed on the Nokia N900 smartphone.
Begin to program under MeeGo
The first step in acquaintance with this platform and especially development for it is to install supporting software, namely Qt 4.7 SDK, Qt Creator, MeeGo Touch Framework (MTF).
')
Installing MeeGo Touch 1.0 manually on Ubuntu 10.04
- For MeeGo Touch, Qt version 4.7 is required, if it is still not installed, install it (download: qt.nokia.com/downloads ).
- Register environment variables:
$ export QTDIR = / [path to installed qtsdk] / qt /
$ export PATH = $ {QTDIR} / bin: $ {PATH}
- Download and install Touch Theme (to launch applications on the desktop machine).
- Clone from storage: $ git clone git: //gitorious.org/meegotouch/meegotouch-theme.git
- Collect: $ qmake
- Install: $ sudo make install
- Install the necessary packages: $ sudo apt-get install build-essential libgl1-mesa-dev libglu1-mesa-dev libxdamage-dev
- Download and install MeeGo Touch:
- Clone from storage: $ git clone git: //gitorious.org/meegotouch/libmeegotouch.git
- Configure, build and install: $ ./configure && make && sudo make install
Possible problems
:
../libmeegotouch/src/corelib/scene/msceneeventeater.cpp
39: setFlag(QGraphicsItem::ItemStopsClickFocusPropagation);
../libmeegotouch/src/corelib/widgets/mscenewindow.cpp
105: setFlag(QGraphicsItem::ItemStopsClickFocusPropagation);
121 : setFlag(QGraphicsItem::ItemStopsClickFocusPropagation);
../libmeegotouch/src/views/mlabelview_simplce.cpp
244: staticText.setTextOption(viewPrivate->textOptions);
370: staticText2.setTextOption(staticText.textOption());
The first error was that the ItemStopsClickFocusPropagation property is not a member of the QGraphicsItem class and the second similar error. I just commented out these lines for a while.
The process of working on expanding the functionality and trapping errors does not stop for a minute, and accordingly in the next versions of MTF all errors will be corrected and new ones added.
Installing MeeGo Touch 1.1 from the Ubuntu 10.04 repository
- Configure package manager:
- Add the following line in /etc/apt/sources.list.d/meego-sdk.list
deb repo.meego.com/MeeGo/sdk/host/repos/ubuntu/10.04 /
- Add repository key:
$ gpg --keyserver pgpkeys.mit.edu --recv 0BC7BEC479FC1F8A
$ gpg - export - arm 0BC7BEC479FC1F8A | sudo apt-key add -
- Update package manager database:
$ sudo apt-get update
- To verify that the MeeGo repository has been correctly added, run the following command. Details from the MADDE package will be displayed.
$ apt-cache policy madde
- Install MeeGo SDK: $ sudo apt-get install meego-sdk
- Set MeeGo object:
- Create a MeeGo object using MADDE (objects: ARM (N900): meego-core-armv7l-1.1; Aava: meego-handset-ia32-1.1, meego-netbook-ia32-1.1):
$ sudo mad-admin create -f "target"
- To verify that the objects were set correctly, run the following commands:
$ mad -t "target" pscreate -t qt-simple qthello
$ cd qthello
$ mad -t "target" qmake
$ mad -t "target" make
- Checking that the qt-simple application is created for the right object, let's execute: $ file build / qthello
For more information on installing MeeGo Touch 1.1, refer to the resource [1].
Run Meego-Handset [Netbook] edition on Xephyr emulator
- Download the Meego handset edition or netbook edition image and unzip it:
$ wget download3.meego.com/meego-handset-sdk-20101012-1.1.80.20101024.1603-sda.raw.tar.bz2
or
$ wget download3.meego.com/meego-netbook-sdk-20101012-1.1.80.20101024.1603-sda.raw.tar.bz2
$ tar xjvf download3.meego.com/meego-handset-sdk-20101012-1.1.80.20101024.1603-sda.raw.tar.bz2
Note: MeeGo builds appear daily, they can be downloaded from the link [5].
- Download meego-sdk-chroot script:
$ wget download3.meego.com/meego-sdk-chroot
Make the script executable: $ chmod + x ./meego-sdk-chroot
- Configure X to run Xephyr:
$ xhost + SI: localuser: "user name"
- Mount the MeeGo image in the directory and run the meego-sdk-chroot script:
$ sudo mkdir ../[name_of_mount_directory]
$ sudo mount -o loop, offset = 512 ./[meego_handset_raw]
../[name_of_mount_directory]
$ sudo ./meego-sdk-chroot ../[name_of_mount_directory]
Now we are in the shell meego chroot.
Note: To unmount the image, use the command
$ sudo umount ../[name_of_mount_directory]
- Run MeeGo:
$ export DISPLAY =: 0; set the environment variable
$ zypper install meego-simulator-launcher-handset; only for meego-handset
$ startmeego &
When executing the last command, the MeeGo-Handset shell will start. On the basis of the mounted image (Handset or Netbook), you will start this or that image.
MeeGo Handset on Xephyr
Fig. 1. MeeGo-Handset UIMeeGo Netbook on Xephyr
Fig. 2. MeeGo-Netbook UILet's launch our calculator for the Maemo platform on the MeeGo-Handset and MeeGo-Netbook (the source is below the link).
Running a calculator on MeeGo-Netbook
- Run MeeGo-Netbook on the emulator, as shown above.
- We mount the project directory, for this we do the following steps:
- Create a directory in MeeGo-Handset:
$ sudo mkdir [meego_netbook_mount_dir] / home / meego / code
- Mount the source directory of the calculator:
$ sudo mount --bind [calculator_sources] / [meego_netbook_mount_dir] / home / meego / code
Note: We execute this command in a standard command shell (bash).
- Go to the mounted directory and run the calculator:
$ cd home / meego / code / calculator
$ DISPLAY =: 2 ./calculator
Note: We execute this command in the meego shell (meego chroot)
The launched calculator on MeeGo-Netbook is shown in Fig. 3

Now let's run the calculator on the MeeGo-Handset. To run the application, you need to do all the same steps as for MeeGo-Netbook, but only run the assembly of MeeGo-Handset. The running calculator on the MeeGo-Handset is shown in Fig. four.
Fig. 4. MeeGo-Handset CalculatorAs seen in Fig. 4, the calculator does not look quite like we expected. Let's see what the problem is. And the problem is that for MeeGo-Handset, applications are developed using a special set of tools, namely the MeeGo Touch Framework (MTF, libmeegotouch). Let's see how this is done.
Change application for MeeGo-Handset
MeeGo Touch (libmeegotouch) is a Qt based touchscreen mobile application development tool. It is part of the MeeGo Platform API. Provides all the necessary building blocks for creating your own applications that follow the MeeGo Handset UX principles. The tool is based on the Qt Graphics View Framework.
In Qt Creator, we create the project “Empty Project”, add the main.cpp, calculator.cpp and calculator.h files to the calculator. In the project file, you must specify the following lines for the installed MeeGo Touch (MTF 1.0):
CONFIG += meegotouch<br/>
INCLUDEPATH += / usr / local / include / meegotouch<br/>
LIBS += / usr / local / lib / libmeegotouchcore. so \<br/>
/ usr / local / lib / libmeegotouchsettings. so \<br/>
/ usr / local / lib / libmeegotouchviews. so \<br/>
/ usr / local / lib / libmeegotouchextensions. so
After that we can start changing the program to use it on MeeGo.
MTF related changes
main.cpp#include <MApplication> <br/>
#include <MApplicationWindow> <br/>
#include <MApplicationPage> <br/>
#include "calculator.h" <br/>
<br/>
int main ( int argc , char ** argv ) <br/>
{ <br/>
MApplication app ( argc , argv ) ; <br/>
MApplicationWindow window ; <br/>
MApplicationPage page ; <br/>
Calculator * calc = new Calculator ( ) ; <br/>
<br/>
page. setTitle ( "Calculator" ) ; <br/>
page. setCentralWidget ( calc ) ; <br/>
page. appear ( & window ) ; <br/>
<br/>
window. show ( ) ; <br/>
<br/>
return app. exec ( ) ; <br/>
}
Let's look at the changes that affected main.cpp:
- All header files begin with a capital letter “M”.
- Since MeeGo Touch is based on Qt, it can use the main system classes and functions, the main changes have affected the graphical component of the tool, namely widgets, windows, etc.
- MApplication has similar uses as Qt.
- MApplicationWindow provides the basis for building the user interface, provides a common navigation bar for all applications, which includes a home button and a close button, a toolbar (in landscape orientation), and an application menu. That is, this class is responsible for what is associated with the main window of the application, which contains all the other elements.
- MApplicationPage is also a tool for building the user interface of the application. By default, the page creates a horizontally view, where the user can place their components using the methods centralWidget () or setCentralWidget (MWidget *) (in MTF 1.0, setCentralWidget (QGraphicsWidget *)). Pages are displayed on the screen using the appear (QGraphicsScene *, DeletionPolicy) or appear (MWindow *, DeletionPolicy) method. Calling the appear () method starts showing the animation associated with the page. If you want to display the page instantly, contact the MSceneManager API.
For more information, see the Platfrom API documentation [4].
calculator.h#include <QStack> <br/>
#include <MGridLayoutPolicy> // , <br/>
#include <MButton> // <br/>
#include <MLayout> // <br/>
#include <MTextEdit> // <br/>
#include <QGraphicsWidget> // () <br/>
<br/>
class Calculator : public QGraphicsWidget<br/>
{ <br/>
Q_OBJECT <br/>
<br/>
public : <br/>
Calculator ( QGraphicsItem * parent = 0 , Qt :: WindowFlags wFlags = 0 ) ; <br/>
MButton * createButton ( const QString & str ) ; <br/>
…<br/>
private : <br/>
MTextEdit * lcdDisplay ; <br/>
QStack < QString > stack ; <br/>
QString strDisplay ; <br/>
…<br/>
} ;
To add a Calculator widget to an application page using the setCentralWidget () method, it must be inherited from the QGraphicsWidget class. In MTF 1.1, the setCentralWidget () function for setting the central widget of the page accepts the MWidget component to be installed.
calculator.cpp#include "calculator.h" <br/>
<br/>
Calculator :: Calculator ( QGraphicsItem * parent , Qt :: WindowFlags wFlags ) : <br/>
QGraphicsWidget ( parent , wFlags ) <br/>
{ <br/>
lcdDisplay = new MTextEdit ( ) ; <br/>
lcdDisplay -> setReadOnly ( true ) ; <br/>
lcdDisplay -> setMinimumSize ( 150 , 50 ) ; <br/>
<br/>
…<br/>
<br/>
MLayout * layout = new MLayout ; <br/>
MGridLayoutPolicy * ptopLayout = new MGridLayoutPolicy ( layout ) ; <br/>
ptopLayout -> addItem ( lcdDisplay , 0 , 0 , 1 , 4 ) ; <br/>
ptopLayout -> addItem ( createButton ( "CE" ) , 1 , 3 ) ; <br/>
<br/>
for ( int i = 0 ; i < 4 ; ++ i ) <br/>
for ( int j = 0 ; j < 4 ; ++ j ) <br/>
ptopLayout -> addItem ( createButton ( aButtons [ i ] [ j ] ) , i + 2 , j ) ; <br/>
<br/>
layout -> setPolicy ( ptopLayout ) ; <br/>
setLayout ( layout ) ; <br/>
}
These are mainly the main changes that have affected the application when migrating to MeeGo-Handset. There are some changes associated with displaying the result of calculations using QLCDNumber, because this class did not appear in MTF 1.0, I had to replace it with MTextEdit.
The result of the changes is shown in Fig. five.
Fig. 5. MeeGo-Handset CalculatorAs can be seen from the presented changes, the transfer of the application for the MeeGo-Handset is not difficult. Over time, MTF will only gain functionality and power, which will give developers a wider scope for maneuver and more modern and high-quality applications.
Conclusion
MeeGo is a joint development of Nokia and Intel, which is just beginning to gain momentum and conquer the market. This platform is based on Maemo and Moblin, and absorbed all the advantages of these platforms and acquired its own.
The platform is developing and will be widely used in the near future. The focus will be on the MeeGo platform, which can be used on many devices, from mobile devices to televisions.
Bibliography
- Install and configure the MeeGo SDK: wiki.meego.com/SDK/Docs/1.1/Getting_started_with_the_MeeGo_SDK_for_Linux .
- Running MeeGo on the Xephyr emulator: wiki.meego.com/MeeGo_SDK_with_Xephyr
- Platform API: apidocs.meego.com/1.1/platform/html/index.html
- MeeGo API 1.1: apidocs.meego.com/1.1/core/html/index.html
- MeeGo builds : repo.meego.com/MeeGo/builds
- Shlee M. - Qt 4.5. Professional programming in C ++. - SPB .: BHV-Petersburg, 2010, 896s.
- Hello World for MeeGo-Handset: wiki.meego.com/SDK/Docs/1.1/Creating_Hello_World , blog.telaic.pl/?p=63
- MeeGo Review: ru.wikipedia.org/wiki/MeeGo
PS
- Full code
- Original article