diff options
Diffstat (limited to 'examples')
30 files changed, 361 insertions, 78 deletions
diff --git a/examples/doc/changeuserinterface.qdoc b/examples/doc/changeuserinterface.qdoc index 25d7d3257..15212756c 100644 --- a/examples/doc/changeuserinterface.qdoc +++ b/examples/doc/changeuserinterface.qdoc @@ -30,7 +30,7 @@ \ingroup qtifwexamples \title Change Installer UI Example - \brief Changing the installer UI by using a component script. + \brief Using a component script to modify the installer UI. \image qtifw-examples-changeuserinterface.png diff --git a/examples/doc/componenterror.qdoc b/examples/doc/componenterror.qdoc index d4e6ef17a..39a0dcb84 100644 --- a/examples/doc/componenterror.qdoc +++ b/examples/doc/componenterror.qdoc @@ -30,7 +30,8 @@ \ingroup qtifwexamples \title Component Error Example - \brief Stopping the installation if the components cannot be installed. + \brief Using a component script to stop the installation if the components + cannot be installed. \image qtifw-examples-componenterror.png diff --git a/examples/doc/dynamicpage.qdoc b/examples/doc/dynamicpage.qdoc index 4aba1e743..6c68fe336 100644 --- a/examples/doc/dynamicpage.qdoc +++ b/examples/doc/dynamicpage.qdoc @@ -30,11 +30,84 @@ \ingroup qtifwexamples \title Dynamic Page Installer Example - \brief Building an installer by using a script and dynamic pages. + \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-generating.qdocinc + \include installerfw-examples-packaging.qdocinc + + \list + \li The \c <Script> section specifies the file name of the JavaScript + file that is loaded to perform operations. + \li The \c <UserInterfaces> section specifies the file names of the + installer pages (.ui files) to use. + \li The \c <Name> section 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. */ diff --git a/examples/doc/images/qtifw-examples-dynamicpages.png b/examples/doc/images/qtifw-examples-dynamicpages.png Binary files differnew file mode 100644 index 000000000..61a0be894 --- /dev/null +++ b/examples/doc/images/qtifw-examples-dynamicpages.png diff --git a/examples/doc/images/qtifw-examples-modifyextract.png b/examples/doc/images/qtifw-examples-modifyextract.png Binary files differnew file mode 100644 index 000000000..d189d0b3e --- /dev/null +++ b/examples/doc/images/qtifw-examples-modifyextract.png diff --git a/examples/doc/images/qtifw-examples-openreadme.png b/examples/doc/images/qtifw-examples-openreadme.png Binary files differnew file mode 100644 index 000000000..4cebedc75 --- /dev/null +++ b/examples/doc/images/qtifw-examples-openreadme.png diff --git a/examples/doc/images/qtifw-examples-quit_installer.png b/examples/doc/images/qtifw-examples-quit_installer.png Binary files differnew file mode 100644 index 000000000..12e94f0a1 --- /dev/null +++ b/examples/doc/images/qtifw-examples-quit_installer.png diff --git a/examples/doc/images/qtifw-examples-registerfileextension.png b/examples/doc/images/qtifw-examples-registerfileextension.png Binary files differnew file mode 100644 index 000000000..467c6f603 --- /dev/null +++ b/examples/doc/images/qtifw-examples-registerfileextension.png diff --git a/examples/doc/images/qtifw-examples-startmenu.png b/examples/doc/images/qtifw-examples-startmenu.png Binary files differnew file mode 100644 index 000000000..f332f2381 --- /dev/null +++ b/examples/doc/images/qtifw-examples-startmenu.png diff --git a/examples/doc/modifyextract.qdoc b/examples/doc/modifyextract.qdoc index fd5b5ebe5..7dbd455c2 100644 --- a/examples/doc/modifyextract.qdoc +++ b/examples/doc/modifyextract.qdoc @@ -30,11 +30,41 @@ \ingroup qtifwexamples \title Modify Extract Installer Example - \brief Using the extract archive hook to modify the target path. + \brief Using the extract archive hook in a component script to modify the + target path. + + \image qtifw-examples-modifyextract.png + + \e{Modify Extract Installer} illustrates how to overwrite the + \c{component.createOperationsForArchive()} function to be able to install a + component to a modified path. \include installerfw-examples-configuring.qdocinc \quotefile modifyextract/config/config.xml + \include installerfw-examples-packaging.qdocinc + + \list + \li The \c <Default> section is set to \c true to preselect the + component in the installer. + \li The \c <Script> section specifies the file name of the JavaScript + file that is loaded to perform operations. + \endlist + + \quotefile modifyextract/packages/org.qtproject.ifw.example.modifyextract/meta/package.xml + + \section1 Modifying Target Path + + In installscript.js, we overwrite the default + \c{component.createOperationsForArchive()} implementation to be able to + register an \c Extract operation with a custom argument: + + \quotefromfile modifyextract/packages/org.qtproject.ifw.example.modifyextract/meta/installscript.js + \skipto createOperationsForArchive + \printuntil { + \skipto component.addOperation + \printuntil } + \include installerfw-examples-generating.qdocinc */ diff --git a/examples/doc/openreadme.qdoc b/examples/doc/openreadme.qdoc index 165caf4e2..be24df084 100644 --- a/examples/doc/openreadme.qdoc +++ b/examples/doc/openreadme.qdoc @@ -30,12 +30,58 @@ \ingroup qtifwexamples \title Open ReadMe Example - \brief Adding a check box for opening the readme file to the final - installer page. + \brief Using a component script to add a check box for opening the readme + file to the final installer page. + + \image qtifw-examples-openreadme.png + + \e{Open ReadMe} illustrates how to use the \c Component() function to add a + check box to the installation finished page and to open the readme file if + end users select the check box. \include installerfw-examples-configuring.qdocinc \quotefile openreadme/config/config.xml + \include installerfw-examples-packaging.qdocinc + + \list + \li The \c <Default> section is set to \c true to preselect the + component in the installer. + \li The \c <Script> section specifies the file name of the JavaScript + file that is loaded to perform operations. + \li The \c <UserInterfaces> section specifies the file name of the + installer page (.ui file) to use. + \endlist + + \quotefile openreadme/packages/or.qtproject.ifw.example.openreadme/meta/package.xml + + \section1 Opening Files After Installation + + In installscript.qs, we use the \c Component() function to connect to the + \c installationFinishedPageIsShown signal when the installation is complete + and to the \c installationFinished signal when the end users click + \uicontrol Finish (\uicontrol Done on OS X): + + \quotefromfile openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs + \skipto Component() + \printuntil } + + We call the component::createOperations() function to override the default + method for creating operations: + + \printuntil } + + If the installation is successful, we call the installer::addWizardPageItem() + function to replace the last installer page with a custom page that contains + the \uicontrol {OpenReadMe} check box: + + \printuntil /^\}/ + + We set the \c readMeCheckBox to \c checked by default and use the + QDesktopServices::openURL() function to open the readme file: + + \printuntil /^\}/ + \include installerfw-examples-generating.qdocinc */ diff --git a/examples/doc/quit_installer.qdoc b/examples/doc/quit_installer.qdoc index bb1655ad2..c73dddd48 100644 --- a/examples/doc/quit_installer.qdoc +++ b/examples/doc/quit_installer.qdoc @@ -30,11 +30,49 @@ \ingroup qtifwexamples \title Quit Installer Example - \brief Quitting an installer by using a script. + \image qtifw-examples-quit_installer.png + + \brief Using a component script to quit an installer. + + \e{Quit Installer} illustrates how to use the \c Component() function to + display a message box to end users for quitting the installation if some + requirements for the installation are not met. \include installerfw-examples-configuring.qdocinc \quotefile quit_installer/config/config.xml + \include installerfw-examples-packaging.qdocinc + + \list + \li The \c <Default> element is set to \c true to preselect the + component in the installer. + \li The \c <Script> element specifies the file name of the JavaScript + file that is loaded to perform operations. + \endlist + + \quotefile quit_installer/packages/org.qtproject.ifw.example.quitinstaller/meta/package.xml + + \section1 Quitting the Installation + + In installscript.js, we use the \c Component() function to display a + message box for quitting the installer to end users: + + \quotefromfile quit_installer/packages/org.qtproject.ifw.example.quitinstaller/meta/installscript.js + \skipto Component() + \printuntil QMessageBox.Ok + + If end users select \uicontrol OK, we use the \c installer::setValue() + function to display a message and the \c installer.setDefaultPageVisible() + function to hide the subsequent installer pages: + + \printuntil NextButton + + If end users select \uicontrol Cancel, we display the default installer + pages and use the \c installer::setValue() function to display another + message on the last installer page: + + \printuntil /^\}/ + \include installerfw-examples-generating.qdocinc */ diff --git a/examples/doc/registerfileextension.qdoc b/examples/doc/registerfileextension.qdoc index 6b9c41e68..4c1cc5769 100644 --- a/examples/doc/registerfileextension.qdoc +++ b/examples/doc/registerfileextension.qdoc @@ -30,11 +30,81 @@ \ingroup qtifwexamples \title Register File Extension Example - \brief Registering a filename extension on Windows. + \brief Using a component script to register a filename extension on Windows. + + \image qtifw-examples-registerfileextension.png + + \e{Register File Extension} illustrates how to register a file type on + Windows. We use the \c component.addOperation() function with the + \c RegisterFileType operation to register a randomly generated file type to + be opened with Notepad. \include installerfw-examples-configuring.qdocinc \quotefile registerfileextension/config/config.xml + \include installerfw-examples-packaging.qdocinc + + \list + \li The \c <Default> element is set to \c true to preselect the + component in the installer. + \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. + \endlist + + \quotefile registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/package.xml + + \section1 Registering File Extensions + + In installscript.qs, we call the \c Component() function to connect to the + \c addRegisterFileCheckBox signal as soon as all components have been + loaded: + + \quotefromfile registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs + \skipto Component() + \printuntil addRegisterFileCheckBox + + We use the \c addRegisterFileCheckBox() function to display a check box for + registering the generated file type on the last page of the installer. + We hide the page when updating and uninstalling: + + \skipto addRegisterFileCheckBox + \printuntil ) + \skipto isInstaller() + \printuntil /^\}/ + + We connect to the \c openRegisteredFileIfChecked signal when end users + select \uicontrol Finish on the last installer page: + + \quotefromfile registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs + \skipto openRegisteredFileIfChecked + \printuntil ; + + We call the \c openRegisteredFileIfChecked function to check that the + file type was successfully registered: + + \skipto openRegisteredFileIfChecked + \printuntil /^\}/ + + We bind the \c unusualFileType variable to the \c generateUnusualFileType() + function that randomly generates a file type with the specified length: + + \quotefromfile registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs + \skipto generateUnusualFileType + \printuntil randomString + \printuntil } + + We use the \c RegisterFileType operation to create a file of the + specified type and to specify the application to open the file with: + + \quotefromfile registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs + \skipto component.createOperations() + \printuntil /^\}/ + \include installerfw-examples-generating.qdocinc + + After running the installer, double-click the installed file, + \c registeredfile.<extension>, to open it in Notepad. */ diff --git a/examples/doc/startmenu.qdoc b/examples/doc/startmenu.qdoc index 1c9c98e49..33ed6d31f 100644 --- a/examples/doc/startmenu.qdoc +++ b/examples/doc/startmenu.qdoc @@ -30,11 +30,44 @@ \ingroup qtifwexamples \title Start Menu Shortcut Example - \brief Adding an entry to the Windows Start menu. + \brief Using a component script to add an entry to the Windows Start menu. + + \image qtifw-examples-startmenu.png + + \e{Start Menu} illustrates how to use the \gui Component function to add an + entry for opening a README file to the Windows \uicontrol Start menu. \include installerfw-examples-configuring.qdocinc \quotefile startmenu/config/config.xml + \include installerfw-examples-packaging.qdocinc + + \list + \li The \c <Default> element is set to \c true to preselect the + component in the installer. + \li The \c <Script> element specifies the file name of the JavaScript + file that is loaded to perform operations. + \endlist + + \quotefile startmenu/packages/org.qtproject.ifw.example/meta/package.xml + + \section1 Adding Entries to Start Menu + + In installscript.qs, we use the \c createOperations() function to call the + component::createOperations() function, which creates the \c Extract + operation by default: + + \quotefromfile startmenu/packages/org.qtproject.ifw.example/meta/installscript.qs + \skipto createOperations + \printuntil { + \skipto createOperations + \printuntil ; + + On Windows, we use the component::addOperation function to add a shortcut + to the \uicontrol Start menu for opening the readme file: + + \printuntil /^\}/ + \include installerfw-examples-generating.qdocinc */ diff --git a/examples/doc/systeminfo.qdoc b/examples/doc/systeminfo.qdoc index bd5ed2779..da3b99c10 100644 --- a/examples/doc/systeminfo.qdoc +++ b/examples/doc/systeminfo.qdoc @@ -30,7 +30,8 @@ \ingroup qtifwexamples \title System Information Example - \brief Checking operating system version and bitness in a script. + \brief Using the systemInfo API in a component script to check operating + system version and bitness. The \e{System Information Example} demonstrates how to use the \l{systemInfo} API to detect details about the target operating system. diff --git a/examples/dynamicpage/config/config.xml b/examples/dynamicpage/config/config.xml index d65946b9b..b91922546 100644 --- a/examples/dynamicpage/config/config.xml +++ b/examples/dynamicpage/config/config.xml @@ -4,6 +4,6 @@ <Version>1.0.0</Version> <Title>Dynamic Page Installer Example</Title> <Publisher>Qt-Project</Publisher> - <StartMenuDir>Qt Installer Framework Example</StartMenuDir> - <TargetDir>@HomeDir@/IFWDynamicPageInstallerExample</TargetDir> + <StartMenuDir>Qt IFW Examples</StartMenuDir> + <TargetDir>@HomeDir@/IfwExample</TargetDir> </Installer> diff --git a/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage.node2/data/data.node2..txt b/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage.node2/data/data.node2.txt index f40001983..f40001983 100644 --- a/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage.node2/data/data.node2..txt +++ b/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage.node2/data/data.node2.txt diff --git a/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage/meta/installscript.js b/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage/meta/installscript.js index f56bbeaaa..37a79c983 100644 --- a/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage/meta/installscript.js +++ b/examples/dynamicpage/packages/org.qtproject.ifw.example.dynamicpage/meta/installscript.js @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Installer Framework. @@ -36,7 +36,7 @@ var ComponentSelectionPage = null; var Dir = new function () { this.toNativeSparator = function (path) { - if (installer.value("os") == "win") + if (systemInfo.productType === "windows") return path.replace(/\//g, '\\'); return path; } @@ -50,7 +50,7 @@ function Component() { installer.setDefaultPageVisible(QInstaller.TargetDirectory, false); installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); installer.setDefaultPageVisible(QInstaller.LicenseCheck, false); - if (installer.value("os") == "win") + if (systemInfo.productType === "windows") installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false); installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false); } @@ -76,7 +76,7 @@ Component.prototype.installerLoaded = function () { widget.completeInstall.toggled.connect(this, Component.prototype.completeInstallToggled); widget.defaultInstall.checked = true; - widget.windowTitle = "Please select a installation type"; + widget.windowTitle = "Select Installation Type"; } if (installer.addWizardPage(component, "LicenseWidget", QInstaller.LicenseCheck)) { diff --git a/examples/modifyextract/config/config.xml b/examples/modifyextract/config/config.xml index 2f365dbcc..1ff8ead0c 100644 --- a/examples/modifyextract/config/config.xml +++ b/examples/modifyextract/config/config.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <Installer> - <Name>Modify extract Installer Example</Name> + <Name>Modify Extract Installer Example</Name> <Version>1.0.0</Version> - <Title>Modify extract Installer Example</Title> + <Title>Modify Extract Installer Example</Title> <Publisher>Qt-Project</Publisher> - <StartMenuDir>Qt Installer Framework Example</StartMenuDir> - <TargetDir>@HomeDir@/IFWModifyExtractInstallerExample</TargetDir> + <StartMenuDir>Qt IFW Examples</StartMenuDir> + <TargetDir>@HomeDir@/IfwExample</TargetDir> </Installer> diff --git a/examples/modifyextract/packages/org.qtproject.ifw.example.modifyextract/meta/package.xml b/examples/modifyextract/packages/org.qtproject.ifw.example.modifyextract/meta/package.xml index ed7bce619..18f51b39a 100644 --- a/examples/modifyextract/packages/org.qtproject.ifw.example.modifyextract/meta/package.xml +++ b/examples/modifyextract/packages/org.qtproject.ifw.example.modifyextract/meta/package.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <Package> - <DisplayName>modify extract operation</DisplayName> + <DisplayName>Modify extract operation</DisplayName> <Description>A component that uses a hook to modify the extract operation.</Description> <Version>1.0.1</Version> - <ReleaseDate>2013-02-27</ReleaseDate> + <ReleaseDate>2014-12-19</ReleaseDate> <Default>true</Default> <Script>installscript.js</Script> </Package> diff --git a/examples/openreadme/config/config.xml b/examples/openreadme/config/config.xml index b1ec192e6..bd6092a8a 100644 --- a/examples/openreadme/config/config.xml +++ b/examples/openreadme/config/config.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <Installer> - <Name>Qt Installer Framework - Open ReadMe Example</Name> + <Name>Open Readme Example</Name> <Version>1.0.0</Version> - <Title>Qt Installer Framework - Open Readme Example</Title> + <Title>Open Readme Example</Title> <Publisher>Qt-Project</Publisher> - <StartMenuDir>Qt Installer Framework - 'Open ReadMe' Example</StartMenuDir> - <TargetDir>@HomeDir@/IFWOpenReadMeExample</TargetDir> + <StartMenuDir>Qt IFW Examples</StartMenuDir> + <TargetDir>@HomeDir@/IfwExample</TargetDir> </Installer> diff --git a/examples/quit_installer/config/config.xml b/examples/quit_installer/config/config.xml index 36717025c..896c9f91b 100644 --- a/examples/quit_installer/config/config.xml +++ b/examples/quit_installer/config/config.xml @@ -4,6 +4,6 @@ <Version>1.0.0</Version> <Title>Quit Installer Example</Title> <Publisher>Qt-Project</Publisher> - <StartMenuDir>Qt Installer Framework Example</StartMenuDir> - <TargetDir>@HomeDir@/IFWQuitInstallerExample</TargetDir> + <StartMenuDir>Qt IFW Examples</StartMenuDir> + <TargetDir>@HomeDir@/IfwExample</TargetDir> </Installer> diff --git a/examples/quit_installer/packages/org.qtproject.ifw.example.quitinstaller/meta/installscript.js b/examples/quit_installer/packages/org.qtproject.ifw.example.quitinstaller/meta/installscript.js index 6075a00f1..713f86765 100644 --- a/examples/quit_installer/packages/org.qtproject.ifw.example.quitinstaller/meta/installscript.js +++ b/examples/quit_installer/packages/org.qtproject.ifw.example.quitinstaller/meta/installscript.js @@ -35,9 +35,9 @@ function Component() { var result = QMessageBox["question"]("test.quit", "Installer", "Do you want to quit the installer?<br>" + - "This message box was created through javascript.", QMessageBox.Ok | QMessageBox.Cancel); + "This message box was created using JavaScript.", QMessageBox.Ok | QMessageBox.Cancel); if (result == QMessageBox.Ok) { - installer.setValue("FinishedText", "<font color='red' size=10>This installer was quit.</font>"); + installer.setValue("FinishedText", "<font color='red' size=3>The installer was quit.</font>"); installer.setDefaultPageVisible(QInstaller.TargetDirectory, false); installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false); installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); @@ -47,6 +47,6 @@ function Component() gui.clickButton(buttons.NextButton); } else { installer.setValue("FinishedText", - "<font color='green' size=10>The installer was not quit from javascript.</font>"); + "<font color='green' size=3>The installer was not quit by JavaScript.</font>"); } } diff --git a/examples/registerfileextension/config/config.xml b/examples/registerfileextension/config/config.xml index fbc5e3b79..f7bff22f7 100644 --- a/examples/registerfileextension/config/config.xml +++ b/examples/registerfileextension/config/config.xml @@ -4,6 +4,6 @@ <Version>1.0.0</Version> <Title>Register File Extension Example</Title> <Publisher>Qt-Project</Publisher> - <StartMenuDir>Register File Extension Example</StartMenuDir> - <TargetDir>@HomeDir@/IFWRegisterFileExtensionExample</TargetDir> + <StartMenuDir>Qt IFW Examples</StartMenuDir> + <TargetDir>@HomeDir@/IfwExample</TargetDir> </Installer> diff --git a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs index cd45bd548..c4724e509 100644 --- a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs +++ b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/installscript.qs @@ -34,10 +34,10 @@ function Component() { - component.loaded.connect(this, my_componentLoaded); - installer.finishButtonClicked.connect(this, my_installationFinished); - installer.installationFinished.connect(this, my_installationFinishedPageIsShown); - component.unusalFileType = generateUnusualFileType(5) + component.loaded.connect(this, addRegisterFileCheckBox); + installer.installationFinished.connect(this, addOpenFileCheckBoxToFinishPage); + installer.finishButtonClicked.connect(this, openRegisteredFileIfChecked); + component.unusualFileType = generateUnusualFileType(5) } generateUnusualFileType = function(length) @@ -51,65 +51,56 @@ generateUnusualFileType = function(length) } // called as soon as the component was loaded -my_componentLoaded = function() +addRegisterFileCheckBox = function() { - // don't show when updating / de-installing + // don't show when updating or uninstalling if (installer.isInstaller()) { - installer.addWizardPageItem(component, "RegisterFileCheckBoxesForm", QInstaller.TargetDirectory); - component.userInterface("RegisterFileCheckBoxesForm").RegisterFileCheckBox.text = - component.userInterface("RegisterFileCheckBoxesForm").RegisterFileCheckBox.text + component.unusalFileType; + installer.addWizardPageItem(component, "RegisterFileCheckBoxForm", QInstaller.TargetDirectory); + component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.text = + component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.text + component.unusualFileType; } } -// called after everything is set up, but before any fie is written -Component.prototype.beginInstallation = function() -{ - // call default implementation which is necessary for most hooks - // in beginInstallation case it makes nothing - component.beginInstallation(); - - component.registeredFile = installer.value("TargetDir") + "/registeredfile." + component.unusalFileType; -} - // here we are creating the operation chain which will be processed at the real installation part later Component.prototype.createOperations = function() { // call default implementation to actually install the registeredfile component.createOperations(); - var iconId = 0; - var notepadPath = installer.environmentVariable("SystemRoot") + "\\notepad.exe"; - var isRegisterFileChecked = component.userInterface("RegisterFileCheckBoxesForm").RegisterFileCheckBox.checked; + var isRegisterFileChecked = component.userInterface("RegisterFileCheckBoxForm").RegisterFileCheckBox.checked; if (installer.value("os") === "win") { + var iconId = 0; + var notepadPath = installer.environmentVariable("SystemRoot") + "\\notepad.exe"; component.addOperation("RegisterFileType", - component.unusalFileType, + component.unusualFileType, notepadPath + " '%1'", "QInstaller Framework example file type", "text/plain", notepadPath + "," + iconId, - "ProgId=QtProject.QtInstallerFramework." + component.unusalFileType); + "ProgId=QtProject.QtInstallerFramework." + component.unusualFileType); } - component.addOperation("Move", "@TargetDir@/registeredfile", component.registeredFile); + component.fileWithRegisteredType = installer.value("TargetDir") + "/registeredfile." + component.unusualFileType + component.addOperation("Move", "@TargetDir@/registeredfile", component.fileWithRegisteredType); } -my_installationFinished = function() +openRegisteredFileIfChecked = function() { if (!component.installed) return; if (installer.value("os") == "win" && installer.isInstaller() && installer.status == QInstaller.Success) { - var isOpenRegisteredFileChecked = component.userInterface("OpenFileCheckBoxesForm").OpenRegisteredFileCheckBox.checked; + var isOpenRegisteredFileChecked = component.userInterface("OpenFileCheckBoxForm").OpenRegisteredFileCheckBox.checked; if (isOpenRegisteredFileChecked) { - QDesktopServices.openUrl("file:///" + component.registeredFile); + QDesktopServices.openUrl("file:///" + component.fileWithRegisteredType); } } } -my_installationFinishedPageIsShown = function() +addOpenFileCheckBoxToFinishPage = function() { if (installer.isInstaller() && installer.status == QInstaller.Success) { - installer.addWizardPageItem(component, "OpenFileCheckBoxesForm", QInstaller.InstallationFinished); - component.userInterface("OpenFileCheckBoxesForm").OpenRegisteredFileCheckBox.text = - component.userInterface("OpenFileCheckBoxesForm").OpenRegisteredFileCheckBox.text + component.unusalFileType; + installer.addWizardPageItem(component, "OpenFileCheckBoxForm", QInstaller.InstallationFinished); + component.userInterface("OpenFileCheckBoxForm").OpenRegisteredFileCheckBox.text = + component.userInterface("OpenFileCheckBoxForm").OpenRegisteredFileCheckBox.text + component.unusualFileType; } } diff --git a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/openfilecheckboxesform.ui b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/openfilecheckboxform.ui index b9bcd24da..84b097685 100644 --- a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/openfilecheckboxesform.ui +++ b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/openfilecheckboxform.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>OpenFileCheckBoxesForm</class> - <widget class="QWidget" name="OpenFileCheckBoxesForm"> + <class>OpenFileCheckBoxForm</class> + <widget class="QWidget" name="OpenFileCheckBoxForm"> <property name="geometry"> <rect> <x>0</x> diff --git a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/package.xml b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/package.xml index daa47c10c..4ac1ea897 100644 --- a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/package.xml +++ b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/package.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <Package> - <DisplayName>register a file extension</DisplayName> - <Description>Register a random generated file extension to open with notepad.exe</Description> + <DisplayName>Register a file extension</DisplayName> + <Description>Register a randomly generated file extension to open with notepad.exe</Description> <Version>1.0.0-1</Version> <ReleaseDate>2013-01-01</ReleaseDate> <Default>true</Default> <Script>installscript.qs</Script> <UserInterfaces> - <UserInterface>registerfilecheckboxesform.ui</UserInterface> - <UserInterface>openfilecheckboxesform.ui</UserInterface> + <UserInterface>registerfilecheckboxform.ui</UserInterface> + <UserInterface>openfilecheckboxform.ui</UserInterface> </UserInterfaces> </Package> diff --git a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/registerfilecheckboxesform.ui b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/registerfilecheckboxform.ui index ccddacda2..4db8f0daf 100644 --- a/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/registerfilecheckboxesform.ui +++ b/examples/registerfileextension/packages/org.qtproject.ifw.example.registerfileextension/meta/registerfilecheckboxform.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>RegisterFileCheckBoxesForm</class> - <widget class="QWidget" name="RegisterFileCheckBoxesForm"> + <class>RegisterFileCheckBoxForm</class> + <widget class="QWidget" name="RegisterFileCheckBoxForm"> <property name="geometry"> <rect> <x>0</x> diff --git a/examples/startmenu/config/config.xml b/examples/startmenu/config/config.xml index e95445d1b..8da61b26e 100644 --- a/examples/startmenu/config/config.xml +++ b/examples/startmenu/config/config.xml @@ -5,6 +5,6 @@ <Title>Start Menu Shortcut Example</Title> <Publisher>Qt-Project</Publisher> <!-- Directory name is used in component.xml --> - <StartMenuDir>Qt Installer Framework Example</StartMenuDir> - <TargetDir>@HomeDir@/IFWStartMenuExample</TargetDir> + <StartMenuDir>Qt Installer Framework Examples</StartMenuDir> + <TargetDir>@HomeDir@/IfwExample</TargetDir> </Installer> diff --git a/examples/startmenu/packages/org.qtproject.ifw.example/meta/installscript.qs b/examples/startmenu/packages/org.qtproject.ifw.example/meta/installscript.qs index 15af2df12..7fbdf258d 100644 --- a/examples/startmenu/packages/org.qtproject.ifw.example/meta/installscript.qs +++ b/examples/startmenu/packages/org.qtproject.ifw.example/meta/installscript.qs @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Installer Framework. @@ -42,7 +42,7 @@ Component.prototype.createOperations = function() // call default implementation to actually install README.txt! component.createOperations(); - if (installer.value("os") === "win") { + if (systemInfo.productType === "windows") { component.addOperation("CreateShortcut", "@TargetDir@/README.txt", "@StartMenuDir@/README.lnk", "workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll", "iconId=2"); |