Thursday, October 6, 2011

Enabling Booster support for QML applicaion in Harmattan

Recently I added support for Booster for My QML application. Its quite easy to add booster support for existing QML or new QML application.

I am wiring down my experience here in hope it will help someone.

The QML booster reduce application startup latency by creating instances of QApplication and QDeclarativeView the classes in MDeclarativeCache.

To use this class you will need to add following header.

#include <MDeclarativeCache>
And then you will need to use QApplication and QDeclarativeView class instance provided by MDeclarativeCache. Following code shows how that can be done.

QApplication* app = MDeclarativeCache::qApplication(argc, argv);
QDeclarativeView* view = MDeclarativeCache::qDeclarativeView();
To enable booster and link with it properly you need to add following line in to your Qt project (.pro) file.

# enable booster
CONFIG += qt-boostable qdeclarative-boostable
LIBS += -lmdeclarativecache

If you are planning to use applauncerd to launch application then you will need to use Q_DECL_EXPORT macro in front of main function from "QtCore/QtGlobal" header file as shown in following code.

#include ≶QtCore/QtGlobal>

Q_DECL_EXPORT int main( int argc, char* argv[] ) {
}
You will also need modify include path in your pro file in order to locate header file properly.

INCLUDEPATH += /usr/include/applauncherd
And finally in your desktop file, you need to use --type=d to launch application using booster.

Exec=/usr/bin/invoker --single-instance --type=d /usr/bin/appname

No comments:

Post a Comment