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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Package>
+ <DisplayName>Cleanup AppData and Registry</DisplayName>
+ <Description>Cleans up AppData and Registry when selected (logs you out) - Broken</Description>
+ <Version>__VERSION__</Version>
+ <ReleaseDate>__DATE__</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <Script>installscript.qs</Script>
+ <Checkable>false</Checkable>
+</Package>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Installer>
+ <Name>Nheko</Name>
+ <Version>__VERSION__</Version>
+ <Title>Nheko Installer</Title>
+ <Publisher>Mujx</Publisher>
+ <ProductUrl>https://github.com/mujx/nheko</ProductUrl>
+ <InstallerWindowIcon>nheko</InstallerWindowIcon>
+ <InstallerApplicationIcon>nheko</InstallerApplicationIcon>
+ <Logo>nheko.png</Logo>
+ <StartMenuDir>Nheko</StartMenuDir>
+ <TargetDir>@ApplicationsDir@/nheko</TargetDir>
+ <RunProgram>@TargetDir@/nheko.exe</RunProgram>
+ <ControlScript>controlscript.qs</ControlScript>
+</Installer>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Package>
+ <DisplayName>Nheko</DisplayName>
+ <Description>Desktop client for the Matrix protocol</Description>
+ <Version>__VERSION__</Version>
+ <ReleaseDate>__DATE__</ReleaseDate>
+ <Licenses>
+ <License name="Nheko License - GPLv3" file="license.txt" />
+ </Licenses>
+ <Default>true</Default>
+ <ForcedInstallation>true</ForcedInstallation>
+ <SortingPriority>100</SortingPriority>
+ <Script>installscript.qs</Script>
+</Package>
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 );
+}
|