Kate is maemo chief engineer in Forum Nokia,
She has long Linux/Open Source developer background.
kate.alhola | 08 July, 2011 18:05

In my previous blog I had introduction to MeeGo 1.2 Harmattan Qt Quick components, in this blog I wrote about porting components to other platforms than MeeGo 1.2 Harmattan and in next one about porting applications to different Qt Quick Components like MeeGo-Ux, Symbian or desktop.
Nokia N9 device will be largest volume MeeGo device in near future and most interesting platform for MeeGo application developers. Portability of Harmattan components is interesting issue for many reasons. N950 developer devices are produced only limited quantity and N900 provides excellent developer platform that is more easily available. Many MeeGo developers would like to see their application to run other MeeGo devices and would like distribute their application for all of them. Harmattan components are licensed as BSD license, so they are free to distribute any platform.
MeeGo 1.2 Qt Quick components are portable code but there is some issues need to taken care when porting them.First one is that components use Qt Quick 1.1 and most platforms like Ubuntu Natty or MeeGo 1.2 still have Qt Quick 1.0. I have made patch set allowing components to run in Qt Quick 1.0. This is problem is just temporary, and vanish soon when MeeGo and Ubuntu upgrade up to date Qt version in next release.
Second issue is theming. MeeGo 1.2 Harmattan SDK comes with Nokia MeeGo 1.2 Harmattan product theme that is same theme used in production device, N9. This theme is Nokia proprietary. It may be used in software development but it can't be redistributed. When you make applications for N9, this is no problem because theme is factory installed in N9. If you would like distribute your applications to other MeeGo or even non MeeGo devices, you need to use theme that allows redistribution. Standard MeeGo 1.2 uses MeeGoTouch theming that is based on .svg files having multiple graphics elements in one file. Qt Quick uses .png BorderImages. To use components, I have exported graphics elements as .png files and made separate add on package. Now developers have two choices, if they would like just develop for N9, it is recommend to use Nokia “blanco” theme, if intention is to distribute application to other platforms, you should use open theme based on MeeGoTouch “base” theme or other compatible theme.
Third issue is different UX. The UX between MeeGo 1.2 handset, MeeGo 1.2 tablet and MeeGo 1.2 Harmattan. There is a big difference to end user, MeeGo 1.2 Harmattan has magnificent swipe UI where task switching is done by swipe gesture. MeeGo 1.2 handset uses traditional way to have close button in application toolbar and MeeGo 1.2 Tablet uses hardware home key. The great advantage of Harmattan Swipe gesture is that no valuable screen space is wasted for home button and toolbar and there is no device front surface wasted for home button and larger amount of device front surface can be used for display and actual application. My experience of MeeGo tablet is still based on keeping one tablet in my hand 5 minutes. For application code difference is small. In MeeGo 1.2 handset application should initiate itself task switching but minimizing it's window. In MeeGo 1.2 Harmattan and MeeGo 1.2 tablet, task switching activity is initiated by external process as result of swipe gesture or pressing home button. If we compare to typical desktop applications, application switching, minimizing and closing window is initiated by external window manager application. Close and minimize buttons are in desktop in window frame that is owned by window manager, not by application. Maemo Hildon used same method, tittle bar was owned by system process. In MeeGo, all screen is owned by application and if there are home and close buttons, application should respond to them and initiate action. Other small difference is that in MeeGo 1.2 Handset and MeeGo tablet, toolbar is at top of the window when in Harmattan it is at bottom. At summary differences:
QDeclarativeView window(QUrl("qrc:/main.qml"));
window.rootContext()->setContextProperty("mainWindow",window.window());
QObject::connect((QObject*)window.engine(), SIGNAL(quit()), &app, SLOT(quit()));

