From 0381020f4b59161d0a6b1f04e785e084f2758da8 Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 21 Aug 2013 13:28:16 +0200 Subject: Introduce example on how to handle component errors. Change-Id: Idb102b8bc4a56365a4718d15856ecd96a40f952e Reviewed-by: Tim Jenssen --- examples/componenterror/README | 5 ++ examples/componenterror/config/config.xml | 9 +++ .../packages/root.component1/meta/installscript.js | 50 ++++++++++++++ .../packages/root.component1/meta/package.xml | 7 ++ .../packages/root.component2/meta/installscript.js | 50 ++++++++++++++ .../packages/root.component2/meta/package.xml | 7 ++ .../packages/root/meta/installscript.js | 76 ++++++++++++++++++++++ .../componenterror/packages/root/meta/package.xml | 7 ++ 8 files changed, 211 insertions(+) create mode 100644 examples/componenterror/README create mode 100644 examples/componenterror/config/config.xml create mode 100644 examples/componenterror/packages/root.component1/meta/installscript.js create mode 100644 examples/componenterror/packages/root.component1/meta/package.xml create mode 100644 examples/componenterror/packages/root.component2/meta/installscript.js create mode 100644 examples/componenterror/packages/root.component2/meta/package.xml create mode 100644 examples/componenterror/packages/root/meta/installscript.js create mode 100644 examples/componenterror/packages/root/meta/package.xml (limited to 'examples/componenterror') diff --git a/examples/componenterror/README b/examples/componenterror/README new file mode 100644 index 000000000..27fd4b3a4 --- /dev/null +++ b/examples/componenterror/README @@ -0,0 +1,5 @@ +Create an installer that shows how to react on errors set from a component. + +Generate installer with + +binarycreator --offline-only -c config/config.xml -p packages installer diff --git a/examples/componenterror/config/config.xml b/examples/componenterror/config/config.xml new file mode 100644 index 000000000..e16b411da --- /dev/null +++ b/examples/componenterror/config/config.xml @@ -0,0 +1,9 @@ + + + Component error Installer Example + 1.0.0 + Component error Installer Example + Qt-Project + Qt Installer Framework Example + @homeDir@/IFWComponentErrorInstallerExample + diff --git a/examples/componenterror/packages/root.component1/meta/installscript.js b/examples/componenterror/packages/root.component1/meta/installscript.js new file mode 100644 index 000000000..6d76437b2 --- /dev/null +++ b/examples/componenterror/packages/root.component1/meta/installscript.js @@ -0,0 +1,50 @@ +/************************************************************************** +** +** Copyright (C) 2013 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() +{ + var error = true; + if (error) { + installer.setValue("component_errors", installer.value("component_errors") + ";;;" + + "error from component: " + component.name); + } + installer.setValue("ComponentError", true); +} diff --git a/examples/componenterror/packages/root.component1/meta/package.xml b/examples/componenterror/packages/root.component1/meta/package.xml new file mode 100644 index 000000000..eac36530b --- /dev/null +++ b/examples/componenterror/packages/root.component1/meta/package.xml @@ -0,0 +1,7 @@ + + + component1 + 1.0.1 + 2013-08-21 + + diff --git a/examples/componenterror/packages/root.component2/meta/installscript.js b/examples/componenterror/packages/root.component2/meta/installscript.js new file mode 100644 index 000000000..6d76437b2 --- /dev/null +++ b/examples/componenterror/packages/root.component2/meta/installscript.js @@ -0,0 +1,50 @@ +/************************************************************************** +** +** Copyright (C) 2013 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() +{ + var error = true; + if (error) { + installer.setValue("component_errors", installer.value("component_errors") + ";;;" + + "error from component: " + component.name); + } + installer.setValue("ComponentError", true); +} diff --git a/examples/componenterror/packages/root.component2/meta/package.xml b/examples/componenterror/packages/root.component2/meta/package.xml new file mode 100644 index 000000000..4caad7ad6 --- /dev/null +++ b/examples/componenterror/packages/root.component2/meta/package.xml @@ -0,0 +1,7 @@ + + + component2 + 1.0.1 + 2013-08-21 + + diff --git a/examples/componenterror/packages/root/meta/installscript.js b/examples/componenterror/packages/root/meta/installscript.js new file mode 100644 index 000000000..e29892523 --- /dev/null +++ b/examples/componenterror/packages/root/meta/installscript.js @@ -0,0 +1,76 @@ +/************************************************************************** +** +** Copyright (C) 2013 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 abortInstaller() +{ + installer.setDefaultPageVisible(QInstaller.Introduction, false); + installer.setDefaultPageVisible(QInstaller.TargetDirectory, false); + installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); + installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false); + installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false); + installer.setDefaultPageVisible(QInstaller.PerformInstallation, false); + installer.setDefaultPageVisible(QInstaller.LicenseCheck, false); + + var abortText = "" + qsTr("The installation has been failed.") + ""; + + var error_list = installer.value("component_errors").split(";;;"); + abortText += ""; + installer.setValue("FinishedText", abortText); +} + +function reactOnAbortInstallerChange() +{ + if (installer.value("ComponentError") === "true") + abortInstaller(); +} + +function Component() +{ + installer.finishAllComponentsReset.connect(reactOnAbortInstallerChange); +} diff --git a/examples/componenterror/packages/root/meta/package.xml b/examples/componenterror/packages/root/meta/package.xml new file mode 100644 index 000000000..ce9b55537 --- /dev/null +++ b/examples/componenterror/packages/root/meta/package.xml @@ -0,0 +1,7 @@ + + + ROOT + 1.0.1 + 2013-08-21 + + -- cgit v1.2.3