Qtopia Home · Home · Reference · User Guide · Internals

Create a new project file

The example create_a_pro_file can be used as a hands-on example of how to create a project file.

Start by copying it somewhere and generating a basic .pro file using qtopiamake.

    $QPEDIR/bin/qtopiamake -project

This will create a file create_a_pro_file.pro with contents similar to the following.

    qtopia_project(qtopia app)
    TARGET=create_a_pro_file
    CONFIG+=qtopia_main no_quicklaunch

    # Input
    HEADERS += example.h
    FORMS += examplebase.ui
    SOURCES += example.cpp main.cpp

    # Set this to trusted for full privileges
    target.hint=sxe
    target.domain=untrusted

This file is sufficient to build the application binary but it is missing many things that should be present for a well-behaved application.

Let's start by adding some internationalization information. Not strictly required but a good idea.

    # Specify the languages that make lupdate should produce .ts files for
    AVAILABLE_LANGUAGES=en_US
    # Specify the langauges we want to install translations for
    LANGUAGES=$$AVAILABLE_LANGUAGES

Then we need to install the .desktop file for the app to appear in the launcher.

    desktop.files=example.desktop
    desktop.path=/apps/Applications
    desktop.trtarget=create_a_pro_file-nct
    desktop.hint=nct desktop
    INSTALLS+=desktop

This puts us in the Applications folder. Change the .path value to use another folder. Note that you need to perform extra steps to define new folders. See Create a launcher folder for more information.

The use of .trtarget and .hint=nct is optional but a good idea so that translations can be made.

Note that the .desktop file specifies the binary name (whatever TARGET is) and it specifies the same file for translations as the .trtarget value.

The .desktop file references a picture. We need to install it. It's best to use a general pictures directory to ensure icons and such are handled correctly.

    pics.files=pics/*
    pics.path=/pics/create_a_pro_file
    pics.hint=pics
    INSTALLS+=pics

Note the .path value. Installing images into a directory named the same as your TARGET ensures that there are no conflicts. The resource system also looks in this direcory first when trying to find images.

To satisy the online help requirement we'll install a help file.

    help.source=help
    help.files=create_a_pro_file.html
    help.hint=help
    INSTALLS+=help

Again, not the use of the TARGET name here. Online help also looks at TARGET-<objname>.html for context-sensitive help. The object name of the toplevel window is used.

Finally we'll add some packaging information so that the application can be packaged.

    pkg.name=create_a_pro_file
    pkg.desc=Example Application
    pkg.version=1.0.0-1
    pkg.maintainer=Trolltech (www.trolltech.com)
    pkg.license=Commercial

See also Tasks and Project Files.


Copyright © 2008 Nokia Qtopia Build System Documentation