/**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the release tools of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** 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 https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ Component.prototype.validateSDPDirectory = function(path) { if (path != "") { if (installer.fileExists(path + installer.value("QNX710_ENV_FILE"))) return true; } return false; } // constructor function Component() { // Add a user interface file called SetPathForSDPForm var page = gui.pageWidgetByObjectName("ComponentSelectionPage") if (page) { page.completeChanged.connect(Component.prototype.initPage); } else { // CLI does not have visual pages, ask SDP path from command line. installer.finishedCalculateComponentsToInstall.connect(Component.prototype.initPage); } var SDPdirectory; // use the right env file and default sdp path on x11 and win if (installer.value("os") == "x11") { SDPdirectory = installer.toNativeSeparators("/opt/qnx710"); installer.setValue("QNX710_ENV_FILE", "/qnxsdp-env.sh"); } else if (installer.value("os") == "win") { SDPdirectory = installer.toNativeSeparators("c:/qnx710"); installer.setValue("QNX710_ENV_FILE", "/qnxsdp-env.sh"); } if ( !installer.containsValue("QNX710_SDP_PATH") ) { installer.setValue("QNX710_SDP_PATH", SDPdirectory ); } } Component.prototype.initPage = function() { if (component.installationRequested()) { if (installer.addWizardPage( component, "SetPathForSDP71Form", QInstaller.ReadyForInstallation )) { var widget = gui.pageWidgetByObjectName("DynamicSetPathForSDP71Form"); if (widget != null) { widget.SDPchooser.clicked.connect(this, Component.prototype.dirRequested); widget.SDPdirectory.textChanged.connect(this, Component.prototype.textChanged); // set the initial by default directory widget.SDPdirectory.text = installer.value("QNX710_SDP_PATH"); // validate whether the initial by default directory is good enough widget.complete = Component.prototype.validateSDPDirectory(widget.SDPdirectory.text); } } else { // For command line interface while (true) { var SDPdirectory = QFileDialog.getExistingDirectory("Please specify the folder where your QNX SDP 7.1 is installed.", "", "PathForSDP7"); if (Component.prototype.validateSDPDirectory(SDPdirectory)) { break; } else { if (installer.containsFileDialogAutomaticAnswer("PathForSDP7")) { //Abort installer console.log("Invalid QNX SDP 7.1 directory given.") installer.interrupt(); break; } else { console.log("Invalid QNX SDP 7.1 directory. Please try again.") } } } } } else { var widget = gui.pageWidgetByObjectName("DynamicSetPathForSDP71Form"); if (widget != null) { widget.SDPchooser.clicked.disconnect(this, Component.prototype.dirRequested); widget.SDPdirectory.textChanged.disconnect(this, Component.prototype.textChanged); } installer.removeWizardPage(component, "SetPathForSDP71Form"); } } Component.prototype.dirRequested = function () { var widget = gui.pageWidgetByObjectName("DynamicSetPathForSDP71Form"); if (widget != null) { var newDirName = QFileDialog.getExistingDirectory("Choose your SDP directory.", widget.SDPdirectory.text); if (newDirName != "") widget.SDPdirectory.text = installer.toNativeSeparators(newDirName); } } Component.prototype.textChanged = function(text) { var widget = gui.pageWidgetByObjectName("DynamicSetPathForSDP71Form"); if (widget != null) { if (text != "") if (Component.prototype.validateSDPDirectory(text)) { widget.complete = true; installer.setValue("QNX710_SDP_PATH", text); return; } widget.complete = false; } } patchQNXDevicePaths = function(aComponent, aComponentRootPath, aDevicePrefix) { print("Patching QNX device paths for: " + aComponentRootPath); var fileName = aComponentRootPath + "/" + "bin" + "/" + "qt.conf"; aComponent.addOperation("Settings", "path=" + fileName, "method=set", "key=DevicePaths/Prefix", "value=" + aDevicePrefix); }