|
| 1 | +/* |
| 2 | + * Qt Installer script for a non-interactive installation of Qt5 on Windows. |
| 3 | + * Installs the 64-bit package if environment variable PLATFORM="x64". |
| 4 | + */ |
| 5 | + |
| 6 | +// jshint strict:false |
| 7 | +/* globals QInstaller, QMessageBox, buttons, gui, installer, console */ |
| 8 | + |
| 9 | +// Run with: |
| 10 | +// .\qt-unified-windows-x86-3.0.4-online.exe --verbose --script tools\qt-installer-windows.qs |
| 11 | + |
| 12 | +// Look for Name elements in |
| 13 | +// https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5120/Updates.xml |
| 14 | +// Unfortunately it is not possible to disable deps like qt.tools.qtcreator |
| 15 | +var INSTALL_COMPONENTS = [ |
| 16 | + "qt.qt5.5124.gcc_64" |
| 17 | +]; |
| 18 | + |
| 19 | +function Controller() { |
| 20 | + // Continue on installing to an existing (possibly empty) directory. |
| 21 | + installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes); |
| 22 | + // Continue at "SHOW FINISHED PAGE" |
| 23 | + installer.installationFinished.connect(function() { |
| 24 | + console.log("installationFinished"); |
| 25 | + gui.clickButton(buttons.NextButton); |
| 26 | + }); |
| 27 | +} |
| 28 | + |
| 29 | +Controller.prototype.WelcomePageCallback = function() { |
| 30 | + console.log("Step: " + gui.currentPageWidget()); |
| 31 | + // At least for 3.0.4 immediately clicking Next fails, so wait a bit. |
| 32 | + // https://github.com/benlau/qtci/commit/85cb986b66af4807a928c70e13d82d00dc26ebf0 |
| 33 | + gui.clickButton(buttons.NextButton, 1000); |
| 34 | +}; |
| 35 | + |
| 36 | +Controller.prototype.CredentialsPageCallback = function() { |
| 37 | + console.log("Step: " + gui.currentPageWidget()); |
| 38 | + gui.clickButton(buttons.NextButton); |
| 39 | +}; |
| 40 | + |
| 41 | +Controller.prototype.IntroductionPageCallback = function() { |
| 42 | + console.log("Step: " + gui.currentPageWidget()); |
| 43 | + gui.clickButton(buttons.NextButton); |
| 44 | +}; |
| 45 | + |
| 46 | +Controller.prototype.TargetDirectoryPageCallback = function() { |
| 47 | + console.log("Step: " + gui.currentPageWidget()); |
| 48 | + // Keep default at "C:\Qt". |
| 49 | + //gui.currentPageWidget().TargetDirectoryLineEdit.setText("E:\\Qt"); |
| 50 | + gui.clickButton(buttons.NextButton); |
| 51 | +}; |
| 52 | + |
| 53 | +Controller.prototype.ComponentSelectionPageCallback = function() { |
| 54 | + console.log("Step: " + gui.currentPageWidget()); |
| 55 | + var page = gui.currentPageWidget(); |
| 56 | + page.deselectAll(); |
| 57 | + for (var i = 0; i < INSTALL_COMPONENTS.length; i++) { |
| 58 | + page.selectComponent(INSTALL_COMPONENTS[i]); |
| 59 | + } |
| 60 | + gui.clickButton(buttons.NextButton); |
| 61 | +}; |
| 62 | + |
| 63 | +Controller.prototype.LicenseAgreementPageCallback = function() { |
| 64 | + console.log("Step: " + gui.currentPageWidget()); |
| 65 | + gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true); |
| 66 | + gui.clickButton(buttons.NextButton); |
| 67 | +}; |
| 68 | + |
| 69 | +Controller.prototype.StartMenuDirectoryPageCallback = function() { |
| 70 | + console.log("Step: " + gui.currentPageWidget()); |
| 71 | + gui.clickButton(buttons.NextButton); |
| 72 | +}; |
| 73 | + |
| 74 | +Controller.prototype.ReadyForInstallationPageCallback = function() { |
| 75 | + console.log("Step: " + gui.currentPageWidget()); |
| 76 | + gui.clickButton(buttons.NextButton); |
| 77 | +}; |
| 78 | + |
| 79 | +Controller.prototype.FinishedPageCallback = function() { |
| 80 | + console.log("Step: " + gui.currentPageWidget()); |
| 81 | + // TODO somehow the installer crashes after this step. |
| 82 | + // https://stackoverflow.com/questions/25105269/silent-install-qt-run-installer-on-ubuntu-server |
| 83 | + var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm; |
| 84 | + if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) { |
| 85 | + checkBoxForm.launchQtCreatorCheckBox.checked = false; |
| 86 | + } |
| 87 | + gui.clickButton(buttons.FinishButton); |
| 88 | +}; |
| 89 | + |
| 90 | +// vim: set ft=javascript: |
0 commit comments