summaryrefslogtreecommitdiffstats
path: root/examples/doc/dynamicpage.qdoc
blob: edfee0e365816669984d853a7088baef3529cfb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Installer Framework.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \example dynamicpage
    \ingroup qtifwexamples
    \title Dynamic Page Installer Example

    \brief Using a component script and dynamic pages to build an installer.

    \image qtifw-examples-dynamicpages.png

    \e{Dynamic Page Installer} illustrates how to use the
    \c component.loaded.connect() function to load custom installer pages (.ui)
    instead of using the default installer pages and how to add functionality to
    the pages.

    The \uicontrol {Select Installation Type} page contains icons that are added
    to a Qt resource file (.qrc) for delivery with the installer.

    \include installerfw-examples-configuring.qdocinc

    \quotefile dynamicpage/config/config.xml

    \include installerfw-examples-packaging.qdocinc

    \list
        \li The \c <Script> element specifies the file name of the JavaScript
            file that is loaded to perform operations.
        \li The \c <UserInterfaces> element specifies the file names of the
            installer pages (.ui files) to use.
        \li The \c <Name> element provides domain-like identification for the
            component.
    \endlist

    \quotefile dynamicpage/packages/org.qtproject.ifw.example.dynamicpage/meta/package.xml

    This installer contains three components that each have their own package
    information file with slightly different contents.

    \section1 Creating Dynamic Pages

    In installscript.js, we create the installer pages and add functionality to
    them.

    Qt Installer Framework calls the constructors of all scripts. When all the
    constructors are finished and all UI files are loaded, a \c loaded signal is
    emitted for each component.

    To create an installer page, we have to wait for the \c loaded signal that
    tells us that the UI file has been loaded:

    \quotefromfile dynamicpage/packages/org.qtproject.ifw.example.dynamicpage/meta/installscript.js
    \skipto component.loaded
    \printuntil ;

    We hide the default pages by setting their visibility to \c false:

    \skipto setDefaultPageVisible
    \printuntil ReadyForInstallation

    We use the \c loaded function that we connected earlier to add functionality
    to the dynamic installer pages:

    \skipto installerLoaded
    \printuntil defaultInstall.checked
    \printuntil }
    \dots

    \section1 Generating the Example Installer

    To create the example installer, switch to the example source directory on
    the command line and enter the following command:

    \list
        \li On Windows:
            \code
            ..\..\bin\binarycreator.exe -c config\config.xml -r resources/additional.qrc -p packages installer.exe
            \endcode
        \li On Linux or OS X:
            \code
            ../../bin/binarycreator -c config/config.xml -r resources/additional.qrc -p packages installer
            \endcode
    \endlist

    Because the installer uses additional resources, you must give the
    \c {-r} option and specify the path to the Qt resource file that contains
    the resources. The installer is created in the current directory.
*/