[Jaffa Software]

Tuesday, 19 June 2012

Initial success in porting Harmattan/Symbian QML app to BlackBerry

This is the first post in a new BlackBerry category in my blog. Having attended the "BlackBerry 10 Dev Jam" in London last week, BB10 looks very interesting - and a spiritual successor to MeeGo 1.2 Harmattan, i.e. the Nokia N9.

It's particularly interesting as BlackBerry have created their own Qt/QML-based environment, called Cascades.

However, I've got an existing app, Bedside which is almost pure QML. Could I get it running? More detailed instructions will come later, but here's how I got to where I am:

  1. Install the BlackBerry 10 Native SDK and developer environment.
  2. Create a new BlackBerry Cascades C++ project, although we're going to use it for "plain" Qt (as described in this Chinese blog post).
  3. Ensure you add <env var="QT_QPA_FONTDIR" value="/usr/lib/qt4/lib/fonts" /> to bar-descriptor.xml.
  4. Copy qmlapplicationviewer.{cpp,h} from the existing project into APP/src/.
  5. Put your QML resources in APP/assets/ (note you can't use asset://... URLs within the QML files, as you can with Cascades).
  6. Replace main.cpp with a simplified version from your other project, for example:

#include <QtGui/QApplication>
#include <QtDeclarative>
#include "qmlapplicationviewer.h"

int main(int argc, char **argv) {
  QApplication app(argc, argv);
  QmlApplicationViewer viewer;
  return app.exec();

In particular, note the path to the main-QML-file.

And here's the initial version of Bedside (with no screensaver interaction yet) running on the BlackBerry 10 Dev Alpha:

UPDATE: With a bit more work, I've got a single source tree working: now I can deploy to Symbian, Maemo, Harmattan or BlackBerry 10 (using Qt SDK for the first three, and BB10 Native SDK for the latter).

Instructions are in this forum post.