Revision as of 14:33, 27 April 2010 by tasala (Talk | contribs)

Wordpress developer story

From Nokia Developer Wiki
Jump to: navigation, search

Developer story: Wordpress Qt application for Nokia devices

This article describes the porting story from iPhone to Qt on Nokia devices

Wordpress for Nokia devices was ported from an iPhone application
Antti Kosonen
Wordpress is the number-one open-source blogging tool, used on millions of sites by tens of millions of people every day. A Wordpress application for Nokia devices is being developed on Qt technology to provide support for both S60 and Maemo™ platforms.

Antti Kosonen from the Wordpress Nokia app development group has participated in development since December 2009 — right from the very first line of code. The basis for development has been the iPhone application that is now being ported to Qt.

Antti summarises the open-source development project in two different phases:

‘To make a long story short, it is easy to keep the original structure of the applicationwhen porting from iPhone to Qt. You can directly rewrite the core code to Qt just by looking at the original source’.

He continues, ‘But the user interface framework for iPhone is so device-specific that a complete rewrite has been the only solution. This means that the main efforts needed for porting are focused on the UI’.

Rapid UI development

The Wordpress Qt application for Nokia devices is created by using standard UI widgets on top of the graphics view. Despite the need for a rewrite, Antti has been surprised at how fast the UI development has been with Qt.

‘Compared to many other platforms, tweaking of the UI is incredibly quick. You can set values, launch it on the desktop, and, if it looks good, add to the device style sheet and deploy for verification’.

The stats view was developed completely on the desktop without debugging on the device

A great example of this Qt tool chain is the stats view of the Wordpress app. This view was developed entirely without debugging it on the device. It was developed to scale properly on different sizes and fine-tuned with platform-specific style sheets only at the very end.

‘Tools are excellent for this purpose’, says Antti. ‘We were able to develop UI views from mock up to end product using only Qt Creator’.

Minimizing if-defs

The Wordpress application is developed with maximum compatibility in mind. According to Antti, the amount of if-defs in the source are kept as low as possible.

‘Yes, Qt is cross-platform to some extent’, he says. ‘As long as classes and functions start with the letter Q, they will most probably work on any device.

‘But there will always be platform-specific issues, too’, Antti continues. ‘For example, the softkey menu in S60 has no similar implementation in Maemo, so it needed to be replaced with its own button in non-S60 environments. This is, of course, related to how strongly you are willing to adapt to the platform's default user experience’.

Good application design reduces the effort needed for porting

Because of the differences in target platforms, such as screen size and input methods, application design has a major role in the efforts required for creating cross-platform deliveries. Simple UI design can reduce the workload noticeably.

‘Now that we are implementing a fullscreen mode for the application, the softkey issue no longer applies, and there will be one less if-def in the source’.

Custom solutions

One of the single most difficult challenges for Antti in the Wordpress Nokia app project has been the issue of the thumbnail grid. The original feature was developed with the iPhone native framework, but Qt on Symbian does not currently provide similar features to fetch image thumbnails.

‘We faced the fact that rendering of each image thumbnail takes 0.2 seconds. That does not sound like too much for a single image, but 100 images will cause a poor user experience’, Antti notes.

‘We are still working on the issue, but were able to make it smoother by limiting the thumbnail rendering only to visible images. I hope to solve [the problem] without native implementation, because of the risk of increasing deployment complexity’.

Still, native code might be the appropriate solution for some issues.

‘When we were running the first versions on devices, there was an issue raised with S60 3rd Edition, Feature Pack 1 devices. They kept asking for an internet access point for every network request’, Antti explains.

‘We implemented an S60 native functionality to provide a solution to this. It is used only for S60 3rd Edition, FP1 devices, and it works just great’.

Benefitting from the built-in features

Although there are no plans for localised versions of the Wordpress application for Nokia devices, the source already includes support for it. Each of the strings has been described in the code with a simple object, to enable listings of language-dependent strings inside the project. The listing results in an XML file, very similar to one in Xcode.

In general, Antti has been happy with the maturity of Qt.

‘Developing applications for Qt is fun’, he says. ‘The language is straightforward and easy to adapt to’.

Read more on the developer's blog at http://dev.nokia.wordpress.org or take a tour and compare source codes at http://nokia.trac.wordpress.org (Nokia-device source) and http://iphone.trac.wordpress.org (iPhone source)

How to Proceed with Porting

To proceed with porting, the following guides are recommended:

221 page views in the last 30 days.