1; NSIS script file
2
3;--------------------------------
4;Include Modern UI
5
6	!include "MUI.nsh"
7
8;--------------------------------
9;General
10
11	; The icon for the installer.
12	; MUI_ICON icon_file
13
14	; The icon for the uninstaller.
15	; MUI_UNICON icon_file
16
17	Name "KchmViewer"
18	OutFile "InstallKchmViewer.exe"
19	InstallDir "$PROGRAMFILES\Ulduzsoft\KchmViewer"
20	InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Ulduzsoft\KchmViewer" ""
21	SetCompressor lzma
22
23;--------------------------------
24;Variables
25
26	Var MUI_TEMP
27	Var STARTMENU_FOLDER
28
29;--------------------------------
30;Interface Settings
31
32	!define MUI_ABORTWARNING
33
34
35;--------------------------------
36;Pages
37
38	!insertmacro MUI_PAGE_WELCOME
39	!insertmacro MUI_PAGE_LICENSE "license.txt"
40	!insertmacro MUI_PAGE_DIRECTORY
41
42	;Start Menu Folder Page Configuration
43	!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKEY_LOCAL_MACHINE
44	!define MUI_STARTMENUPAGE_REGISTRY_KEY "SOFTWARE\Ulduzsoft\KchmViewer"
45	!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
46	!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
47
48	!insertmacro MUI_PAGE_INSTFILES
49	!insertmacro MUI_PAGE_FINISH
50
51	; Uninstaller pages
52	!insertmacro MUI_UNPAGE_WELCOME
53	!insertmacro MUI_UNPAGE_CONFIRM
54	!insertmacro MUI_UNPAGE_INSTFILES
55	!insertmacro MUI_UNPAGE_FINISH
56
57;--------------------------------
58;Languages
59
60	!insertmacro MUI_LANGUAGE "English"
61
62
63;--------------------------------
64;Installer Sections
65
66	Section "General" General
67		SetOutPath "$INSTDIR"
68
69		; Our files
70		CreateDirectory "$INSTDIR\imageformats"
71		CreateDirectory "$INSTDIR\platforms"
72		CreateDirectory "$INSTDIR\printsupport"
73		File /oname=$INSTDIR\imageformats\qgif.dll imageformats\qgif.dll
74		File /oname=$INSTDIR\imageformats\qico.dll imageformats\qico.dll
75		File /oname=$INSTDIR\imageformats\qjpeg.dll imageformats\qjpeg.dll
76		File /oname=$INSTDIR\imageformats\qsvg.dll imageformats\qsvg.dll
77		File /oname=$INSTDIR\platforms\qwindows.dll platforms\qwindows.dll
78		File /oname=$INSTDIR\printsupport\windowsprintersupport.dll printsupport\windowsprintersupport.dll
79		File kchmviewer.exe
80		File icudt54.dll
81		File Qt5Multimedia.dll
82		File Qt5Positioning.dll
83		File Qt5Sensors.dll
84		File Qt5WebKitWidgets.dll
85		File icuin54.dll
86		File kchmviewer.exe
87		File Qt5MultimediaWidgets.dll
88		File Qt5PrintSupport.dll
89		File Qt5Sql.dll
90		File Qt5Widgets.dll
91		File icuuc54.dll
92		File Qt5Core.dll
93		File Qt5Network.dll
94		File Qt5Qml.dll
95		File Qt5WebChannel.dll
96		File Qt5Xml.dll
97		File Qt5Gui.dll
98		File Qt5OpenGL.dll
99		File Qt5Quick.dll
100		File Qt5WebKit.dll
101		File kchmviewer.exe.manifest
102		File msvcp120.dll
103		File msvcr120.dll
104		File vccorlib120.dll
105
106		;Store installation folder
107		WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Ulduzsoft\KchmViewer" "" "$INSTDIR"
108
109		;Create uninstaller
110		WriteUninstaller "$INSTDIR\uninst.exe"
111
112		!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
113		;Create shortcuts
114		CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
115		CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\kchmviewer.lnk" "$INSTDIR\kchmviewer.exe"
116		CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninst.exe"
117		!insertmacro MUI_STARTMENU_WRITE_END
118
119	SectionEnd
120
121;--------------------------------
122;Uninstaller Section
123
124	Section "Uninstall"
125
126		; Our files
127		Delete "$INSTDIR\imageformats\qgif.dll"
128		Delete "$INSTDIR\imageformats\qico.dll"
129		Delete "$INSTDIR\imageformats\qjpeg.dll"
130		Delete "$INSTDIR\imageformats\qsvg.dll"
131		Delete "$INSTDIR\platforms\qwindows.dll"
132		Delete "$INSTDIR\printsupport\windowsprintersupport.dll"
133		Delete "$INSTDIR\kchmviewer.exe"
134		Delete "$INSTDIR\icudt54.dll"
135		Delete "$INSTDIR\Qt5Multimedia.dll"
136		Delete "$INSTDIR\Qt5Positioning.dll"
137		Delete "$INSTDIR\Qt5Sensors.dll"
138		Delete "$INSTDIR\Qt5WebKitWidgets.dll"
139		Delete "$INSTDIR\icuin54.dll"
140		Delete "$INSTDIR\Qt5MultimediaWidgets.dll"
141		Delete "$INSTDIR\Qt5PrintSupport.dll"
142		Delete "$INSTDIR\Qt5Sql.dll"
143		Delete "$INSTDIR\Qt5Widgets.dll"
144		Delete "$INSTDIR\icuuc54.dll"
145		Delete "$INSTDIR\Qt5Core.dll"
146		Delete "$INSTDIR\Qt5Network.dll"
147		Delete "$INSTDIR\Qt5Qml.dll"
148		Delete "$INSTDIR\Qt5WebChannel.dll"
149		Delete "$INSTDIR\Qt5Xml.dll"
150		Delete "$INSTDIR\Qt5Gui.dll"
151		Delete "$INSTDIR\Qt5OpenGL.dll"
152		Delete "$INSTDIR\Qt5Quick.dll"
153		Delete "$INSTDIR\Qt5WebKit.dll"
154		Delete "$INSTDIR\kchmviewer.exe.manifest"
155		Delete "$INSTDIR\msvcp120.dll"
156		Delete "$INSTDIR\msvcr120.dll"
157		Delete "$INSTDIR\vccorlib120.dll"
158
159		Delete "$INSTDIR\uninst.exe"
160
161		RMDir "$INSTDIR\imageformats"
162		RMDir "$INSTDIR\platforms"
163		RMDir "$INSTDIR\printsupport"
164 		RMDir "$INSTDIR"
165
166		!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
167		Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
168		Delete "$SMPROGRAMS\$MUI_TEMP\kchmviewer.lnk"
169		Delete "$SMPROGRAMS\$MUI_TEMP"
170
171  		DeleteRegKey /ifempty HKEY_LOCAL_MACHINE "SOFTWARE\Ulduzsoft\KchmViewer"
172  		DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KchmViewer"
173
174	SectionEnd
175