diff options
author | Kai Koehne <kai.koehne@digia.com> | 2014-03-06 13:26:12 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@digia.com> | 2014-03-11 09:00:12 +0100 |
commit | 4465f8603f303ee8488466ea1a6741e24966c914 (patch) | |
tree | f2e5d4abdd64f701595a82dc92301a6cdb1c5182 /examples/openreadme | |
parent | 608b1d83989313090b1f72b5a5a567c8674cd893 (diff) |
Add 'Open ReadMe' example
Shows how to add a 'Open ReadMe' checkbox to the final page of the installer.
Change-Id: Ibbf0fb6c4d0422c2df892a3f3e636fc20312e56b
Reviewed-by: Niels Weber <niels.weber@digia.com>
Diffstat (limited to 'examples/openreadme')
6 files changed, 140 insertions, 0 deletions
diff --git a/examples/openreadme/README b/examples/openreadme/README new file mode 100644 index 000000000..43e109350 --- /dev/null +++ b/examples/openreadme/README @@ -0,0 +1,6 @@ +Shows how to add a 'Open ReadMe' checkbox to the final page. + +Generate installer with + +binarycreator --offline-only -c config/config.xml -p packages installer + diff --git a/examples/openreadme/config/config.xml b/examples/openreadme/config/config.xml new file mode 100644 index 000000000..c2ee07b65 --- /dev/null +++ b/examples/openreadme/config/config.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Installer> + <Name>Qt Installer Framework - Open ReadMe Example</Name> + <Version>1.0.0</Version> + <Title>Qt Installer Framework - Open Readme Example</Title> + <Publisher>Qt-Project</Publisher> + <StartMenuDir>Qt Installer Framework - 'Open ReadMe' Example</StartMenuDir> + <TargetDir>@homeDir@/IFWOpenReadMeExample</TargetDir> +</Installer> diff --git a/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/data/README.txt b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/data/README.txt new file mode 100644 index 000000000..b419f85a9 --- /dev/null +++ b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/data/README.txt @@ -0,0 +1,3 @@ +README + + diff --git a/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs new file mode 100644 index 000000000..f47c3dd8d --- /dev/null +++ b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/installscript.qs @@ -0,0 +1,77 @@ +/************************************************************************** +** +** 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:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +**************************************************************************/ + +function Component() +{ + installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown); + installer.finishButtonClicked.connect(this, Component.prototype.installationFinished); +} + +Component.prototype.createOperations = function() +{ + component.createOperations(); +} + +Component.prototype.installationFinishedPageIsShown = function() +{ + try { + if (installer.isInstaller() && installer.status == QInstaller.Success) { + installer.addWizardPageItem( component, "ReadMeCheckBoxForm", QInstaller.InstallationFinished ); + } + } catch(e) { + print(e); + } +} + +Component.prototype.installationFinished = function() +{ + try { + if (installer.isInstaller() && installer.status == QInstaller.Success) { + var isReadMeCheckBoxChecked = component.userInterface( "ReadMeCheckBoxForm" ).readMeCheckBox.checked; + if (isReadMeCheckBoxChecked) { + QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/README.txt"); + } + } + } catch(e) { + print(e); + } +} + diff --git a/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/package.xml b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/package.xml new file mode 100644 index 000000000..542e97823 --- /dev/null +++ b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/package.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Package> + <DisplayName>Open readme</DisplayName> + <Description>Show checkbox asking whether to open Readme at the end</Description> + <ReleaseDate>2013-01-01</ReleaseDate> + <Version>1.0.0-1</Version> + <Script>installscript.qs</Script> + <UserInterfaces> + <UserInterface>readmecheckboxform.ui</UserInterface> + </UserInterfaces> +</Package> diff --git a/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/readmecheckboxform.ui b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/readmecheckboxform.ui new file mode 100644 index 000000000..d5fec8a85 --- /dev/null +++ b/examples/openreadme/packages/or.qtproject.ifw.example.openreadme/meta/readmecheckboxform.ui @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ReadMeCheckBoxForm</class> + <widget class="QWidget" name="ReadMeCheckBoxForm"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>412</width> + <height>179</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QCheckBox" name="readMeCheckBox"> + <property name="text"> + <string>Open ReadMe</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="tristate"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |