So here it is:



BackgroundA client of ours, 1st Detect,
is developing a miniature chemical detector. This is a fairly cool bit
of technology that will help sniff out the nasty stuff in airports,
factories, battlefields, etc.
A while back we took the software for
that system and converted it to Qt. This was so that a single board
computer running the chemical detector could run Linux, while
maintaining the option to go back to Windows if they had to. (We also
have it running on a Mac)
A nice side effect of this was that
mobile platforms became easy. We did a quick proof of concept remote
control / view application on a Nokia 5800 phone running Symbian (They of course gave me permission to blog about this):
The
app searches for nearby chemical detectors, lets you connect to them,
and control them. We've got GPS working now (the test version pops
up your location in Google Maps), and we're working on a display that
will show you nearby detectors on a map, with their status. All from
your phone / mobile device. Nice, eh?
Well... almost. The
regular conference goers at 1st Detect don't have Nokia phones. They
wanted something that worked on something they had, and they figured
that eventually clients will have the same issue. So, we looked into
getting the Qt-based app running on a Palm Pre.
After some initial tests, it began to look like this would most likely work.
I thought it'd make an excellent blog post, so I contacted Nokia about it. I wanted to know how serious they were about Qt Everywhere.
The intention was that if they weren't too thrilled about Qt on a
competitor's phone then we'd simply do 1st Detect's Qt app on the Pre
and not really talk about it.
I figured I owed them for releasing Qt as LGPL.
I didn't quite expect the reaction.
They were THRILLED. They were going to the Mobile World Congress the next week, and they really wanted to be able to show that off.
I had 3 days to get some Qt demo apps running on it. I ran out and bought a Pre and got started. It was a lot of fun.
Oh, and here's our client's app running on the Pre (yes, that's WebKit):

Mission accomplished.
Here's how.
The Process
First
things first... I needed a way to load packages and interact with the
Pre. I always prefer VMs for that sort of thing, so I created a VirtualBox Ubuntu 9.10
i386 VM.
The Palm Pre is a
very open platform. There's a developer mode, which is enabled with a
simple password-like phrase in the search box. A root linux shell is
then accessed by simply running a terminal from a Palm-provided
package. How cool is that? That is OPEN.
I had a simple Qt app
running on the Palm Pre before this, with no screen, keyboard, or
touchscreen plugins. This was our initial test. We had to kill the
Pre's GUI (Luna) to run it, but it worked. A little investigating
showed the keyboard would be fairly easy. A homebrew game on the Pre
we were familiar with (Doom) ran fully integrated within Luna using the
SDL libraries on the Pre, so we figured this was the way to go.
Over
the next day or so, I got the SDL plugin to work. The keyboard plugin
was very similar to the one on the Kindle port. The touchscreen turned
out to be fairly easy using SDL as well.
Thursday, I started trying to find some Qt demos that would look good, and I started to get them running on the Pre.
Crisis!
My laptop came screeching to a halt with an unrecoverable disk error.
We keep all source code in source control, but this Palm Pre work
hadn't quite made it in yet. (I don't seem to like checking in highly fluid code)
I ran to Fry's and bought a new
laptop drive, then used ddrescue to clone it from the old drive and
attempt a recover on the bad sectors.
It turns out that only a
single 1K block on the disk went bad, somewhere in the Palm Pre VM disk
image. I quickly created a new VM (which gave me a chance to test my
instructions for Nokia) and I was back in business again.
The
whole episode lost me 8 precious hours that beforehand I fully expected
to have available (2.5 hours were just driving to Fry's and back in
rush hour traffic). So, I ended up sending the instructions and
install packages to Nokia at 2am in the morning.
Nokia reported that the install went very smoothly, and everything worked great. They've also mentioned it on the Qt blog.
Get it on PrewareThe Qt libraries and these demo applications are now available on Preware! Keep in mind this is only for the Palm Pre and Palm Pre Plus. It very likely will not work on the Pixi.
Install the "Qt Framework" package there, and any Qt demos you'd like to check out.
The plugin code is now released on the LGPL 2.1 license, to match Qt. It can be found on qt.gitorious.org (git clone git://gitorious.org/~darronb/qt/qt-palm-pre.git).
A Little Evangelism
Qt
is an excellent platform, and I find more to like about it every week.
Wouldn't it be great if every smartphone ran it? Don't just dream about it. Make it happen!
I just read about MeeGo, the combination
of Nokia's Maemo and Intel's Moblin efforts. Qt will be the default UI
platform for this... very good news.
Of course, I'm currently mostly doing desktop work with it... so it's awesome for that, too.
Go ahead, get involved! Qt is exploding.