shortcut.qs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Skip all pages and go directly to finished page.
  2. // (see also componenterror example)
  3. function cancelInstaller(message)
  4. {
  5. installer.setDefaultPageVisible(QInstaller.Introduction, false);
  6. installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
  7. installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
  8. installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);
  9. installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
  10. installer.setDefaultPageVisible(QInstaller.PerformInstallation, false);
  11. installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
  12. var abortText = "<font color='red'>" + message +"</font>";
  13. installer.setValue("FinishedText", abortText);
  14. }
  15. function isVersionNewer(version, version2) {
  16. if (version && version2) {
  17. version = version.split('.');
  18. version2 = version2.split('.');
  19. for (var i = 0, len = version.length; i < len; i++) {
  20. if (i < version2.length) {
  21. var minVersionDot = parseInt(version[i], 10);
  22. var version2Dot = parseInt(version2[i], 10);
  23. if (minVersionDot < version2Dot) {
  24. return true;
  25. } else if (minVersionDot > version2Dot) {
  26. return false;
  27. }
  28. }
  29. }
  30. return true;
  31. } else {
  32. return true;
  33. }
  34. }
  35. function Component()
  36. {
  37. // start installer with -v to see debug output
  38. console.log("OS: " + systemInfo.productType);
  39. console.log("Kernel: " + systemInfo.kernelType + "/" + systemInfo.kernelVersion);
  40. var validOs = false;
  41. var validArch = false;
  42. if (systemInfo.kernelType === "winnt") {
  43. // check for windows 7 or newer
  44. if (isVersionNewer("6.1.0", systemInfo.kernelVersion))
  45. validOs = true;
  46. if (systemInfo.currentCpuArchitecture === "x86_64")
  47. validArch = true;
  48. }
  49. if (!validOs || !validArch) {
  50. cancelInstaller("Installation on " + systemInfo.prettyProductName + " (" + systemInfo.currentCpuArchitecture + ") is not supported");
  51. }
  52. }
  53. Component.prototype.createOperations = function()
  54. {
  55. component.createOperations();
  56. if (systemInfo.productType === "windows") {
  57. component.addOperation("CreateShortcut", "@TargetDir@/PlexMediaPlayer.exe", "@StartMenuDir@/Plex Media Player.lnk");
  58. component.addOperation("CreateShortcut", "@TargetDir@/maintenancetool.exe", "@StartMenuDir@/Maintain Plex Media Player.lnk");
  59. }
  60. }