/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** 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$ ** ****************************************************************************/ function Component() { installer.currentPageChanged.connect(this, Component.prototype.reactOnPageChange); } Component.prototype.createOperations = function() { component.createOperations(); //QTBUG-64243 - Qt plugins path patch for emulator3 component.addOperation("Move", "@TargetDir@" + "/Tools/emulator3/" + "/bin/qt.conf.tmpl", "@TargetDir@" + "/Tools/emulator3/" + "/bin/qt.conf"); } vboxManagePath = function() { var result; if (installer.value("os") === "win") { var installPath = installer.execute("REG", ["QUERY", "HKLM\\SOFTWARE\\Oracle\\VirtualBox", "/v", "InstallDir"]); if (installPath.length === 2 && installPath[1] !== 0) installPath = installer.execute("REG", ["QUERY", "HKLM\\SOFTWARE\\Oracle\\VirtualBox", "/reg:64", "/v", "InstallDir"]); if (installPath.length === 2 && installPath[1] === 0) { // Output of "REG QUERY HKLM\SOFTWARE\Oracle\VirtualBox /v InstallDir": // ! REG.EXE VERSION 3.0 // HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\VirtualBox\ // InstallDir REG_SZ C:\Program Files\Oracle\VirtualBox\ installPath = installPath[0].match(/REG_SZ\s+(.+)/)[1]; } else installPath = installer.environmentVariable("VBOX_INSTALL_PATH"); if (installPath === "") installPath = installer.environmentVariable("VBOX_MSI_INSTALL_PATH"); if (installPath !== "") result = installPath + "\\" + "VBoxManage.exe"; } else { result = installer.execute("/usr/bin/which", ["VBoxManage"])[0]; result = result.replace(/\n/gi, ""); } return result; } vboxDeletePreviousVm = function(vboxVmName) { var vboxmanage = vboxManagePath(); var registeredVMs = installer.execute(vboxmanage, ["list", "vms"])[0]; if (registeredVMs.indexOf("\"" + vboxVmName + "\"") !== -1) { var runningVMs = installer.execute(vboxmanage, ["list", "runningvms"])[0]; if (runningVMs.indexOf("\"" + vboxVmName + "\"") !== -1) { installer.execute(vboxmanage, ["controlvm", vboxVmName, "poweroff"]); installer.execute("/bin/sleep", ["2"]); } var ret = installer.execute(vboxmanage, ["unregistervm", vboxVmName, "--delete"])[1]; if ( ret != "0" ) { QMessageBox.critical("Virtual Machine already exists", "Virtual Machine already exists", "VirtualBox has existing Virtual Machine '" + vboxVmName + "' and installer was unable to remove it. " + "You have to manually remove the existing Virtual Machine from VirtualBox before continuing."); } } } Component.prototype.reactOnPageChange = function(value) { if (QInstaller.ReadyForInstallation == value) { if (component.installationRequested() && !vboxManagePath()) { QMessageBox.warning("VirtualBox not installed", "VirtualBox not installed", "VirtualBox was not found on your computer. It is needed to install the Emulator of this SDK. Install VirtualBox first or deselect all Emulator components."); } } }