Apps for the Ubuntu Phone

Slashdot it! Delicious Share on Facebook Tweet! Digg!
©Canonical

©Canonical

Mobile Apps

Canonical offers a tutorial showing how you can develop "Ubuntu for phone" apps even today. We'll summarize the important points.

Ubuntu looks ready to take on the world of smartphones. Canonical successfully scored lots of media attention when the company announced plans for the smartphone based on Ubuntu. Not so successful was our test of downloading and installing the operating system on a smartphone; however, Canonical is expected to provide the corresponding images in February 2013 (that is, by the time you read this article).

Developers nevertheless have some good news, in that the QML Toolkit can help you develop the first apps for "Ubuntu for phones." In this article, I'll describe how to set up the development environment, relying for the most part on instructions from app developer David Planella. At Canonical, Planella is responsible for the efforts surrounding the new Apps software category. He put together a website [1] encouraging aspiring app developers to use QML for Ubuntu (see the "What Is QML?" box).

What Is QML?

QML stands for Qt Modeling Language and is a part of Qt Quick, which is used for creating graphical interfaces for the Qt framework. As a scripting language, QML integrates JavaScript into the Qt 5 framework, which is based on C++ and is especially suited for designing sleek graphical interfaces for mobile applications. It interprets the runtime Qt declaratives with QML written code.

I'll show how you can set up a development environment with Qt Creator. I won't go into the code itself, because some good online resources are available that I'll present later in the article. The prerequisite is that you use Ubuntu 12.10, because the components are intended for the Quantal Quetzal release. The Quantal packages can, with a bit of an adjustment, also be installed on Ubuntu 12.04; however, I wasn't able to test that option [2].

At this writing, the components for the QML Toolkit are not yet in the official Canonical repositories. Ubuntu 13.04 likely will officially provide all the packages. Thus, the method provided here is a moving target and the details could change. See the Ubuntu "Go Mobile" site for updates on the installation process [3].

Hands On: Qt 5

To start, you need the current version of Qt 5, which you can get from a PPA for package management. Use the following lines of code:

$ sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-proper
$ sudo apt-get update
$ sudo apt-get install qt5-meta-full

The last-installed qt5-meta-full package gathers the essential packages onto the computer. The executable Qt applications are in the /opt/qt5/bin directory. To run them system-wide in Ubuntu, set the following path for Bash. Use Ctrl+Alt+T to open a terminal and enter the following:

$ echo 'export PATH=/opt/qt5/bin:$PATH' >> ~/.bashrc

The path now lands in the hidden configuration file ~/.bashrc .

QML Toolkit

The qt-components are reusable QML files or Qt Quick components (certain buttons and other graphical elements). Ubuntu also uses these components, and you install them from a PPA as follows:

$ sudo add-apt-repository ppa:ui-toolkit/ppa
$ sudo apt-get update
$ sudo apt-get install qt-components-ubuntu*notepad-qml qtcreator

As you can see, you're also loading the Qt Creator on your computer. This graphical application helps design GUIs with Qt and is also ideal for building the desired QML interfaces; however, you do need to link the Integrated Development Environment (IDE) with qmlscene to test the code from Qt Creator: qmlscene is a viewer for QML documents.

Buy this article as PDF

Express-Checkout as PDF

Pages: 2

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content