From 4ba1f2ea837f46607ec1738496ca546babd6b207 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 6 Nov 2017 16:17:21 +0100 Subject: Windows icon fix and change the installer to QT Installer Framework on Windows (#85) --- deploy/installer/cleanup/installscript.qs | 28 +++++++++++++++++++++++++++ deploy/installer/cleanup/package.xml | 10 ++++++++++ deploy/installer/config.xml | 15 +++++++++++++++ deploy/installer/controlscript.qs | 25 ++++++++++++++++++++++++ deploy/installer/gui/installscript.qs | 32 +++++++++++++++++++++++++++++++ deploy/installer/gui/package.xml | 14 ++++++++++++++ deploy/installer/uninstall.qs | 18 +++++++++++++++++ 7 files changed, 142 insertions(+) create mode 100644 deploy/installer/cleanup/installscript.qs create mode 100644 deploy/installer/cleanup/package.xml create mode 100644 deploy/installer/config.xml create mode 100644 deploy/installer/controlscript.qs create mode 100644 deploy/installer/gui/installscript.qs create mode 100644 deploy/installer/gui/package.xml create mode 100644 deploy/installer/uninstall.qs (limited to 'deploy') diff --git a/deploy/installer/cleanup/installscript.qs b/deploy/installer/cleanup/installscript.qs new file mode 100644 index 00000000..46f8012c --- /dev/null +++ b/deploy/installer/cleanup/installscript.qs @@ -0,0 +1,28 @@ +function Component() +{ +} + +Component.prototype.createOperations = function() +{ + component.createOperations(); + + try + { + if( installer.value("os") === "win" ) + { + /** + * Cleanup AppData and registry + */ + component.addElevatedOperation("Execute","UNDOEXECUTE","cmd /C reg delete HKEY_CURRENT_USER\Software\nheko\nheko /f"); + var localappdata = installer.environmentVariable("LOCALAPPDATA"); + if( localappdata != "" ) + { + component.addElevatedOperation("Execute","UNDOEXECUTE","cmd /C rmdir "+localappdata+"\nheko /f"); + } + } + } + catch( e ) + { + print( e ); + } +} diff --git a/deploy/installer/cleanup/package.xml b/deploy/installer/cleanup/package.xml new file mode 100644 index 00000000..f43e5b78 --- /dev/null +++ b/deploy/installer/cleanup/package.xml @@ -0,0 +1,10 @@ + + + Cleanup AppData and Registry + Cleans up AppData and Registry when selected (logs you out) - Broken + __VERSION__ + __DATE__ + 80 + + false + diff --git a/deploy/installer/config.xml b/deploy/installer/config.xml new file mode 100644 index 00000000..2cf7d99c --- /dev/null +++ b/deploy/installer/config.xml @@ -0,0 +1,15 @@ + + + Nheko + __VERSION__ + Nheko Installer + Mujx + https://github.com/mujx/nheko + nheko + nheko + nheko.png + Nheko + @ApplicationsDir@/nheko + @TargetDir@/nheko.exe + controlscript.qs + diff --git a/deploy/installer/controlscript.qs b/deploy/installer/controlscript.qs new file mode 100644 index 00000000..a53c3e99 --- /dev/null +++ b/deploy/installer/controlscript.qs @@ -0,0 +1,25 @@ +/** + * Source: http://stackoverflow.com/questions/21389105/qt-installer-framework-offline-update-how + */ + +function Controller() +{ +} + +Controller.prototype.TargetDirectoryPageCallback = function() +{ + var widget = gui.currentPageWidget(); + widget.TargetDirectoryLineEdit.textChanged.connect( this, Controller.prototype.targetChanged ); + Controller.prototype.targetChanged( widget.TargetDirectoryLineEdit.text ); +} + +Controller.prototype.targetChanged = function( text ) +{ + if( text != "" && installer.fileExists(text + "/components.xml") ) + { + if( QMessageBox.question("PreviousInstallation", "Previous installation detected", "Do you want to uninstall the previous installation?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes ) + { + installer.execute( text+"/maintenancetool.exe", new Array("--script", text+"/uninstall.qs") ) + } + } +} diff --git a/deploy/installer/gui/installscript.qs b/deploy/installer/gui/installscript.qs new file mode 100644 index 00000000..4cfa284f --- /dev/null +++ b/deploy/installer/gui/installscript.qs @@ -0,0 +1,32 @@ +function Component() +{ +} + +Component.prototype.createOperations = function() +{ + component.createOperations(); + + try + { + if( installer.value("os") === "win" ) + { + /** + * Start Menu Shortcut + */ + component.addOperation( "CreateShortcut", "@TargetDir@\\nheko.exe", "@StartMenuDir@\\nheko.lnk", + "workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\nheko.exe", + "iconId=0", "description=Desktop client for the Matrix protocol"); + + /** + * Desktop Shortcut + */ + component.addOperation( "CreateShortcut", "@TargetDir@\\nheko.exe", "@DesktopDir@\\nheko.lnk", + "workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\nheko.exe", + "iconId=0", "description=Desktop client for the Matrix protocol"); + } + } + catch( e ) + { + print( e ); + } +} diff --git a/deploy/installer/gui/package.xml b/deploy/installer/gui/package.xml new file mode 100644 index 00000000..c28b7e60 --- /dev/null +++ b/deploy/installer/gui/package.xml @@ -0,0 +1,14 @@ + + + Nheko + Desktop client for the Matrix protocol + __VERSION__ + __DATE__ + + + + true + true + 100 + + diff --git a/deploy/installer/uninstall.qs b/deploy/installer/uninstall.qs new file mode 100644 index 00000000..43935d0f --- /dev/null +++ b/deploy/installer/uninstall.qs @@ -0,0 +1,18 @@ +function Controller() +{ +} + +Controller.prototype.IntroductionPageCallback = function() +{ + gui.clickButton( buttons.NextButton ); +} + +Controller.prototype.ReadyForInstallationPageCallback = function() +{ + gui.clickButton( buttons.CommitButton ); +} + +Controller.prototype.FinishedPageCallback = function() +{ + gui.clickButton( buttons.FinishButton ); +} -- cgit 1.5.1