/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** 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 The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/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$ ** ****************************************************************************/ // ********************************************************************** // NOTE: the sections are not ordered by their logical order to avoid // reshuffling the file each time the index order changes (i.e., often). // Run the fixnavi.pl script to adjust the links to the index order. // ********************************************************************** /*! \contentspage{index.html}{Qt Installer Framework} \page index.html \nextpage ifw-overview.html \title Qt Installer Framework Manual \section1 Version \ifwversion The Qt Installer Framework provides a set of tools and utilities to create installers for the supported desktop Qt platforms: Linux, Microsoft Windows, and OS X. \note Report bugs and suggestions for the Qt Installer Framework project in the \l{https://bugreports.qt.io/browse/QTIFW}{Qt Bugtracker}. \list \li \l{Overview of Qt Installer Framework} \li \l{Getting Started} \li \l{End User Workflows} \list \li \l{Initial Installation} \li \l{Adding Components} \li \l{Removing Components} \li \l{Updating Components} \li \l{Specifying Settings} \endlist \li \l{Tutorial: Creating an Installer} \li \l{Creating Installers} \list \li \l{Creating Offline Installers} \li \l{Creating Online Installers} \li \l{Promoting Updates} \li \l{Customizing Installers} \endlist \li \l{Qt Installer Framework Examples} \li \l{Reference} \list \li \l{Configuration File} \li \l{Package Directory} \li \l{Controller Scripting} \li \l{Component Scripting} \li \l{Operations} \li \l{Tools} \li \l{Scripting API} \li \l{C++ API} \endlist \li \l{Known Issues} \endlist */ /*! \contentspage index.html \previouspage ifw-tutorial.html \page ifw-creating-installers.html \nextpage ifw-offline-installers.html \title Creating Installers The following steps are needed to create offline and online installers: \list 1 \li Create a \e {package directory} for the installable components. For more information, see \l{Package Directory}. \li Create a configuration file called \c config.xml in the \c config directory. It contains information about how to build the installer binaries and online repositories. For more information about the file format and available settings, see \l{Configuration File}. \li Create a package information file called \c package.xml in the \c {config\meta} directory. It contains settings for deployment and the installation process. For more information, see \l{Meta Directory}. \li Create installer content and copy it to the package directory. For more information, see \l{Data Directory}. \li For online installers, use the \c repogen tool to create the repository that contains the installable content and upload the repository to a web server. \li Use the \c binarycreator tool to create the installer. For more information, see \l{Tools}. \endlist For an example of how to create a simple installer that uses the predefined installer pages, see \l{Tutorial: Creating an Installer}. The following sections describe how to create different types of installers: \list \li \l{Creating Offline Installers} \li \l{Creating Online Installers} \li \l{Promoting Updates} \li \l{Customizing Installers} \endlist */ /*! \contentspage index.html \previouspage ifw-reference.html \page ifw-globalconfig.html \nextpage ifw-component-description.html \title Configuration File The configuration file customizes the UI and behavior of an installer. The file is typically called \c config.xml and located in the \c config directory. A minimal configuration file consists of an \c root element with \c and \c elements as children. All other elements are optional, and can appear in arbitrary order. The following example shows a typical configuration file: \quotefile examples/config.xml \section1 Summary of Configuration File Elements The following table summarizes the elements in the configuration file. \note We recommend that you place all files that you refer to in the configuration file in the \c config directory. However, you can also use relative paths, which the tools resolve relative to the location of the config.xml file. You can use predefined variables (embedded in @ characters) as values of the elements. For more information, see \l{Predefined Variables}. \table \header \li Element \li Description \row \li Name \target ProductNameTarget \li Name of the product being installed. This is mandatory. \row \li Version \li Version of the product being installed in the following format: [0-9]+((\\.|-)[0-9]+)* such as 1-1; 1.2-2; 3.4.7. This is mandatory. \row \li Title \li Name of the installer as displayed on the title bar. \row \li Publisher \li Publisher of the software (as shown in the Windows Control Panel). \row \li ProductUrl \li URL to a page that contains product information on your web site. \row \li Icon \li Filename for a custom installer icon. The actual file is looked up by attaching a '.icns' (OS X), '.ico' (Windows) or '.png' (Unix) suffix. Deprecated, use \c or \c instead. \row \li InstallerApplicationIcon \li Filename for a custom installer icon. The actual file is looked up by attaching a '.icns' (OS X), '.ico' (Windows). No functionality on Unix. \row \li InstallerWindowIcon \li Filename for a custom window icon in PNG format for the Installer application. \row \li Logo \li Filename for a logo used as \c QWizard::LogoPixmap. \row \li Watermark \li Filename for a watermark used as \c QWizard::WatermarkPixmap. \row \li Banner \li Filename for a banner used as \c QWizard::BannerPixmap (only used by ModernStyle). \row \li Background \li Filename for an image used as \c QWizard::BackgroundPixmap (only used by MacStyle). \row \li WizardStyle \li Set the wizard style to be used ("Modern", "Mac", "Aero" or "Classic"). \row \li StyleSheet \li Set the stylesheet file. \row \li WizardDefaultWidth \li Sets the default width of the wizard in pixels. Setting a banner image will override this. You can add the \c em or \c ex suffix to the specified value to use the \e em or \e ex unit, as in a CSS file. \row \li WizardDefaultHeight \li Sets the default height of the wizard in pixels. Setting a watermark image will override this. You can add the \c em or \c ex suffix to the specified value to use the \e em or \e ex unit, as in a CSS file. \row \li TitleColor \li Set the color of the titles and subtitles (takes an HTML color code, such as "#88FF33"). \row \li RunProgram \li Command executed after the installer is done if the user accepts the action. Provide the full path to the application. \row \li RunProgramArguments \li Arguments passed to the program specified in \c . You can add several \c child elements that each specify an argument to \c . \row \li RunProgramDescription \li Text shown next to the check box for running the program after the installation. If \c is set but no description provided, the UI will display \uicontrol {Run now.} instead. \row \li StartMenuDir \li Name of the default program group for the product in the Windows \uicontrol Start menu. \row \li TargetDir \li Default target directory for installation. On Linux, this is usually the user's home directory. \row \li AdminTargetDir \li Default target directory for installation with administrator rights. Only available on Linux, where you usually do not want to install in the administrator user's home directory. \row \li RemoteRepositories \li List of remote repositories. This element can contain several \c child elements that each contain the \c child element that specifies the URL to access the repository. For more information, see \l{Configuring Repositories}. \row \li RepositoryCategories \li Name of a category that can contain a list of \c child elements. For more information, see \l{Configuring Repository Categories}. \row \li MaintenanceToolName \li Filename of the generated maintenance tool. Defaults to \e maintenancetool. The platform-specific executable file extension is appended. \row \li MaintenanceToolIniFile \li Filename for the configuration of the generated maintenance tool. Defaults to \e {MaintenanceToolName}.ini. \row \li RemoveTargetDir \li Set to \c false if the target directory should not be deleted when uninstalling. \row \li AllowNonAsciiCharacters \li Set to \c true if the installation path can contain non-ASCII characters. \row \li DisableAuthorizationFallback \li Set to \c true if the installation should not ask users to run the authorization fallback in case of authorization errors. Instead abort the installation immediately. \row \li RepositorySettingsPageVisible \li Set to \c false to hide the repository settings page inside the settings dialog. \row \li AllowSpaceInPath \li Set to \c false if the installation path cannot contain space characters. \row \li DependsOnLocalInstallerBinary \li Set to \c true if you want to prohibit installation from an external resource, such as a network drive. This might make sense for e.g. very big installers. The option is only used on Windows. \row \li TargetConfigurationFile \li Filename for the configuration file on the target. Default is components.xml. \row \li Translations \li List of language codes to be used for translating the user interface. To add several language variants, specify several \c child elements that each specify the name of a language variant. Optional. For more information, see \l{Translating Pages}. \row \li UrlQueryString \li This string needs to be in the form "key=value" and will be appended to archive download requests. This can be used to transmit information to the webserver hosting the repository. \row \li ControlScript \li Filename for a custom installer control script. See \l{Controller Scripting}. \row \li CreateLocalRepository \li Set to \c true if you want to create a local repository inside the installation directory. This option has no effect on online installers. The repository will be automatically added to the list of default repositories. \row \li InstallActionColumnVisible \li Set to \c true if you want to add an extra column into component tree showing install actions. This extra column indicates whether a component is going to be installed or uninstalled, or just stay installed or uninstalled. \row \li SupportsModify \li Set to \c false if the product does not support modifying an existing installation. \row \li SaveDefaultRepositories \li Set to \c false if default repositories \c should not be saved to \e {MaintenanceToolName}.ini. By default default repositories are saved. Not saving the repositories means than when you run \e maintenancetool there are no default repositories in use. \row \li AllowUnstableComponents \li Set to \c true if other components are allowed to be installed although there are unstable components. A component is \e unstable if it is missing a dependency, has errors in scripts, and so on. Unstable components are grayed in the component tree, and therefore cannot be selected. By default, the value is \c false which means that the installation will be aborted if unstable components are found. \endtable */ /*! \contentspage index.html \previouspage ifw-updates.html \page ifw-customizing-installers.html \nextpage Qt Installer Framework Examples \title Customizing Installers You can use scripting to customize installers by: \list \li Adding Qt Installer Framework \e operations that are prepared by the scripts and performed by the installer. \li Adding new pages that you specify in the package.xml file and place in the \c packages directory. \li Modifying existing pages by inserting custom user interface elements into them as single widgets. \li Adding language variants. \endlist You can use both \e {component scripts} and a \e {control script} to customize installers. A component script is associated with a particular component by specifying it in the \c Script element of the package.xml file of the component. The script is loaded when the component's metadata is fetched. For more information about component scripts, see \l{Component Scripting}. A control script is associated with the whole installer by specifying it in the \c ControlScript element of the control.xml file of the installer. Control scripts can be part of the installer resources or be passed on the command line. They can be used to modify the installer pages that are presented to users before components are loaded. Also, you can use them to modify pages in the uninstaller. For more information, see \l{Controller Scripting}. For more information about the global JavaScript objects that can be used in component and control scripts, see \l{Scripting API}. \section1 Adding Operations You can use component scripts to perform Qt Installer Framework operations during the installation process. Typically, operations manipulate files by moving, copying, or patching them. Use the QInstaller::Component::addOperation or QInstaller::Component::addElevatedOperation function to add operations. For more information, see \l {Adding Operations to Components}. In addition, you can implement methods to register custom installation operations in the installer by deriving KDUpdater::UpdateOperation. For more information, see \l {Registering Custom Operations}. For a summary of available operations, see \l {Operations}. \section1 Adding Pages A component can contain one or more user interface files, which are placed into the installer by a component or control script. The installer automatically loads all user interface files listed in the \c UserInterfaces element of the package.xml file. \section2 Using Component Scripts to Add Pages To add a new page to the installer, use the installer::addWizardPage() method and specify the location of the new page. For example, the following code adds an instance of \c MyPage before the ready for installation page: \code installer.addWizardPage( component, "MyPage", QInstaller.ReadyForInstallation ); \endcode You can use component scripts to access the loaded widgets by calling the \l component::userInterface() method with the class name of the widget, as illustrated by the following code snippet: \code component.userInterface( "MyPage" ).checkbox.checked = true; \endcode You can also have a callback for the page that is added. To access it, use the object name set in the UI file (for example, \c "MyPage"). Then create the \c{Dynamic${ObjectName}Callback} function (for example, \c {DynamicMyPageCallback}): \code Component.prototype.DynamicMyPageCallback = function() { var page = gui.pageWidgetByObjectName("DynamicMyPage"); page.myButton.click, page.myWidget.subWidget.setText("hello") } \endcode You can access widgets by using their object names that are set in the UI file. For example, \c myButton and \c myWidget are widget object names in the code above. \section1 Adding Widgets You can use component or control scripts to insert custom user interface elements into the installer as single widgets (such as a check box). To insert a single widget, use the installer::addWizardPageItem method. For example, the following code snippet adds an instance of \c MyWidget to the component selection page from within a script: \code installer.addWizardPageItem( component, "MyWidget", QInstaller.ComponentSelection ); \endcode \section1 Interacting with Installer Functionality You can use control scripts to execute installer functions automatically in tests, for example. The following snippet illustrates how to automatically click the \uicontrol Next button on the target directory selection page: \code Controller.prototype.TargetDirectoryPageCallback = function() { gui.clickButton(buttons.NextButton); } \endcode \section1 Translating Pages The installer uses the Qt Translation system to support the translation of user-readable output to several languages. To provide end users with localized versions of strings contained in the component scripts and user interfaces, create QTranslator files that the installation system loads along with the component. The installer loads the translation file that matches the current system locale. For example, if the system locale is German, the de.qm file is loaded. In addition, a localized \c license_de.txt is shown instead of the default \c license.txt if it is found. Translations need to be added to the \c package.xml file to be activated for a component: \code de.qm \endcode Use the \c {qsTr()} function for literal text within scripts. Additionally, you can add the \c Component.prototype.retranslateUi method to the script. It is called when the language of the installer changes and the translation file is loaded. The context being used for translation is the basename of the script file when using \c qsTr or the class name of the UI file when translating a user interface. For example, if the script file is called \c installscript.qs, the context will be installscript. \note The translation system can also be used to customize the UI. Use e.g. an \c en.ts file to replace any text in the installer with a custom English version. */ /*! \contentspage index.html \previouspage ifw-globalconfig.html \page ifw-component-description.html \nextpage noninteractive.html \title Package Directory Installers contain components that are either embedded to the installer or loaded from a remote repository. In both cases, you need to use a file format and structure for the components that the installer can read. \section1 Package Directory Structure Place all components in the same root directory, which is called the \e {package directory}. The directory name acts as a domain-like identifier, which identifies all components. For example, \c com.vendor.root. Within the root directory, create subdirectories called \c data and \c meta. A package directory can look as follows: \code -packages - com.vendor.root - data - meta - com.vendor.root.component1 - data - meta - com.vendor.root.component1.subcomponent1 - data - meta - com.vendor.root.component2 - data - meta \endcode \section1 Meta Directory The \c meta directory contains files that specify settings for deployment and the installation process. The files are not extracted by the installer. The directory must contain at least a package information file and all files that you refer to in the package information file, such as scripts, user interface files, and translations. \section2 Package Information File Syntax The package.xml file is the main source of information about a component. The following is an example of a package file: \quotefile examples/package.xml \section2 Summary of Package Information File Elements \table \header \li Element \li Description \row \li DisplayName \li Human-readable name of the component. Required. Specify translations for the name of the component as values of additional DisplayName tags, with the xml:lang attribute set to the correct locale. \row \li Description \li Human-readable description of the component. Required. Translations may be specified similarly to DisplayName tag. If a localization that matches the locale is not found and an untranslated version exists, that one will be used. Otherwise no Description will be shown for that locale. User clickable external links, for example a component's homepage, can be included in component description by specifying a URL address like this: {external-link}='https://www.qt.io/'. The URL must be valid and contain a full path to the desired resource. \row \li Version \li Version number of the component in the following format: [0-9]+((\\.|-)[0-9]+)* such as 1-1; 1.2-2; 3.4.7. Required. If a package needs to show the version number from a child rather than it's own (due to grouping of child packages) one can specify the attribute inheritVersionFrom with the package name the version needs to be inherited from. \row \li ReleaseDate \li Date when this component version was released. Required. \row \li Name \li Domain-like identification for this component. Required. \row \li Dependencies \li Comma-separated list of identifiers of components that this component depends on. Optionally, you can specify version numbers, separated by a dash (-). You can prefix version numbers with a comparison operator (=, >, <, >= or <=). Keep in mind that you have to use the character reference "<" to escape the left angle bracket (use "<" instead of "<" and "<=" instead of "<="). Optional. For more information, see \l{Component Dependencies}. \row \li AutoDependOn \li Comma-separated list of identifiers of components that this component has an automatic dependency on. The component is installed if and only if all of the specified dependencies are fulfilled. If a component has an automatic dependency on other components, the check box will not be visible next to the component in the component tree. The selection will be performed automatically. If the component was not installed before, it will be selected for installation only when all components from this list are also selected for installation. If the component was already installed, it will be selected for uninstallation when at least one of the components from this list is also selected for uninstallation. For more information, see \l{Component Dependencies}. \row \li Virtual \li Set to \c true to hide the component from the installer. Note that setting this on a root component does not work. \row \li SortingPriority \li Priority of the component in the tree. The tree is sorted from highest to lowest priority, with the highest priority on the top. \row \li Licenses \li List of license agreements to be accepted by the installing user. To add several licenses, add several \c child elements that each specify the license \c name and \c file. ASCII and UTF8 file formats are supported for license files. If there are translations listed for this component, the installer will also look for translated licenses. These need to have the same name as the original license file but with an added locale identifier. If for example the license file is called license.txt and there is German translation specified, the installer will also include a license_de_de.txt file (and show that when installing on a German system). \row \li Script \li File name of a script being loaded. Optional. For more information, see \l{Adding Operations}. \row \li UserInterfaces \li List of pages to load. To add several pages, add several \c child elements that each specify the filename of a page. Optional. For more information, see \l{Adding Pages}. \row \li Translations \li List of translation files to load. To add several language variants, specify several \c child elements that each specify the filename of a language variant. Optional. For more information, see \l{Translating Pages}. \row \li UpdateText \li Description added to the component description if this is an update to the component. Optional. \row \li Default \li Possible values are: \c true, \c false, and \c script. Set to \c true to preselect the component in the installer. This takes effect only on components that have no visible child components. The boolean values are evaluated directly, while \c script is resolved during runtime. Add the name of the script as a value of the \c