1 | ;Installer script for win32/win64 SMPlayer
|
---|
2 | ;Written by redxii (redxii@users.sourceforge.net)
|
---|
3 | ;Tested/Developed with Unicode NSIS 2.46.5
|
---|
4 |
|
---|
5 | !ifndef VER_MAJOR | VER_MINOR | VER_BUILD
|
---|
6 | !error "Version information not defined (or incomplete). You must define: VER_MAJOR, VER_MINOR, VER_BUILD."
|
---|
7 | !endif
|
---|
8 |
|
---|
9 | ;--------------------------------
|
---|
10 | ;Compressor
|
---|
11 |
|
---|
12 | SetCompressor /SOLID lzma
|
---|
13 | SetCompressorDictSize 32
|
---|
14 |
|
---|
15 | ;--------------------------------
|
---|
16 | ;Additional plugin folders
|
---|
17 |
|
---|
18 | !addplugindir .
|
---|
19 | !addincludedir .
|
---|
20 |
|
---|
21 | ;--------------------------------
|
---|
22 | ;Defines
|
---|
23 |
|
---|
24 | !ifdef VER_REVISION
|
---|
25 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
---|
26 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
---|
27 | !else ifndef VER_REVISION
|
---|
28 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}"
|
---|
29 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.0"
|
---|
30 | !endif
|
---|
31 |
|
---|
32 | !ifdef WIN64
|
---|
33 | !define SMPLAYER_BUILD_DIR "smplayer-build64"
|
---|
34 | !else
|
---|
35 | !define SMPLAYER_BUILD_DIR "smplayer-build"
|
---|
36 | !endif
|
---|
37 |
|
---|
38 | !define SMPLAYER_REG_KEY "Software\SMPlayer"
|
---|
39 | !define SMPLAYER_APP_PATHS_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\smplayer.exe"
|
---|
40 | !define SMPLAYER_DEF_PROGS_KEY "Software\Clients\Media\SMPlayer"
|
---|
41 |
|
---|
42 | !define SMPLAYER_UNINST_EXE "uninst.exe"
|
---|
43 | !define SMPLAYER_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SMPlayer"
|
---|
44 |
|
---|
45 | !define CODEC_VERSION "windows-essential-20071007"
|
---|
46 |
|
---|
47 | ;--------------------------------
|
---|
48 | ;General
|
---|
49 |
|
---|
50 | ;Name and file
|
---|
51 | Name "SMPlayer ${SMPLAYER_VERSION}"
|
---|
52 | BrandingText "SMPlayer for Windows v${SMPLAYER_VERSION}"
|
---|
53 | !ifdef WIN64
|
---|
54 | OutFile "output\smplayer-${SMPLAYER_VERSION}-x64.exe"
|
---|
55 | !else
|
---|
56 | OutFile "output\smplayer-${SMPLAYER_VERSION}-win32.exe"
|
---|
57 | !endif
|
---|
58 |
|
---|
59 | ;Version tab properties
|
---|
60 | VIProductVersion "${SMPLAYER_PRODUCT_VERSION}"
|
---|
61 | VIAddVersionKey "ProductName" "SMPlayer"
|
---|
62 | VIAddVersionKey "ProductVersion" "${SMPLAYER_VERSION}"
|
---|
63 | VIAddVersionKey "FileVersion" "${SMPLAYER_VERSION}"
|
---|
64 | VIAddVersionKey "LegalCopyright" ""
|
---|
65 | !ifdef WIN64
|
---|
66 | VIAddVersionKey "FileDescription" "SMPlayer Installer (64-bit)"
|
---|
67 | !else
|
---|
68 | VIAddVersionKey "FileDescription" "SMPlayer Installer (32-bit)"
|
---|
69 | !endif
|
---|
70 |
|
---|
71 | ;Default installation folder
|
---|
72 | !ifdef WIN64
|
---|
73 | InstallDir "$PROGRAMFILES64\SMPlayer"
|
---|
74 | !else
|
---|
75 | InstallDir "$PROGRAMFILES\SMPlayer"
|
---|
76 | !endif
|
---|
77 |
|
---|
78 | ;Get installation folder from registry if available
|
---|
79 | InstallDirRegKey HKLM "${SMPLAYER_REG_KEY}" "Path"
|
---|
80 |
|
---|
81 | ;Vista+ XML manifest, does not affect older OSes
|
---|
82 | RequestExecutionLevel admin
|
---|
83 |
|
---|
84 | ShowInstDetails show
|
---|
85 | ShowUnInstDetails show
|
---|
86 |
|
---|
87 | ;--------------------------------
|
---|
88 | ;Variables
|
---|
89 |
|
---|
90 | Var Dialog_Reinstall
|
---|
91 | Var Inst_Type
|
---|
92 | Var Previous_Version
|
---|
93 | Var Previous_Version_State
|
---|
94 | Var Reinstall_ChgSettings
|
---|
95 | Var Reinstall_ChgSettings_State
|
---|
96 | Var Reinstall_Message
|
---|
97 | Var Reinstall_OverwriteButton
|
---|
98 | Var Reinstall_OverwriteButton_State
|
---|
99 | Var Reinstall_Uninstall
|
---|
100 | Var Reinstall_UninstallButton
|
---|
101 | Var Reinstall_UninstallButton_State
|
---|
102 | Var Restore_Codecs
|
---|
103 | Var SMPlayer_Path
|
---|
104 | Var SMPlayer_UnStrPath
|
---|
105 | Var SMPlayer_StartMenuFolder
|
---|
106 |
|
---|
107 | ;--------------------------------
|
---|
108 | ;Interface Settings
|
---|
109 |
|
---|
110 | ;Installer/Uninstaller icons
|
---|
111 | !define MUI_ICON "smplayer-orange-installer.ico"
|
---|
112 | !define MUI_UNICON "smplayer-orange-uninstaller.ico"
|
---|
113 |
|
---|
114 | ;Misc
|
---|
115 | !define MUI_WELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard.bmp"
|
---|
116 | !define MUI_UNWELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard-un.bmp"
|
---|
117 | !define MUI_ABORTWARNING
|
---|
118 |
|
---|
119 | ;Welcome page
|
---|
120 | !define MUI_WELCOMEPAGE_TITLE $(WelcomePage_Title)
|
---|
121 | !define MUI_WELCOMEPAGE_TEXT $(WelcomePage_Text)
|
---|
122 |
|
---|
123 | ;License page
|
---|
124 | !define MUI_LICENSEPAGE_RADIOBUTTONS
|
---|
125 |
|
---|
126 | ;Components page
|
---|
127 | !define MUI_COMPONENTSPAGE_SMALLDESC
|
---|
128 |
|
---|
129 | ;Finish page
|
---|
130 | !define MUI_FINISHPAGE_LINK "http://smplayer.sourceforge.net"
|
---|
131 | !define MUI_FINISHPAGE_LINK_LOCATION "http://smplayer.sourceforge.net"
|
---|
132 | !define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
---|
133 | !define MUI_FINISHPAGE_RUN $INSTDIR\smplayer.exe
|
---|
134 | !define MUI_FINISHPAGE_RUN_NOTCHECKED
|
---|
135 | !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Release_notes.txt
|
---|
136 | !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
---|
137 |
|
---|
138 | ;Language Selection Dialog Settings
|
---|
139 | !define MUI_LANGDLL_REGISTRY_ROOT HKLM
|
---|
140 | !define MUI_LANGDLL_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
|
---|
141 | !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
|
---|
142 |
|
---|
143 | ;Memento Settings
|
---|
144 | !define MEMENTO_REGISTRY_ROOT HKLM
|
---|
145 | !define MEMENTO_REGISTRY_KEY "${SMPLAYER_REG_KEY}"
|
---|
146 |
|
---|
147 | ;Start Menu Settings
|
---|
148 | !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SMPlayer"
|
---|
149 | !define MUI_STARTMENUPAGE_NODISABLE
|
---|
150 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
|
---|
151 | !define MUI_STARTMENUPAGE_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
|
---|
152 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenu"
|
---|
153 |
|
---|
154 | ;--------------------------------
|
---|
155 | ;Include Modern UI and functions
|
---|
156 |
|
---|
157 | !include MUI2.nsh
|
---|
158 | !include FileFunc.nsh
|
---|
159 | !include Memento.nsh
|
---|
160 | !include nsDialogs.nsh
|
---|
161 | !include Sections.nsh
|
---|
162 | !include WinVer.nsh
|
---|
163 | !include WordFunc.nsh
|
---|
164 | !include x64.nsh
|
---|
165 |
|
---|
166 | ;--------------------------------
|
---|
167 | ;Pages
|
---|
168 |
|
---|
169 | ;Install pages
|
---|
170 | #Welcome
|
---|
171 | !insertmacro MUI_PAGE_WELCOME
|
---|
172 |
|
---|
173 | #License
|
---|
174 | !insertmacro MUI_PAGE_LICENSE "license.txt"
|
---|
175 |
|
---|
176 | #Upgrade/Reinstall
|
---|
177 | Page custom PageReinstall PageReinstallLeave
|
---|
178 |
|
---|
179 | #Components
|
---|
180 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
|
---|
181 | !insertmacro MUI_PAGE_COMPONENTS
|
---|
182 |
|
---|
183 | #Install Directory
|
---|
184 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
|
---|
185 | !insertmacro MUI_PAGE_DIRECTORY
|
---|
186 |
|
---|
187 | #Start Menu
|
---|
188 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageStartMenuPre
|
---|
189 | !insertmacro MUI_PAGE_STARTMENU "SMP_SMenu" $SMPlayer_StartMenuFolder
|
---|
190 |
|
---|
191 | !insertmacro MUI_PAGE_INSTFILES
|
---|
192 | !insertmacro MUI_PAGE_FINISH
|
---|
193 |
|
---|
194 | ;Uninstall pages
|
---|
195 | !define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
|
---|
196 | !insertmacro MUI_UNPAGE_CONFIRM
|
---|
197 | !insertmacro MUI_UNPAGE_INSTFILES
|
---|
198 | !insertmacro MUI_UNPAGE_FINISH
|
---|
199 |
|
---|
200 | ;--------------------------------
|
---|
201 | ;Languages
|
---|
202 |
|
---|
203 | !insertmacro MUI_LANGUAGE "English"
|
---|
204 | !insertmacro MUI_LANGUAGE "Basque"
|
---|
205 | !insertmacro MUI_LANGUAGE "Catalan"
|
---|
206 | !insertmacro MUI_LANGUAGE "Croatian"
|
---|
207 | !insertmacro MUI_LANGUAGE "Czech"
|
---|
208 | !insertmacro MUI_LANGUAGE "Danish"
|
---|
209 | !insertmacro MUI_LANGUAGE "Dutch"
|
---|
210 | !insertmacro MUI_LANGUAGE "Finnish"
|
---|
211 | !insertmacro MUI_LANGUAGE "French"
|
---|
212 | !insertmacro MUI_LANGUAGE "German"
|
---|
213 | !insertmacro MUI_LANGUAGE "Hebrew"
|
---|
214 | !insertmacro MUI_LANGUAGE "Hungarian"
|
---|
215 | !insertmacro MUI_LANGUAGE "Italian"
|
---|
216 | !insertmacro MUI_LANGUAGE "Japanese"
|
---|
217 | !insertmacro MUI_LANGUAGE "Korean"
|
---|
218 | !insertmacro MUI_LANGUAGE "Norwegian"
|
---|
219 | !insertmacro MUI_LANGUAGE "Polish"
|
---|
220 | !insertmacro MUI_LANGUAGE "Portuguese"
|
---|
221 | !insertmacro MUI_LANGUAGE "Russian"
|
---|
222 | !insertmacro MUI_LANGUAGE "SimpChinese"
|
---|
223 | !insertmacro MUI_LANGUAGE "Slovak"
|
---|
224 | !insertmacro MUI_LANGUAGE "Slovenian"
|
---|
225 | !insertmacro MUI_LANGUAGE "Spanish"
|
---|
226 | !insertmacro MUI_LANGUAGE "Thai"
|
---|
227 | !insertmacro MUI_LANGUAGE "TradChinese"
|
---|
228 |
|
---|
229 | ;Custom translations for setup
|
---|
230 |
|
---|
231 | !insertmacro LANGFILE_INCLUDE "translations\english.nsh"
|
---|
232 | !insertmacro LANGFILE_INCLUDE "translations\basque.nsh"
|
---|
233 | !insertmacro LANGFILE_INCLUDE "translations\catalan.nsh"
|
---|
234 | !insertmacro LANGFILE_INCLUDE "translations\croatian.nsh"
|
---|
235 | !insertmacro LANGFILE_INCLUDE "translations\czech.nsh"
|
---|
236 | !insertmacro LANGFILE_INCLUDE "translations\danish.nsh"
|
---|
237 | !insertmacro LANGFILE_INCLUDE "translations\dutch.nsh"
|
---|
238 | !insertmacro LANGFILE_INCLUDE "translations\finnish.nsh"
|
---|
239 | !insertmacro LANGFILE_INCLUDE "translations\french.nsh"
|
---|
240 | !insertmacro LANGFILE_INCLUDE "translations\german.nsh"
|
---|
241 | !insertmacro LANGFILE_INCLUDE "translations\hebrew.nsh"
|
---|
242 | !insertmacro LANGFILE_INCLUDE "translations\hungarian.nsh"
|
---|
243 | !insertmacro LANGFILE_INCLUDE "translations\italian.nsh"
|
---|
244 | !insertmacro LANGFILE_INCLUDE "translations\japanese.nsh"
|
---|
245 | !insertmacro LANGFILE_INCLUDE "translations\korean.nsh"
|
---|
246 | !insertmacro LANGFILE_INCLUDE "translations\norwegian.nsh"
|
---|
247 | !insertmacro LANGFILE_INCLUDE "translations\polish.nsh"
|
---|
248 | !insertmacro LANGFILE_INCLUDE "translations\portuguese.nsh"
|
---|
249 | !insertmacro LANGFILE_INCLUDE "translations\russian.nsh"
|
---|
250 | !insertmacro LANGFILE_INCLUDE "translations\simpchinese.nsh"
|
---|
251 | !insertmacro LANGFILE_INCLUDE "translations\slovak.nsh"
|
---|
252 | !insertmacro LANGFILE_INCLUDE "translations\slovenian.nsh"
|
---|
253 | !insertmacro LANGFILE_INCLUDE "translations\spanish.nsh"
|
---|
254 | !insertmacro LANGFILE_INCLUDE "translations\thai.nsh"
|
---|
255 | !insertmacro LANGFILE_INCLUDE "translations\tradchinese.nsh"
|
---|
256 |
|
---|
257 | ;--------------------------------
|
---|
258 | ;Reserve Files
|
---|
259 |
|
---|
260 | ;These files should be inserted before other files in the data block
|
---|
261 | ;Keep these lines before any File command
|
---|
262 | ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
|
---|
263 |
|
---|
264 | !insertmacro MUI_RESERVEFILE_LANGDLL
|
---|
265 | ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
|
---|
266 |
|
---|
267 | ;--------------------------------
|
---|
268 | ;Installer Sections
|
---|
269 |
|
---|
270 | ;--------------------------------
|
---|
271 | ;Main SMPlayer files
|
---|
272 | Section $(Section_SMPlayer) SecSMPlayer
|
---|
273 |
|
---|
274 | SectionIn RO
|
---|
275 |
|
---|
276 | ${If} $Reinstall_Uninstall == 1
|
---|
277 |
|
---|
278 | ${If} $Reinstall_UninstallButton_State == 1
|
---|
279 | Exec '"$SMPlayer_UnStrPath" /X'
|
---|
280 | Quit
|
---|
281 | ${ElseIf} $Reinstall_OverwriteButton_State == 1
|
---|
282 |
|
---|
283 | Call Backup_Codecs
|
---|
284 |
|
---|
285 | ${If} "$INSTDIR" == "$SMPlayer_Path"
|
---|
286 | ExecWait '"$SMPlayer_UnStrPath" /S /R _?=$SMPlayer_Path'
|
---|
287 | ${Else}
|
---|
288 | ExecWait '"$SMPlayer_UnStrPath" /S /R'
|
---|
289 | ${EndIf}
|
---|
290 |
|
---|
291 | Sleep 2500
|
---|
292 |
|
---|
293 | ${EndIf}
|
---|
294 |
|
---|
295 | ${EndIf}
|
---|
296 |
|
---|
297 | SetOutPath "$INSTDIR"
|
---|
298 | File "${SMPLAYER_BUILD_DIR}\*"
|
---|
299 |
|
---|
300 | ;SMPlayer docs
|
---|
301 | SetOutPath "$INSTDIR\docs"
|
---|
302 | File /r "${SMPLAYER_BUILD_DIR}\docs\*.*"
|
---|
303 |
|
---|
304 | ;Qt imageformats
|
---|
305 | SetOutPath "$INSTDIR\imageformats"
|
---|
306 | File /r "${SMPLAYER_BUILD_DIR}\imageformats\*.*"
|
---|
307 |
|
---|
308 | ;SMPlayer key shortcuts
|
---|
309 | SetOutPath "$INSTDIR\shortcuts"
|
---|
310 | File /r "${SMPLAYER_BUILD_DIR}\shortcuts\*.*"
|
---|
311 |
|
---|
312 | SetOutPath "$PLUGINSDIR"
|
---|
313 | File 7za.exe
|
---|
314 |
|
---|
315 | ;Initialize to 0 if don't exist (based on error flag)
|
---|
316 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer
|
---|
317 | ${If} ${Errors}
|
---|
318 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x0
|
---|
319 | ${EndIf}
|
---|
320 |
|
---|
321 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs
|
---|
322 | ${If} ${Errors}
|
---|
323 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
---|
324 | ${EndIf}
|
---|
325 |
|
---|
326 | SectionEnd
|
---|
327 |
|
---|
328 | ;--------------------------------
|
---|
329 | ;Shortcuts
|
---|
330 | SectionGroup $(ShortcutGroupTitle)
|
---|
331 |
|
---|
332 | ${MementoSection} $(Section_DesktopShortcut) SecDesktopShortcut
|
---|
333 |
|
---|
334 | SetOutPath "$INSTDIR"
|
---|
335 | CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
---|
336 |
|
---|
337 | ${MementoSectionEnd}
|
---|
338 |
|
---|
339 | ${MementoSection} $(Section_StartMenu) SecStartMenuShortcut
|
---|
340 |
|
---|
341 | SetOutPath "$INSTDIR"
|
---|
342 | !insertmacro MUI_STARTMENU_WRITE_BEGIN SMP_SMenu
|
---|
343 | CreateDirectory "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
|
---|
344 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
---|
345 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMTube.lnk" "$INSTDIR\smtube.exe"
|
---|
346 | WriteINIStr "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url" "InternetShortcut" "URL" "http://smplayer.sourceforge.net"
|
---|
347 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
348 | !insertmacro MUI_STARTMENU_WRITE_END
|
---|
349 |
|
---|
350 | ${MementoSectionEnd}
|
---|
351 |
|
---|
352 | SectionGroupEnd
|
---|
353 |
|
---|
354 | ;--------------------------------
|
---|
355 | ;MPlayer & MPlayer Codecs
|
---|
356 | SectionGroup $(MPlayerGroupTitle)
|
---|
357 |
|
---|
358 | Section $(Section_MPlayer) SecMPlayer
|
---|
359 |
|
---|
360 | SectionIn RO
|
---|
361 |
|
---|
362 | SetOutPath "$INSTDIR\mplayer"
|
---|
363 | File /r /x mencoder.exe "${SMPLAYER_BUILD_DIR}\mplayer\*.*"
|
---|
364 |
|
---|
365 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
|
---|
366 |
|
---|
367 | SectionEnd
|
---|
368 |
|
---|
369 | Section /o $(Section_MPlayerCodecs) SecCodecs
|
---|
370 |
|
---|
371 | AddSize 22931
|
---|
372 |
|
---|
373 | ${If} $Restore_Codecs == 1
|
---|
374 | DetailPrint $(Info_Codecs_Restore)
|
---|
375 | CopyFiles /SILENT "$PLUGINSDIR\codecbak\*" "$INSTDIR\mplayer\codecs"
|
---|
376 | Goto check_codecs
|
---|
377 | ${ElseIf} ${FileExists} "$EXEDIR\${CODEC_VERSION}.zip"
|
---|
378 | CopyFiles /SILENT "$EXEDIR\${CODEC_VERSION}.zip" "$PLUGINSDIR"
|
---|
379 | Goto extract_codecs
|
---|
380 | ${EndIf}
|
---|
381 |
|
---|
382 | retry_codecs_dl:
|
---|
383 |
|
---|
384 | DetailPrint $(Codecs_DL_Msg)
|
---|
385 | !ifndef USE_NSISDL
|
---|
386 | inetc::get /CONNECTTIMEOUT 15000 /RESUME "" /BANNER $(Codecs_DL_Msg) /CAPTION $(Codecs_DL_Msg) \
|
---|
387 | "http://www.mplayerhq.hu/MPlayer/releases/codecs/${CODEC_VERSION}.zip" \
|
---|
388 | "$PLUGINSDIR\${CODEC_VERSION}.zip" /END
|
---|
389 | Pop $R0
|
---|
390 | StrCmp $R0 OK +4 0
|
---|
391 | !else
|
---|
392 | NSISdl::download /TIMEOUT=15000 \
|
---|
393 | "http://www.mplayerhq.hu/MPlayer/releases/codecs/${CODEC_VERSION}.zip" \
|
---|
394 | "$PLUGINSDIR\${CODEC_VERSION}.zip" /END
|
---|
395 | Pop $R0
|
---|
396 | StrCmp $R0 "success" +4 0
|
---|
397 | !endif
|
---|
398 | DetailPrint $(Codecs_DL_Failed)
|
---|
399 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(Codecs_DL_Retry) /SD IDCANCEL IDRETRY retry_codecs_dl
|
---|
400 | Goto check_codecs
|
---|
401 |
|
---|
402 | extract_codecs:
|
---|
403 |
|
---|
404 | DetailPrint $(Info_Files_Extract)
|
---|
405 | nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\${CODEC_VERSION}.zip" -y -o"$PLUGINSDIR"'
|
---|
406 |
|
---|
407 | CreateDirectory "$INSTDIR\mplayer\codecs"
|
---|
408 | CopyFiles /SILENT "$PLUGINSDIR\${CODEC_VERSION}\*" "$INSTDIR\mplayer\codecs"
|
---|
409 |
|
---|
410 | check_codecs:
|
---|
411 |
|
---|
412 | IfFileExists "$INSTDIR\mplayer\codecs\*.dll" 0 codecsInstFailed
|
---|
413 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x1
|
---|
414 | Goto done
|
---|
415 | codecsInstFailed:
|
---|
416 | DetailPrint $(Codecs_Inst_Failed)
|
---|
417 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
---|
418 | Sleep 5000
|
---|
419 |
|
---|
420 | done:
|
---|
421 |
|
---|
422 | SectionEnd
|
---|
423 |
|
---|
424 | SectionGroupEnd
|
---|
425 |
|
---|
426 | ;--------------------------------
|
---|
427 | ;Icon themes
|
---|
428 | ${MementoSection} $(Section_IconThemes) SecThemes
|
---|
429 |
|
---|
430 | SetOutPath "$INSTDIR\themes"
|
---|
431 | File /r "${SMPLAYER_BUILD_DIR}\themes\*.*"
|
---|
432 |
|
---|
433 | ${MementoSectionEnd}
|
---|
434 |
|
---|
435 | ;--------------------------------
|
---|
436 | ;Translations
|
---|
437 | ${MementoSection} $(Section_Translations) SecTranslations
|
---|
438 |
|
---|
439 | SetOutPath "$INSTDIR\translations"
|
---|
440 | File /r "${SMPLAYER_BUILD_DIR}\translations\*.*"
|
---|
441 |
|
---|
442 | ${MementoSectionEnd}
|
---|
443 |
|
---|
444 | ;--------------------------------
|
---|
445 | ;Install/Uninstall information
|
---|
446 | Section -Post
|
---|
447 |
|
---|
448 | ;Uninstall file
|
---|
449 | WriteUninstaller "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
450 |
|
---|
451 | ;Store installed path & version
|
---|
452 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Path" "$INSTDIR"
|
---|
453 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Version" "${SMPLAYER_VERSION}"
|
---|
454 |
|
---|
455 | ;Allows user to use 'start smplayer.exe'
|
---|
456 | WriteRegStr HKLM "${SMPLAYER_APP_PATHS_KEY}" "" "$INSTDIR\smplayer.exe"
|
---|
457 | WriteRegStr HKLM "${SMPLAYER_APP_PATHS_KEY}" "Path" "$INSTDIR"
|
---|
458 |
|
---|
459 | ;Default Programs Registration (Vista & later)
|
---|
460 | ${If} ${AtLeastWinVista}
|
---|
461 | Call RegisterDefaultPrograms
|
---|
462 | ${EndIf}
|
---|
463 |
|
---|
464 | ;Registry Uninstall information
|
---|
465 | !ifdef WIN64
|
---|
466 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayName" "$(^Name) (x64)"
|
---|
467 | !else
|
---|
468 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayName" "$(^Name)"
|
---|
469 | !endif
|
---|
470 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayIcon" "$INSTDIR\smplayer.exe"
|
---|
471 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayVersion" "${SMPLAYER_VERSION}"
|
---|
472 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "HelpLink" "http://smplayer.sourceforge.net/forum"
|
---|
473 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "Publisher" "Ricardo Villalba"
|
---|
474 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
475 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLInfoAbout" "http://smplayer.sourceforge.net"
|
---|
476 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLUpdateInfo" "http://smplayer.sourceforge.net"
|
---|
477 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoModify" "1"
|
---|
478 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoRepair" "1"
|
---|
479 |
|
---|
480 | SectionEnd
|
---|
481 |
|
---|
482 | ${MementoSectionDone}
|
---|
483 |
|
---|
484 | ;--------------------------------
|
---|
485 | ;Section descriptions
|
---|
486 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
---|
487 | !insertmacro MUI_DESCRIPTION_TEXT ${SecSMPlayer} $(Section_SMPlayer_Desc)
|
---|
488 | !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} $(Section_DesktopShortcut_Desc)
|
---|
489 | !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} $(Section_StartMenu_Desc)
|
---|
490 | !insertmacro MUI_DESCRIPTION_TEXT ${SecMPlayer} $(Section_MPlayer_Desc)
|
---|
491 | !insertmacro MUI_DESCRIPTION_TEXT ${SecCodecs} $(Section_MPlayerCodecs_Desc)
|
---|
492 | !insertmacro MUI_DESCRIPTION_TEXT ${SecThemes} $(Section_IconThemes_Desc)
|
---|
493 | !insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} $(Section_Translations_Desc)
|
---|
494 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
---|
495 |
|
---|
496 | ;--------------------------------
|
---|
497 | ;Macros
|
---|
498 |
|
---|
499 | !macro MacroAllExtensions _action
|
---|
500 | !insertmacro ${_action} ".3gp"
|
---|
501 | !insertmacro ${_action} ".aac"
|
---|
502 | !insertmacro ${_action} ".ac3"
|
---|
503 | !insertmacro ${_action} ".ape"
|
---|
504 | !insertmacro ${_action} ".asf"
|
---|
505 | !insertmacro ${_action} ".avi"
|
---|
506 | !insertmacro ${_action} ".bik"
|
---|
507 | !insertmacro ${_action} ".bin"
|
---|
508 | !insertmacro ${_action} ".dat"
|
---|
509 | !insertmacro ${_action} ".divx"
|
---|
510 | !insertmacro ${_action} ".dts"
|
---|
511 | !insertmacro ${_action} ".dv"
|
---|
512 | !insertmacro ${_action} ".dvr-ms"
|
---|
513 | !insertmacro ${_action} ".f4v"
|
---|
514 | !insertmacro ${_action} ".flac"
|
---|
515 | !insertmacro ${_action} ".flv"
|
---|
516 | !insertmacro ${_action} ".hdmov"
|
---|
517 | !insertmacro ${_action} ".iso"
|
---|
518 | !insertmacro ${_action} ".m1v"
|
---|
519 | !insertmacro ${_action} ".m2t"
|
---|
520 | !insertmacro ${_action} ".m2ts"
|
---|
521 | !insertmacro ${_action} ".mts"
|
---|
522 | !insertmacro ${_action} ".m2v"
|
---|
523 | !insertmacro ${_action} ".m3u"
|
---|
524 | !insertmacro ${_action} ".m3u8"
|
---|
525 | !insertmacro ${_action} ".m4a"
|
---|
526 | !insertmacro ${_action} ".m4v"
|
---|
527 | !insertmacro ${_action} ".mka"
|
---|
528 | !insertmacro ${_action} ".mkv"
|
---|
529 | !insertmacro ${_action} ".mov"
|
---|
530 | !insertmacro ${_action} ".mp3"
|
---|
531 | !insertmacro ${_action} ".mp4"
|
---|
532 | !insertmacro ${_action} ".mpeg"
|
---|
533 | !insertmacro ${_action} ".mpg"
|
---|
534 | !insertmacro ${_action} ".mpv"
|
---|
535 | !insertmacro ${_action} ".mqv"
|
---|
536 | !insertmacro ${_action} ".nsv"
|
---|
537 | !insertmacro ${_action} ".oga"
|
---|
538 | !insertmacro ${_action} ".ogg"
|
---|
539 | !insertmacro ${_action} ".ogm"
|
---|
540 | !insertmacro ${_action} ".ogv"
|
---|
541 | !insertmacro ${_action} ".ogx"
|
---|
542 | !insertmacro ${_action} ".pls"
|
---|
543 | !insertmacro ${_action} ".ra"
|
---|
544 | !insertmacro ${_action} ".ram"
|
---|
545 | !insertmacro ${_action} ".rec"
|
---|
546 | !insertmacro ${_action} ".rm"
|
---|
547 | !insertmacro ${_action} ".rmvb"
|
---|
548 | !insertmacro ${_action} ".smk"
|
---|
549 | !insertmacro ${_action} ".swf"
|
---|
550 | !insertmacro ${_action} ".thd"
|
---|
551 | !insertmacro ${_action} ".ts"
|
---|
552 | !insertmacro ${_action} ".vcd"
|
---|
553 | !insertmacro ${_action} ".vfw"
|
---|
554 | !insertmacro ${_action} ".vob"
|
---|
555 | !insertmacro ${_action} ".vp8"
|
---|
556 | !insertmacro ${_action} ".wav"
|
---|
557 | !insertmacro ${_action} ".webm"
|
---|
558 | !insertmacro ${_action} ".wma"
|
---|
559 | !insertmacro ${_action} ".wmv"
|
---|
560 | !insertmacro ${_action} ".wtv"
|
---|
561 | !macroend
|
---|
562 |
|
---|
563 | !macro WriteRegStrSupportedTypes EXT
|
---|
564 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}\Capabilities\FileAssociations" ${EXT} "MPlayerFileVideo"
|
---|
565 | !macroend
|
---|
566 |
|
---|
567 | !macro MacroRemoveSMPlayer
|
---|
568 | ;Delete desktop and start menu shortcuts
|
---|
569 | SetDetailsPrint textonly
|
---|
570 | DetailPrint $(Info_Del_Shortcuts)
|
---|
571 | SetDetailsPrint listonly
|
---|
572 |
|
---|
573 | SetShellVarContext all
|
---|
574 | Delete "$DESKTOP\SMPlayer.lnk"
|
---|
575 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk"
|
---|
576 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMTube.lnk"
|
---|
577 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url"
|
---|
578 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk"
|
---|
579 | RMDir "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
|
---|
580 |
|
---|
581 | ;Delete directories recursively except for main directory
|
---|
582 | ;Do not recursively delete $INSTDIR
|
---|
583 | SetDetailsPrint textonly
|
---|
584 | DetailPrint $(Info_Del_Files)
|
---|
585 | SetDetailsPrint listonly
|
---|
586 |
|
---|
587 | RMDir /r "$INSTDIR\docs"
|
---|
588 | RMDir /r "$INSTDIR\imageformats"
|
---|
589 | RMDir /r "$INSTDIR\mplayer"
|
---|
590 | RMDir /r "$INSTDIR\shortcuts"
|
---|
591 | RMDir /r "$INSTDIR\themes"
|
---|
592 | RMDir /r "$INSTDIR\translations"
|
---|
593 | Delete "$INSTDIR\*.txt"
|
---|
594 | Delete "$INSTDIR\libgcc_s_dw2-1.dll"
|
---|
595 | Delete "$INSTDIR\libwinpthread-1.dll"
|
---|
596 | Delete "$INSTDIR\mingwm10.dll"
|
---|
597 | Delete "$INSTDIR\zlib1.dll"
|
---|
598 | Delete "$INSTDIR\Qt*.dll"
|
---|
599 | Delete "$INSTDIR\sample.avi"
|
---|
600 | Delete "$INSTDIR\smplayer.exe"
|
---|
601 | Delete "$INSTDIR\smtube.exe"
|
---|
602 | Delete "$INSTDIR\dxlist.exe"
|
---|
603 |
|
---|
604 | ;Delete registry keys
|
---|
605 | SetDetailsPrint textonly
|
---|
606 | DetailPrint $(Info_Del_Registry)
|
---|
607 | SetDetailsPrint listonly
|
---|
608 |
|
---|
609 | DeleteRegKey HKLM "${SMPLAYER_REG_KEY}"
|
---|
610 | DeleteRegKey HKLM "${SMPLAYER_APP_PATHS_KEY}"
|
---|
611 | DeleteRegKey HKLM "${SMPLAYER_DEF_PROGS_KEY}"
|
---|
612 | DeleteRegKey HKLM "${SMPLAYER_UNINST_KEY}"
|
---|
613 | DeleteRegKey HKCR "MPlayerFileVideo"
|
---|
614 | DeleteRegValue HKLM "Software\RegisteredApplications" "SMPlayer"
|
---|
615 |
|
---|
616 | SetDetailsPrint both
|
---|
617 | !macroend
|
---|
618 |
|
---|
619 | ;--------------------------------
|
---|
620 | ;Shared functions
|
---|
621 |
|
---|
622 | !ifdef USE_RUNCHECK
|
---|
623 | !macro RunCheckMacro UN
|
---|
624 | Function ${UN}RunCheck
|
---|
625 |
|
---|
626 | retry_runcheck:
|
---|
627 | FindWindow $0 "QWidget" "SMPlayer"
|
---|
628 | StrCmp $0 0 notRunning
|
---|
629 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(SMPlayer_Is_Running) /SD IDCANCEL IDRETRY retry_runcheck
|
---|
630 | Abort
|
---|
631 | notrunning:
|
---|
632 |
|
---|
633 | FunctionEnd
|
---|
634 | !macroend
|
---|
635 | !insertmacro RunCheckMacro ""
|
---|
636 | !insertmacro RunCheckMacro "un."
|
---|
637 | !endif
|
---|
638 |
|
---|
639 | ;--------------------------------
|
---|
640 | ;Installer functions
|
---|
641 |
|
---|
642 | Function .onInit
|
---|
643 |
|
---|
644 | /*
|
---|
645 | ${Unless} ${AtLeastWinXP}
|
---|
646 | MessageBox MB_YESNO|MB_ICONSTOP $(OS_Not_Supported) /SD IDNO IDYES installonoldwindows
|
---|
647 | Abort
|
---|
648 | installonoldwindows:
|
---|
649 | ${EndIf}
|
---|
650 | */
|
---|
651 |
|
---|
652 | !ifdef WIN64
|
---|
653 | ${IfNot} ${RunningX64}
|
---|
654 | MessageBox MB_OK|MB_ICONSTOP $(Win64_Required)
|
---|
655 | Abort
|
---|
656 | ${EndIf}
|
---|
657 |
|
---|
658 | SetRegView 32
|
---|
659 | ClearErrors
|
---|
660 | ReadRegStr $R0 HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString"
|
---|
661 |
|
---|
662 | IfErrors +3 0
|
---|
663 | MessageBox MB_OK|MB_ICONSTOP $(Existing_32bitInst)
|
---|
664 | Abort
|
---|
665 |
|
---|
666 | SetRegView 64
|
---|
667 | !else
|
---|
668 | ${If} ${RunningX64}
|
---|
669 | SetRegView 64
|
---|
670 | ClearErrors
|
---|
671 | ReadRegStr $R0 HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString"
|
---|
672 |
|
---|
673 | IfErrors +3 0
|
---|
674 | MessageBox MB_OK|MB_ICONSTOP $(Existing_64bitInst)
|
---|
675 | Abort
|
---|
676 |
|
---|
677 | SetRegView 32
|
---|
678 | ${EndIf}
|
---|
679 | !endif
|
---|
680 |
|
---|
681 | ;Check if setup is already running
|
---|
682 | System::Call 'kernel32::CreateMutexW(i 0, i 0, t "SMPlayerSetup") i .r1 ?e'
|
---|
683 | Pop $R0
|
---|
684 |
|
---|
685 | StrCmp $R0 0 +3
|
---|
686 | MessageBox MB_OK|MB_ICONEXCLAMATION $(Installer_Is_Running)
|
---|
687 | Abort
|
---|
688 |
|
---|
689 | !ifdef USE_RUNCHECK
|
---|
690 | ;Check if SMPlayer is running
|
---|
691 | ;Allow skipping check using /NORUNCHECK
|
---|
692 | ${GetParameters} $R0
|
---|
693 | ${GetOptions} $R0 "/NORUNCHECK" $R1
|
---|
694 | IfErrors 0 +2
|
---|
695 | Call RunCheck
|
---|
696 | !endif
|
---|
697 |
|
---|
698 | ;Check for admin on < Vista
|
---|
699 | UserInfo::GetAccountType
|
---|
700 | Pop $R0
|
---|
701 | ${If} $R0 != "admin"
|
---|
702 | MessageBox MB_OK|MB_ICONSTOP $(Installer_No_Admin)
|
---|
703 | Abort
|
---|
704 | ${EndIf}
|
---|
705 |
|
---|
706 | Call LoadPreviousSettings
|
---|
707 |
|
---|
708 | ;Setup language selection
|
---|
709 | !insertmacro MUI_LANGDLL_DISPLAY
|
---|
710 |
|
---|
711 | Call CheckPreviousVersion
|
---|
712 |
|
---|
713 | SetShellVarContext all
|
---|
714 |
|
---|
715 | FunctionEnd
|
---|
716 |
|
---|
717 | Function .onInstSuccess
|
---|
718 |
|
---|
719 | ${MementoSectionSave}
|
---|
720 |
|
---|
721 | ExecShell "open" "http://smplayer.sourceforge.net/thank-you.php?version=${SMPLAYER_VERSION}"
|
---|
722 |
|
---|
723 | FunctionEnd
|
---|
724 |
|
---|
725 | Function .onInstFailed
|
---|
726 |
|
---|
727 | SetDetailsPrint textonly
|
---|
728 | DetailPrint $(Info_RollBack)
|
---|
729 | SetDetailsPrint listonly
|
---|
730 |
|
---|
731 | !insertmacro MacroRemoveSMPlayer
|
---|
732 |
|
---|
733 | Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
734 | RMDir "$INSTDIR"
|
---|
735 |
|
---|
736 | FunctionEnd
|
---|
737 |
|
---|
738 | Function un.onUninstSuccess
|
---|
739 |
|
---|
740 | ;Don't launch uninstall page if reinstalling
|
---|
741 | ${un.GetParameters} $R0
|
---|
742 | ${un.GetOptionsS} $R0 "/R" $R1
|
---|
743 |
|
---|
744 | IfErrors 0 +2
|
---|
745 | ExecShell "open" "http://smplayer.sourceforge.net/uninstall.php?version=${SMPLAYER_VERSION}"
|
---|
746 |
|
---|
747 | FunctionEnd
|
---|
748 |
|
---|
749 | Function CheckPreviousVersion
|
---|
750 |
|
---|
751 | ClearErrors
|
---|
752 | ReadRegStr $Previous_Version HKLM "${SMPLAYER_REG_KEY}" "Version"
|
---|
753 | ReadRegStr $SMPlayer_UnStrPath HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString"
|
---|
754 | ReadRegStr $SMPlayer_Path HKLM "${SMPLAYER_REG_KEY}" "Path"
|
---|
755 |
|
---|
756 | ${IfNot} ${Errors}
|
---|
757 | StrCpy $Reinstall_Uninstall 1
|
---|
758 | ${EndIf}
|
---|
759 |
|
---|
760 | /* $Previous_Version_State Assignments:
|
---|
761 | $Previous_Version_State=0 This installer is the same version as the installed copy
|
---|
762 | $Previous_Version_State=1 A newer version than this installer is already installed
|
---|
763 | $Previous_Version_State=2 An older version than this installer is already installed */
|
---|
764 | ${VersionCompare} $Previous_Version ${SMPLAYER_VERSION} $Previous_Version_State
|
---|
765 |
|
---|
766 | ${If} $Previous_Version_State == 0
|
---|
767 | StrCpy $Inst_Type $(Type_Reinstall)
|
---|
768 | ${ElseIf} $Previous_Version_State == 1
|
---|
769 | StrCpy $Inst_Type $(Type_Downgrade)
|
---|
770 | ${ElseIf} $Previous_Version_State == 2
|
---|
771 | StrCpy $Inst_Type $(Type_Upgrade)
|
---|
772 | ${EndIf}
|
---|
773 |
|
---|
774 | FunctionEnd
|
---|
775 |
|
---|
776 | Function Backup_Codecs
|
---|
777 |
|
---|
778 | ${IfNot} ${SectionIsSelected} ${SecCodecs}
|
---|
779 | Return
|
---|
780 | ${EndIf}
|
---|
781 |
|
---|
782 | IfFileExists "$SMPlayer_Path\mplayer\codecs\*.dll" 0 NoBackup
|
---|
783 | DetailPrint $(Info_Codecs_Backup)
|
---|
784 | CreateDirectory "$PLUGINSDIR\codecbak"
|
---|
785 | CopyFiles /SILENT "$SMPlayer_Path\mplayer\codecs\*" "$PLUGINSDIR\codecbak"
|
---|
786 | StrCpy $Restore_Codecs 1
|
---|
787 | Return
|
---|
788 | NoBackup:
|
---|
789 | StrCpy $Restore_Codecs 0
|
---|
790 |
|
---|
791 | FunctionEnd
|
---|
792 |
|
---|
793 | Function LoadPreviousSettings
|
---|
794 |
|
---|
795 | ;MPlayer codecs section doesn't use Memento so we need to restore it manually
|
---|
796 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" "Installed_Codecs"
|
---|
797 | ${If} $R0 == 1
|
---|
798 | !insertmacro SelectSection ${SecCodecs}
|
---|
799 | ${EndIf}
|
---|
800 |
|
---|
801 | ;Gets start menu folder name
|
---|
802 | !insertmacro MUI_STARTMENU_GETFOLDER "SMP_SMenu" $SMPlayer_StartMenuFolder
|
---|
803 |
|
---|
804 | ${MementoSectionRestore}
|
---|
805 |
|
---|
806 | FunctionEnd
|
---|
807 |
|
---|
808 | Function PageReinstall
|
---|
809 |
|
---|
810 | ${If} $Reinstall_Uninstall != 1
|
---|
811 | Abort
|
---|
812 | ${EndIf}
|
---|
813 |
|
---|
814 | nsDialogs::Create /NOUNLOAD 1018
|
---|
815 | Pop $Dialog_Reinstall
|
---|
816 |
|
---|
817 | nsDialogs::SetRTL $(^RTL)
|
---|
818 |
|
---|
819 | !insertmacro MUI_HEADER_TEXT $(Reinstall_Header_Text) $(Reinstall_Header_SubText)
|
---|
820 |
|
---|
821 | ${NSD_CreateLabel} 0 0 225u 8u $(Reinstall_Msg1)
|
---|
822 |
|
---|
823 | ${NSD_CreateText} 10u 15u 290u 14u "$SMPlayer_Path"
|
---|
824 | Pop $R0
|
---|
825 |
|
---|
826 | ${NSD_CreateLabel} 0 40u 100u 8u $(Reinstall_Msg2)
|
---|
827 |
|
---|
828 | ${NSD_CreateRadioButton} 10u 58u 200u 8u $(Reinstall_Overwrite)
|
---|
829 | Pop $Reinstall_OverwriteButton
|
---|
830 | ${NSD_CreateRadioButton} 10u 73u 200u 8u $(Reinstall_Uninstall)
|
---|
831 | Pop $Reinstall_UninstallButton
|
---|
832 |
|
---|
833 | ${NSD_CreateCheckBox} 0 90u 100% 8u $(Reinstall_Msg4)
|
---|
834 | Pop $Reinstall_ChgSettings
|
---|
835 |
|
---|
836 | ${NSD_CreateLabel} 0 115u 100% 16u
|
---|
837 | Pop $Reinstall_Message
|
---|
838 |
|
---|
839 | SendMessage $Reinstall_OverwriteButton ${BM_SETCHECK} 1 0
|
---|
840 | EnableWindow $R0 0
|
---|
841 |
|
---|
842 | ${If} $Reinstall_ChgSettings_State == 1
|
---|
843 | SendMessage $Reinstall_ChgSettings ${BM_SETCHECK} 1 0
|
---|
844 | ${Endif}
|
---|
845 |
|
---|
846 | ${NSD_OnClick} $Reinstall_OverwriteButton PageReinstallUpdate
|
---|
847 | ${NSD_OnClick} $Reinstall_UninstallButton PageReinstallUpdate
|
---|
848 | ${NSD_OnClick} $Reinstall_ChgSettings PageReinstallUpdate
|
---|
849 |
|
---|
850 | Call PageReinstallUpdate
|
---|
851 |
|
---|
852 | nsDialogs::Show
|
---|
853 |
|
---|
854 | FunctionEnd
|
---|
855 |
|
---|
856 | Function PageReinstallLeave
|
---|
857 |
|
---|
858 | ${NSD_GetState} $Reinstall_OverwriteButton $Reinstall_OverwriteButton_State
|
---|
859 | ${NSD_GetState} $Reinstall_UninstallButton $Reinstall_UninstallButton_State
|
---|
860 | ${NSD_GetState} $Reinstall_ChgSettings $Reinstall_ChgSettings_State
|
---|
861 |
|
---|
862 | FunctionEnd
|
---|
863 |
|
---|
864 | Function PageReinstallUpdate
|
---|
865 |
|
---|
866 | ${NSD_GetState} $Reinstall_OverwriteButton $Reinstall_OverwriteButton_State
|
---|
867 | ${NSD_GetState} $Reinstall_UninstallButton $Reinstall_UninstallButton_State
|
---|
868 | ${NSD_GetState} $Reinstall_ChgSettings $Reinstall_ChgSettings_State
|
---|
869 |
|
---|
870 | ${If} $Reinstall_OverwriteButton_State == 1
|
---|
871 |
|
---|
872 | EnableWindow $Reinstall_ChgSettings 1
|
---|
873 |
|
---|
874 | GetDlgItem $R0 $HWNDPARENT 1
|
---|
875 | ${If} $Reinstall_ChgSettings_State != 1
|
---|
876 | SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(StartBtn)"
|
---|
877 | ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_1)
|
---|
878 | ${ElseIf} $Reinstall_ChgSettings_State == 1
|
---|
879 | SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(^NextBtn)"
|
---|
880 | ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_2)
|
---|
881 | ${EndIf}
|
---|
882 |
|
---|
883 | ${ElseIf} $Reinstall_UninstallButton_State == 1
|
---|
884 |
|
---|
885 | EnableWindow $Reinstall_ChgSettings 0
|
---|
886 | ${NSD_SetState} $Reinstall_ChgSettings 0
|
---|
887 |
|
---|
888 | GetDlgItem $R0 $HWNDPARENT 1
|
---|
889 | SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(^UninstallBtn)"
|
---|
890 |
|
---|
891 | ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_3)
|
---|
892 |
|
---|
893 | ${EndIf}
|
---|
894 |
|
---|
895 | FunctionEnd
|
---|
896 |
|
---|
897 | Function PageComponentsPre
|
---|
898 |
|
---|
899 | ${If} $Reinstall_Uninstall == 1
|
---|
900 | ${AndIf} $Reinstall_ChgSettings_State != 1
|
---|
901 | Abort
|
---|
902 | ${EndIf}
|
---|
903 |
|
---|
904 | FunctionEnd
|
---|
905 |
|
---|
906 | Function PageDirectoryPre
|
---|
907 |
|
---|
908 | ${If} $Reinstall_Uninstall == 1
|
---|
909 | ${AndIf} $Reinstall_ChgSettings_State != 1
|
---|
910 | Abort
|
---|
911 | ${EndIf}
|
---|
912 |
|
---|
913 | FunctionEnd
|
---|
914 |
|
---|
915 | Function PageStartMenuPre
|
---|
916 |
|
---|
917 | ${If} $Reinstall_Uninstall == 1
|
---|
918 | ${AndIf} $Reinstall_ChgSettings_State != 1
|
---|
919 | Abort
|
---|
920 | ${EndIf}
|
---|
921 |
|
---|
922 | ${IfNot} ${SectionIsSelected} ${SecStartMenuShortcut}
|
---|
923 | Abort
|
---|
924 | ${EndIf}
|
---|
925 |
|
---|
926 | FunctionEnd
|
---|
927 |
|
---|
928 | Function RegisterDefaultPrograms
|
---|
929 |
|
---|
930 | WriteRegStr HKCR "MPlayerFileVideo\DefaultIcon" "" '"$INSTDIR\smplayer.exe",1'
|
---|
931 | WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue" "" "Enqueue in SMPlayer"
|
---|
932 | WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue\command" "" '"$INSTDIR\smplayer.exe" -add-to-playlist "%1"'
|
---|
933 | WriteRegStr HKCR "MPlayerFileVideo\shell\open" "FriendlyAppName" "SMPlayer Media Player"
|
---|
934 | WriteRegStr HKCR "MPlayerFileVideo\shell\open\command" "" '"$INSTDIR\smplayer.exe" "%1"'
|
---|
935 |
|
---|
936 | ;Modify the list of extensions added in the MacroAllExtensions macro
|
---|
937 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}" "" "SMPlayer"
|
---|
938 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}\Capabilities" "ApplicationDescription" $(Application_Description)
|
---|
939 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}\Capabilities" "ApplicationName" "SMPlayer"
|
---|
940 | WriteRegStr HKLM "Software\RegisteredApplications" "SMPlayer" "${SMPLAYER_DEF_PROGS_KEY}\Capabilities"
|
---|
941 | !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
|
---|
942 |
|
---|
943 | FunctionEnd
|
---|
944 |
|
---|
945 | /*************************************** Uninstaller *******************************************/
|
---|
946 |
|
---|
947 | Section Uninstall
|
---|
948 |
|
---|
949 | ;Make sure SMPlayer is installed from where the uninstaller is being executed.
|
---|
950 | IfFileExists $INSTDIR\smplayer.exe smplayer_installed
|
---|
951 | MessageBox MB_YESNO $(Uninstaller_NotInstalled) /SD IDNO IDYES smplayer_installed
|
---|
952 | Abort $(Uninstaller_Aborted)
|
---|
953 |
|
---|
954 | smplayer_installed:
|
---|
955 |
|
---|
956 | SetDetailsPrint textonly
|
---|
957 | DetailPrint $(Info_Rest_Assoc)
|
---|
958 | SetDetailsPrint listonly
|
---|
959 |
|
---|
960 | ;Don't restore file associations if reinstalling
|
---|
961 | ${un.GetParameters} $R0
|
---|
962 | ${un.GetOptionsS} $R0 "/R" $R1
|
---|
963 |
|
---|
964 | IfErrors 0 +2
|
---|
965 | ExecWait '"$INSTDIR\smplayer.exe" -uninstall'
|
---|
966 |
|
---|
967 | !insertmacro MacroRemoveSMPlayer
|
---|
968 |
|
---|
969 | Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
970 | RMDir "$INSTDIR"
|
---|
971 |
|
---|
972 | SectionEnd
|
---|
973 |
|
---|
974 | ;--------------------------------
|
---|
975 | ;Required functions
|
---|
976 |
|
---|
977 | !insertmacro un.GetParameters
|
---|
978 | !insertmacro un.GetOptions
|
---|
979 |
|
---|
980 | ;--------------------------------
|
---|
981 | ;Uninstaller functions
|
---|
982 |
|
---|
983 | Function un.onInit
|
---|
984 |
|
---|
985 | !ifdef WIN64
|
---|
986 | ${IfNot} ${RunningX64}
|
---|
987 | MessageBox MB_OK|MB_ICONSTOP $(Uninstaller_64bitOnly)
|
---|
988 | Abort
|
---|
989 | ${EndIf}
|
---|
990 |
|
---|
991 | SetRegView 64
|
---|
992 | !endif
|
---|
993 |
|
---|
994 | ;Check for admin on < Vista
|
---|
995 | UserInfo::GetAccountType
|
---|
996 | Pop $R0
|
---|
997 | ${If} $R0 != "admin"
|
---|
998 | MessageBox MB_OK|MB_ICONSTOP $(Uninstaller_No_Admin)
|
---|
999 | Abort
|
---|
1000 | ${EndIf}
|
---|
1001 |
|
---|
1002 | !ifdef USE_RUNCHECK
|
---|
1003 | ;Check if SMPlayer is running
|
---|
1004 | ;Allow skipping check using /NORUNCHECK
|
---|
1005 | ${un.GetParameters} $R0
|
---|
1006 | ${un.GetOptions} $R0 "/NORUNCHECK" $R1
|
---|
1007 | IfErrors 0 +2
|
---|
1008 | Call un.RunCheck
|
---|
1009 | !endif
|
---|
1010 |
|
---|
1011 | ;Gets start menu folder name
|
---|
1012 | !insertmacro MUI_STARTMENU_GETFOLDER "SMP_SMenu" $SMPlayer_StartMenuFolder
|
---|
1013 |
|
---|
1014 | ;Get the stored language preference
|
---|
1015 | !insertmacro MUI_UNGETLANGUAGE
|
---|
1016 |
|
---|
1017 | FunctionEnd
|
---|
1018 |
|
---|
1019 | Function un.ConfirmPagePre
|
---|
1020 |
|
---|
1021 | ${un.GetParameters} $R0
|
---|
1022 |
|
---|
1023 | ${un.GetOptionsS} $R0 "/X" $R1
|
---|
1024 | ${Unless} ${Errors}
|
---|
1025 | Abort
|
---|
1026 | ${EndUnless}
|
---|
1027 |
|
---|
1028 | FunctionEnd
|
---|