A couple of days ago Canonical announced Ubuntu for phones. They revealed that they will heavily rely on Qt and QML for the user experience. Since Qt is one of our specialties we wanted to see if we can run Ubuntu Phone on existing hardware already today.
Currently there are no phones available in public that run Ubuntu yet. Because of that the only way to test and develop apps today is by using your desktop computer. Since that is pretty far away from a smartphone experience we thought we could maybe run those Qt components on a Blackberry 10 device like we earlier did with the Qt Components for Symbian. The good news is, that it’s really not that difficult. But before we bore you with the details, here is a short video.
Compiling Ubuntu Phone Qt Components
As you have seen in the video the Ubuntu Phone components are still very basic (version 0.1.25), so don’t expect too much. Still if you’re interessted testing it yourself, here are a couple of pointers to get you started. If you have questions, please use the comments below.
- Download the source code from Launchpad: https://launchpadlibrarian.net/127652022/qt-components-ubuntu_0.1.25.orig.tar.gz
- Apply this patch, that resolves some compilation issues on BB10
- Setup BB10 build environment and add the path to your BB10 Qt5 binaries
- Compile using qmake && make
- The resulting components can be found under
/modules/Ubuntu/Components/
Adding the components to your BB10 app
You can handle the Ubuntu Phone components like any other component set. Just make sure you’re putting everything into your BAR file for deployment. Also don’t forget the “themes” folder. Additionally you should set the following values.
- UITK_THEME_PATH – Path where the “themes” directory can be found.
- GRID_UNIT_PX – The size of a ‘gu’ unit in pixels. For BB10 I’d suggest around 20px.
Now your bar-descriptor.xml should contain something like the following.
<env var="QML2_IMPORT_PATH" value="app/native/imports"/> <env var="QT_PLUGIN_PATH" value="app/native/plugins"/> <env var="LD_LIBRARY_PATH" value="app/native/lib"/> <env var="UITK_THEME_PATH" value="app/native"/> <env var="GRID_UNIT_PX" value="20" /> <asset path="qml">qml</asset> <asset path="themes">themes</asset> <asset path="qt5/lib">lib</asset> <asset path="qt5/plugins">plugins</asset> <asset path="qt5/imports">imports</asset>
Finals words
Of course this is all still very basic and not as fancy as shown in the promotion videos. On the other hand, this solution is available now using existing code – to get the final thing you’ll probably have to wait another year or so.
If you are planning to write a Ubuntu Phone application or if you want to help with the development of the Ubuntu Phone Qt components, you now have a way to test your code on a real device. Probably that’s not always needed, but it certainly can come in handy.
If you want to know more about this, please leave a comment below. Thanks!