(→Seeing the MeeGo UX Components) |
(→Example Programs) |
||
| Line 29: | Line 29: | ||
sudo make install | sudo make install | ||
| - | = | + | =Examples of Using Components= |
To see the components in action and to verify correct installation, we can use the three example programs provided: | To see the components in action and to verify correct installation, we can use the three example programs provided: | ||
Contents |
The meego-ux-components package [git/OBS] provides visual components for third-party developers to use to quickly create applications adhering to the MeeGo UX look-and-feel. These components are supported and are an official part of the MeeGo API for developers.
Many components in this package first appeared in the meegolabs-ux-components package [git/OBS]. Code in this package includes experimental code and early versions with unstable APIs. There is no guarantee of support for these components nor will they necessarily maintain consistent software interfaces.
Currently some component code versions exists in both meegolabs-ux-components and meego-ux-components. In order to avoid confusion for third party developers and to decrease the burden of maintaining two branches and keeping them in sync, we are deprecating code in meegolabs-ux-components where it is already available in meego-ux-components (See Components Migration).
You can install the MeeGo UX components either from the zypper (recommended) or directly form the latest version of the source code. This code assumes you are working either on a MeeGo system (Windows | Linux), within the MeeGo SDK QEMU environment, or within a MeeGo chroot configuration.
To use MeeGo UX components for your project, you will need to install the development version of the package. Using zypper:
zypper install meego-ux-components-devel
First ensure that you have an enabled Trunk source zypper repo. Bring in a source archive and all the needed build-time dependencies with:
zypper source-install meego-ux-components
We'll first clone the source from the upstream repository location on Gitorious:
git clone git://meego.gitorious.org/meego-ux/meego-ux-components
The easiest way to prepare your development environment with all the build-time dependencies is to install the source package as described above. If you don't want to do that, read the README file for instructions on installing dependent packages manually. Finally, make and install:
cd meego-ux-components qmake make sudo make install
To see the components in action and to verify correct installation, we can use the three example programs provided:
To run on a development system, use meego-qml-launcher. Your application should have a file at /usr/share/<application-name>/main.qml. This tool exports theme information to QML applications (font sizes, colors, dimensions, etc) and also ensures that your application is treated as a system-wide singleton. That is, if the app is already running, meego-qml-launcher will send a "raise" dbus signal instead of launching a second instance.
$ meego-qml-launcher --fullscreen --app meego-ux-components-widgetallery
When running on target hardware, you can add the --opengl option to use hardware graphics acceleration.
$ meego-qml-launcher --opengl --fullscreen --app meego-ux-components-widgetallery
Now that the MeeGo UX Components are installed on your system, you can begin developing a new application using the components.
Let's run it to see what it does. Click the green arrow in the lower left corner of Qt Creator. This will run the application. After a few moments a new window will appear with the text 'Hello world' Now let's add a MeeGo UX button and when it is pressed, we will change the text to say "That was easy!"
Installed with the MeeGo UX Components are a set of QML files provided as a tutorial. You can find the contents of the first file in:
/usr/share/meego-ux-tutorial/step1/main.qml.
Open that file in Qt Creator, copy its contents, and replace the contents of the QML file that Qt Creator generated for you.
You can now run that first step by clicking on the green arrow (or pressing CTRL-R on the keyboard) Save your changes when prompted.
You can explore the other tutorial steps and see what they each do. Experiment with the various components you see in the widgets gallery.