PageStackWindow {
id: rootWindow
initialPage: mainpageComponent
toolBarOnTop:true // Experimental non standard property
ToolBarLayout {
id: commonTools
visible: false
ToolItem { iconId: "icon-m-toolbar-home"; onClicked: mainWindow.showMinimized();}
ToolIcon { iconId: "toolbar-back"; onClicked: pageStack.pop(); }
}
Component {
id: mainpageComponent
Page {
id:mainPage
tools:
ToolBarLayout {
ToolItem { iconId: "icon-m-toolbar-home"; onClicked: mainWindow.showMinimized();}
ToolItem { iconId: "icon-m-toolbar-close"; onClicked: Qt.quit(); }
}
Equivalent version for Harmattan is
PageStackWindow {
id: rootWindow
initialPage: mainpageComponent
ToolBarLayout {
id: commonTools
visible: false
ToolIcon { iconId: "toolbar-back"; onClicked: pageStack.pop(); }
}
Component {
id: mainpageComponent
Page {
id:mainPage
#ifdef __arm__
window.showFullScreen();
#else
window.show();
#endif
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QDeclarativeView window(QUrl("qrc:/main.qml"));
window.rootContext()->setContextProperty("mainWindow",window.window());
QObject::connect((QObject*)window.engine(), SIGNAL(quit()), &app, SLOT(quit()));
QRect screenGeometry=QApplication::desktop()->screenGeometry();
if((screenGeometry.height()<800) && (screenGeometry.width()<1024))
window.window()->showFullScreen();
else window.window()->show();
return app.exec();
}
sudo add-apt-repository ppa:forumnokia/fn-ppa
sudo apt-get update
sudo
apt-get install qt-components qt-components-base-icons meegotouch-theme
For MeeGo 1.2 , arm and x86 components are located in: http://repo.pub.meego.com/home:/kate/DE/ .
MeeGo arm version is tested on N900 Community Edition, x86 version for tablet is mostly untested, may be just my bad luck setting environment. Qemu image just freezes after few minutes and chroot Image Xephyr died in few seconds.....
At teh moment, code is only in my personal repository but i hope that we get them soon some more convinient repository. At the moment, download files and install them with rpm comman. When we get files to repository, use zypper
zypper install qt-components qt-components-base-icons
Maemo5 packages will be soon in maemo extras-devel repository.
Commentsmikeedge | 08/07/2011, 20:18
Great news I have already started to make an app for N9 using scratchbox and Xepyr now I finally can port it to N900 CE and test on that device until N9 is released :-D
mauron85 | 09/07/2011, 17:21
I really like to try Harmattan Qt Quick Components. Will there be also build for Ubuntu 10.04 LTS?
kate.alhola | 10/07/2011, 00:07
10.04 Lucid has Qt 4.6.3 and Ubuntu version of Components require least Qt Quick 1.0 , in practice Qt 4.7.2 . Qt Quick 1.1 is recommended and I needed to do some back porting to get them work with Qt Quick 1.0
kate.alhola | 10/07/2011, 00:10
That will be subject of my next blog, how to port applications to environments with different UX, incl MeeGo-UX, Symbian and Desktop Qt Quick components.
mauron85 | 10/07/2011, 03:27
Kate, there are Qt 4.7.2 packages already in ppa:forumnokia/fn-ppa for Lucid. However fresh Qt Quick Components are only for Naty.
mike7b4 | 13/07/2011, 00:59
Hmm I had problem related to qt-components the qt components examples didn't work on N900CE and the console prints alot of "QML BorderImage: Failed to get image from provider: image://theme/[somename]" messages?
Is this related to the missing icons? Cause package 'qt-components-base-icons' doesnt exist at:
http://repo.pub.meego.com/home:/kate/DE/
larseggert | 07/09/2011, 20:00
So when I run my QML project on the N900, I get:
Remote process started.
"zppy" "0.4.1" starting at "16:26:08.981" "2011-09-07"
RemoteThemeDaemonClient: Failed to connect to theme server (that's OK if you're on a PC)
LocalThemeDaemonClient: Looking for assets in "/usr/share/themes/base/meegotouch"
RemoteThemeDaemonClient: Failed to connect to theme server (that's OK if you're on a PC)
LocalThemeDaemonClient: Looking for assets in "/usr/share/themes/base/meegotouch" file:///opt/zppy/qml/qml/MainMeego.qml:8:5: Type WebPage unavailable
WebPage {
^ file:///opt/zppy/qml/qml/WebPage.qml:26:9: Type ProgressBar unavailable
ProgressBar {
^ file:///usr/lib/qt4/imports/Qt/labs/components/native/ProgressBar.qml:43:1: module "Qt.labs.components" version 1.1 is not installed
import Qt.labs.components 1.1
^
Main QML: "file:///opt/zppy/bin/../qml/qml/MainMeego.qml"
QObject::connect: Cannot connect (null)::loadFinished() to Zppy::analyzeTiming()
QObject::connect: Cannot connect (null)::loadFailed() to Zppy::loadFailed()Segmentation fault
Killing remote process(es)...
It looks like the ProgressBar.qml tries to include module "Qt.labs.components", which isn't there? (My code includes "Qt.labs.components.native 1.0", which is where ProgressBar.qml is found.
Any ideas?
Commonality, not porting
aflegg | 08/07/2011, 20:11
The trick we want to see, though, are the best techniques for having the same code base work on:
* MeeGo 1.2 (tablet on ExoPC and handset on N900 CE)
* Harmattan
* Symbian^3
* Maemo 5
"Porting" applications between these different environments isn't the same as having a largely common codebase which can work on different OSes.