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

Last change on this file since 166 was 165, checked in by Silvan Scherrer, 11 years ago

SMPlayer: update trunk to latest 0.8.7

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