source: smplayer/trunk/setup/smplayer.nsi@ 139

Last change on this file since 139 was 139, checked in by Silvan Scherrer, 13 years ago

SMPlayer: update trunk to 0.8.2

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