source: smplayer/trunk/setup/smplayer.win32.nsi@ 119

Last change on this file since 119 was 119, checked in by Silvan Scherrer, 14 years ago

SMPlayer: latest svn update

File size: 35.3 KB
Line 
1; Installer script for win32 SMPlayer
2; Written by redxii (redxii@users.sourceforge.net)
3; Tested/Developed with Unicode NSIS 2.46
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 !define SMPLAYER_APP_PATHS_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\smplayer.exe"
33 !define SMPLAYER_REG_KEY "Software\SMPlayer"
34
35 !define SMPLAYER_UNINST_EXE "uninst.exe"
36 !define SMPLAYER_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SMPlayer"
37
38 ;Fallback versions
39 ;These can be changed in the compiler, otherwise
40 ;if not defined the values shown here will be used.
41!ifndef DEFAULT_CODECS_VERSION
42 !define DEFAULT_CODECS_VERSION "windows-essential-20071007"
43!endif
44
45!ifndef WITH_MPLAYER
46
47 !ifndef DEFAULT_MPLAYER_VERSION
48 !define DEFAULT_MPLAYER_VERSION "mplayer-svn-33216"
49 !endif
50
51!endif
52
53 ;Version control
54!ifndef VERSION_FILE_URL
55 !define VERSION_FILE_URL "http://smplayer.sourceforge.net/mplayer-version-info"
56!endif
57
58;--------------------------------
59;General
60
61 ;Name and file
62 Name "SMPlayer ${SMPLAYER_VERSION}"
63 BrandingText "SMPlayer for Windows v${SMPLAYER_VERSION}"
64!ifdef WITH_MPLAYER
65 OutFile "smplayer-${SMPLAYER_VERSION}-win32.exe"
66!else ifndef WITH_MPLAYER
67 OutFile "smplayer-${SMPLAYER_VERSION}-webdl.exe"
68!endif
69
70 ;Version tab properties
71 VIProductVersion "${SMPLAYER_PRODUCT_VERSION}"
72 VIAddVersionKey "ProductName" "SMPlayer"
73 VIAddVersionKey "ProductVersion" "${SMPLAYER_VERSION}"
74 VIAddVersionKey "FileVersion" "${SMPLAYER_VERSION}"
75 VIAddVersionKey "LegalCopyright" ""
76!ifdef WITH_MPLAYER
77 VIAddVersionKey "FileDescription" "SMPlayer Installer (Offline)"
78!else ifndef WITH_MPLAYER
79 VIAddVersionKey "FileDescription" "SMPlayer Installer (Web Downloader)"
80!endif
81
82 ;Default installation folder
83 InstallDir "$PROGRAMFILES\SMPlayer"
84
85 ;Get installation folder from registry if available
86 InstallDirRegKey HKLM "${SMPLAYER_REG_KEY}" "Path"
87
88 ;Vista+ XML manifest, does not affect older OSes
89 RequestExecutionLevel admin
90
91 ShowInstDetails show
92 ShowUnInstDetails show
93
94;--------------------------------
95;Variables
96
97 Var Codec_Version
98 Var Dialog_Reinstall
99 Var Inst_Type
100 Var Is_Admin
101!ifndef WITH_MPLAYER
102 Var MPlayer_Version
103!endif
104 Var Previous_Version
105 Var Previous_Version_State
106 Var Reinstall_ChgSettings
107 Var Reinstall_ChgSettings_State
108 Var Reinstall_Message
109 Var Reinstall_OverwriteButton
110 Var Reinstall_OverwriteButton_State
111 Var Reinstall_Uninstall
112 Var Reinstall_UninstallButton
113 Var Reinstall_UninstallButton_State
114 Var SMPlayer_Path
115 Var SMPlayer_StartMenuFolder
116 Var UserName
117
118;--------------------------------
119;Interface Settings
120
121 ;Installer/Uninstaller icons
122 !define MUI_ICON "smplayer-orange-installer.ico"
123 !define MUI_UNICON "smplayer-orange-uninstaller.ico"
124
125 ; Misc
126 !define MUI_WELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard.bmp"
127 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard-un.bmp"
128 !define MUI_ABORTWARNING
129
130 ; License page
131 !define MUI_LICENSEPAGE_RADIOBUTTONS
132
133 ; Components page
134 !define MUI_COMPONENTSPAGE_SMALLDESC
135
136 ; Finish page
137 !define MUI_FINISHPAGE_LINK "http://smplayer.sourceforge.net"
138 !define MUI_FINISHPAGE_LINK_LOCATION "http://smplayer.sourceforge.net"
139 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
140 !define MUI_FINISHPAGE_RUN $INSTDIR\smplayer.exe
141 !define MUI_FINISHPAGE_RUN_NOTCHECKED
142 !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Release_notes.txt
143 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
144
145 ;Language Selection Dialog Settings
146 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
147 !define MUI_LANGDLL_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
148 !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
149
150 ;Memento Settings
151 !define MEMENTO_REGISTRY_ROOT HKLM
152 !define MEMENTO_REGISTRY_KEY "${SMPLAYER_REG_KEY}"
153
154 ;Start Menu Settings
155 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SMPlayer"
156 !define MUI_STARTMENUPAGE_NODISABLE
157 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
158 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
159 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenu"
160
161;--------------------------------
162;Include Modern UI and functions
163
164 !include MUI2.nsh
165 !include FileFunc.nsh
166 !include Memento.nsh
167 !include nsDialogs.nsh
168 !include Sections.nsh
169 !include WinVer.nsh
170 !include WordFunc.nsh
171
172;--------------------------------
173;Pages
174
175 ;Install pages
176 !insertmacro MUI_PAGE_WELCOME
177 !insertmacro MUI_PAGE_LICENSE "smplayer-build\Copying.txt"
178
179 #Upgrade/Reinstall
180 Page custom PageReinstall PageReinstallLeave
181
182 #Components
183 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
184 !insertmacro MUI_PAGE_COMPONENTS
185
186 #Install Directory
187 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
188 !insertmacro MUI_PAGE_DIRECTORY
189
190 #Start Menu
191 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageStartMenuPre
192 !insertmacro MUI_PAGE_STARTMENU "SMP_SMenu" $SMPlayer_StartMenuFolder
193
194 !insertmacro MUI_PAGE_INSTFILES
195 !insertmacro MUI_PAGE_FINISH
196
197 ;Uninstall pages
198 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
199 !insertmacro MUI_UNPAGE_CONFIRM
200 !insertmacro MUI_UNPAGE_INSTFILES
201 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.FinishPagePre
202 !insertmacro MUI_UNPAGE_FINISH
203
204;--------------------------------
205;Languages
206
207 !insertmacro MUI_LANGUAGE "English"
208 !insertmacro MUI_LANGUAGE "Basque"
209 !insertmacro MUI_LANGUAGE "Catalan"
210 !insertmacro MUI_LANGUAGE "Czech"
211 !insertmacro MUI_LANGUAGE "Danish"
212 !insertmacro MUI_LANGUAGE "Dutch"
213 !insertmacro MUI_LANGUAGE "Finnish"
214 !insertmacro MUI_LANGUAGE "French"
215 !insertmacro MUI_LANGUAGE "German"
216 !insertmacro MUI_LANGUAGE "Hebrew"
217 !insertmacro MUI_LANGUAGE "Hungarian"
218 !insertmacro MUI_LANGUAGE "Italian"
219 !insertmacro MUI_LANGUAGE "Japanese"
220 !insertmacro MUI_LANGUAGE "Korean"
221 !insertmacro MUI_LANGUAGE "Norwegian"
222 !insertmacro MUI_LANGUAGE "Polish"
223 !insertmacro MUI_LANGUAGE "Portuguese"
224 !insertmacro MUI_LANGUAGE "Russian"
225 !insertmacro MUI_LANGUAGE "SimpChinese"
226 !insertmacro MUI_LANGUAGE "Slovak"
227 !insertmacro MUI_LANGUAGE "Slovenian"
228 !insertmacro MUI_LANGUAGE "Spanish"
229 !insertmacro MUI_LANGUAGE "TradChinese"
230
231; Custom translations for setup
232
233 !insertmacro LANGFILE_INCLUDE "translations\english.nsh"
234 !insertmacro LANGFILE_INCLUDE "translations\basque.nsh"
235 !insertmacro LANGFILE_INCLUDE "translations\catalan.nsh"
236 !insertmacro LANGFILE_INCLUDE "translations\czech.nsh"
237 !insertmacro LANGFILE_INCLUDE "translations\danish.nsh"
238 !insertmacro LANGFILE_INCLUDE "translations\dutch.nsh"
239 !insertmacro LANGFILE_INCLUDE "translations\finnish.nsh"
240 !insertmacro LANGFILE_INCLUDE "translations\french.nsh"
241 !insertmacro LANGFILE_INCLUDE "translations\german.nsh"
242 !insertmacro LANGFILE_INCLUDE "translations\hebrew.nsh"
243 !insertmacro LANGFILE_INCLUDE "translations\hungarian.nsh"
244 !insertmacro LANGFILE_INCLUDE "translations\italian.nsh"
245 !insertmacro LANGFILE_INCLUDE "translations\japanese.nsh"
246 !insertmacro LANGFILE_INCLUDE "translations\korean.nsh"
247 !insertmacro LANGFILE_INCLUDE "translations\norwegian.nsh"
248 !insertmacro LANGFILE_INCLUDE "translations\polish.nsh"
249 !insertmacro LANGFILE_INCLUDE "translations\portuguese.nsh"
250 !insertmacro LANGFILE_INCLUDE "translations\russian.nsh"
251 !insertmacro LANGFILE_INCLUDE "translations\simpchinese.nsh"
252 !insertmacro LANGFILE_INCLUDE "translations\slovak.nsh"
253 !insertmacro LANGFILE_INCLUDE "translations\slovenian.nsh"
254 !insertmacro LANGFILE_INCLUDE "translations\spanish.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
272Section $(Section_SMPlayer) SecSMPlayer
273
274 SectionIn RO
275
276 ${If} $Reinstall_Uninstall == 1
277
278 ReadRegStr $R0 HKLM ${SMPLAYER_REG_KEY} "Path"
279
280 ${If} $Reinstall_UninstallButton_State == 1
281 Exec '"$R0\uninst.exe" /X'
282 Quit
283 ${ElseIf} $Reinstall_OverwriteButton_State == 1
284 ${If} "$INSTDIR" == "$R0"
285 ExecWait '"$R0\uninst.exe" /S /R _?=$R0'
286 ${Else}
287 ExecWait '"$R0\uninst.exe" /S /R'
288 ${EndIf}
289 ${EndIf}
290
291 ${EndIf}
292
293 SetOutPath "$INSTDIR"
294 File "smplayer-build\*"
295
296 ;SMPlayer docs
297 SetOutPath "$INSTDIR\docs"
298 File /r "smplayer-build\docs\*.*"
299
300 ;Qt imageformats
301 SetOutPath "$INSTDIR\imageformats"
302 File /r "smplayer-build\imageformats\*.*"
303
304 ;SMPlayer key shortcuts
305 SetOutPath "$INSTDIR\shortcuts"
306 File /r "smplayer-build\shortcuts\*.*"
307
308 SetOutPath "$PLUGINSDIR"
309 File 7za.exe
310
311 ;Initialize to 0 if don't exist (based on error flag)
312 ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer
313 ${If} ${Errors}
314 WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x0
315 ${EndIf}
316
317 ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs
318 ${If} ${Errors}
319 WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
320 ${EndIf}
321
322SectionEnd
323
324;--------------------------------
325;Shortcuts
326SectionGroup $(ShortcutGroupTitle)
327
328 ${MementoSection} $(Section_DesktopShortcut) SecDesktopShortcut
329
330 SetOutPath "$INSTDIR"
331 CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
332
333 ${MementoSectionEnd}
334
335 ${MementoSection} $(Section_StartMenu) SecStartMenuShortcut
336
337 SetOutPath "$INSTDIR"
338 !insertmacro MUI_STARTMENU_WRITE_BEGIN SMP_SMenu
339 CreateDirectory "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
340 CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
341 WriteINIStr "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url" "InternetShortcut" "URL" "http://smplayer.sf.net"
342 CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
343 !insertmacro MUI_STARTMENU_WRITE_END
344
345 ${MementoSectionEnd}
346
347SectionGroupEnd
348
349;--------------------------------
350;MPlayer & MPlayer Codecs
351SectionGroup $(MPlayerGroupTitle)
352
353 Section $(Section_MPlayer) SecMPlayer
354
355 SectionIn RO
356
357!ifdef WITH_MPLAYER
358 SetOutPath "$INSTDIR\mplayer"
359 File /r "smplayer-build\mplayer\*.*"
360
361 WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
362!else ifndef WITH_MPLAYER
363 AddSize 16800
364
365 Call GetVerInfo
366
367 /* Read from version-info
368 If it was unable to download, set version to that defined in the
369 beginning of the script. */
370 ${If} ${FileExists} "$PLUGINSDIR\version-info"
371 ReadINIStr $MPlayer_Version "$PLUGINSDIR\version-info" smplayer mplayer
372 ${Else}
373 StrCpy $MPlayer_Version ${DEFAULT_MPLAYER_VERSION}
374 ${EndIf}
375
376 retry_mplayer:
377
378 DetailPrint $(MPlayer_DL_Msg)
379 inetc::get /timeout 30000 /resume "" /silent "http://downloads.sourceforge.net/smplayer/$MPlayer_Version.7z?big_mirror=0" \
380 "$PLUGINSDIR\$MPlayer_Version.7z" /end
381 Pop $R0
382 StrCmp $R0 OK 0 check_mplayer
383
384 DetailPrint $(Info_Files_Extract)
385 nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\$MPlayer_Version.7z" -y -o"$PLUGINSDIR"'
386
387 CreateDirectory "$INSTDIR\mplayer"
388 CopyFiles /SILENT "$PLUGINSDIR\$MPlayer_Version\*" "$INSTDIR\mplayer"
389
390 check_mplayer:
391
392 ${If} $R0 != "OK"
393 DetailPrint $(MPlayer_DL_Failed)
394 ${EndIf}
395
396 IfFileExists "$INSTDIR\mplayer\mplayer.exe" mplayerInstSuccess mplayerInstFailed
397 mplayerInstSuccess:
398 WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
399 Goto done
400 mplayerInstFailed:
401 MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(MPlayer_DL_Retry) /SD IDCANCEL IDRETRY retry_mplayer
402 Abort $(MPlayer_Inst_Failed)
403
404 done:
405!endif
406 SectionEnd
407
408 Section /o $(Section_MPlayerCodecs) SecCodecs
409
410 AddSize 22300
411
412 Call GetVerInfo
413
414 /* Read from version-info
415 If it was unable to download, set version to that defined in the
416 beginning of the script. */
417 ${If} ${FileExists} "$PLUGINSDIR\version-info"
418 ReadINIStr $Codec_Version "$PLUGINSDIR\version-info" smplayer mplayercodecs
419 ${Else}
420 StrCpy $Codec_Version ${DEFAULT_CODECS_VERSION}
421 ${EndIf}
422
423 retry_codecs:
424
425 DetailPrint $(Codecs_DL_Msg)
426 inetc::get /timeout 30000 /resume "" /silent "http://www.mplayerhq.hu/MPlayer/releases/codecs/$Codec_Version.zip" \
427 "$PLUGINSDIR\$Codec_Version.zip" /end
428 Pop $R0
429 StrCmp $R0 OK 0 check_codecs
430
431 DetailPrint $(Info_Files_Extract)
432 nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\$Codec_Version.zip" -y -o"$PLUGINSDIR"'
433
434 CreateDirectory "$INSTDIR\mplayer\codecs"
435 CopyFiles /SILENT "$PLUGINSDIR\$Codec_Version\*" "$INSTDIR\mplayer\codecs"
436
437 check_codecs:
438
439 ${If} $R0 != "OK"
440 DetailPrint $(Codecs_DL_Failed)
441 ${EndIf}
442
443 IfFileExists "$INSTDIR\mplayer\codecs\*.dll" codecsInstSuccess codecsInstFailed
444 codecsInstSuccess:
445 WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x1
446 Goto done
447 codecsInstFailed:
448 MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(Codecs_DL_Retry) /SD IDCANCEL IDRETRY retry_codecs
449 DetailPrint $(Codecs_Inst_Failed)
450 WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
451 Sleep 5000
452
453 done:
454
455 SectionEnd
456
457SectionGroupEnd
458
459;--------------------------------
460;Icon themes
461${MementoSection} $(Section_IconThemes) SecThemes
462
463 SetOutPath "$INSTDIR\themes"
464 File /r "smplayer-build\themes\*.*"
465
466${MementoSectionEnd}
467
468;--------------------------------
469;Translations
470SectionGroup $(Section_Translations) SecTranslations
471
472 Section "English" SecLang_ENUS
473 SectionIn RO
474
475 SetOutPath "$INSTDIR\translations"
476 File /r "smplayer-build\translations\smplayer_en_US.qm"
477 SectionEnd
478
479 ${MementoSection} "العربية" SecLang_ARSY
480 SetOutPath "$INSTDIR\translations"
481 File /r "smplayer-build\translations\smplayer_ar_SY.qm"
482 ${MementoSectionEnd}
483
484 ${MementoSection} "български" SecLang_BG
485 SetOutPath "$INSTDIR\translations"
486 File /r "smplayer-build\translations\smplayer_bg.qm"
487 ${MementoSectionEnd}
488
489 ${MementoSection} "Català" SecLang_CA
490 SetOutPath "$INSTDIR\translations"
491 File /r "smplayer-build\translations\smplayer_ca.qm"
492 ${MementoSectionEnd}
493
494 ${MementoSection} "Čeština" SecLang_CS
495 SetOutPath "$INSTDIR\translations"
496 File /r "smplayer-build\translations\smplayer_cs.qm"
497 ${MementoSectionEnd}
498
499 ${MementoSection} "Dansk" SecLang_DA
500 SetOutPath "$INSTDIR\translations"
501 File /r "smplayer-build\translations\smplayer_da.qm"
502 ${MementoSectionEnd}
503
504 ${MementoSection} "Deutsch" SecLang_DE
505 SetOutPath "$INSTDIR\translations"
506 File /r "smplayer-build\translations\smplayer_de.qm"
507 ${MementoSectionEnd}
508
509 ${MementoSection} "Ελληνικά" SecLang_ELGR
510 SetOutPath "$INSTDIR\translations"
511 File /r "smplayer-build\translations\smplayer_el_GR.qm"
512 ${MementoSectionEnd}
513
514 ${MementoSection} "Español" SecLang_ES
515 SetOutPath "$INSTDIR\translations"
516 File /r "smplayer-build\translations\smplayer_es.qm"
517 ${MementoSectionEnd}
518
519 ${MementoSection} "Eesti Keel" SecLang_ET
520 SetOutPath "$INSTDIR\translations"
521 File /r "smplayer-build\translations\smplayer_et.qm"
522 ${MementoSectionEnd}
523
524 ${MementoSection} "Euskara" SecLang_EU
525 SetOutPath "$INSTDIR\translations"
526 File /r "smplayer-build\translations\smplayer_eu.qm"
527 ${MementoSectionEnd}
528
529 ${MementoSection} "Suomi" SecLang_FI
530 SetOutPath "$INSTDIR\translations"
531 File /r "smplayer-build\translations\smplayer_fi.qm"
532 ${MementoSectionEnd}
533
534 ${MementoSection} "Français" SecLang_FR
535 SetOutPath "$INSTDIR\translations"
536 File /r "smplayer-build\translations\smplayer_fr.qm"
537 ${MementoSectionEnd}
538
539 ${MementoSection} "Galego" SecLang_GL
540 SetOutPath "$INSTDIR\translations"
541 File /r "smplayer-build\translations\smplayer_gl.qm"
542 ${MementoSectionEnd}
543
544 ${MementoSection} "Magyar" SecLang_HU
545 SetOutPath "$INSTDIR\translations"
546 File /r "smplayer-build\translations\smplayer_hu.qm"
547 ${MementoSectionEnd}
548
549 ${MementoSection} "Italiano" SecLang_IT
550 SetOutPath "$INSTDIR\translations"
551 File /r "smplayer-build\translations\smplayer_it.qm"
552 ${MementoSectionEnd}
553
554 ${MementoSection} "日本語" SecLang_JA
555 SetOutPath "$INSTDIR\translations"
556 File /r "smplayer-build\translations\smplayer_ja.qm"
557 ${MementoSectionEnd}
558
559 ${MementoSection} "ქართული" SecLang_KA
560 SetOutPath "$INSTDIR\translations"
561 File /r "smplayer-build\translations\smplayer_ka.qm"
562 ${MementoSectionEnd}
563
564 ${MementoSection} "한국어" SecLang_KO
565 SetOutPath "$INSTDIR\translations"
566 File /r "smplayer-build\translations\smplayer_ko.qm"
567 ${MementoSectionEnd}
568
569 ${MementoSection} "كوردی" SecLang_KU
570 SetOutPath "$INSTDIR\translations"
571 File /r "smplayer-build\translations\smplayer_ku.qm"
572 ${MementoSectionEnd}
573
574 ${MementoSection} "Lietuvių" SecLang_LT
575 SetOutPath "$INSTDIR\translations"
576 File /r "smplayer-build\translations\smplayer_lt.qm"
577 ${MementoSectionEnd}
578
579 ${MementoSection} "Mакедонски" SecLang_MK
580 SetOutPath "$INSTDIR\translations"
581 File /r "smplayer-build\translations\smplayer_mk.qm"
582 ${MementoSectionEnd}
583
584 ${MementoSection} "Nederlands" SecLang_NL
585 SetOutPath "$INSTDIR\translations"
586 File /r "smplayer-build\translations\smplayer_nl.qm"
587 ${MementoSectionEnd}
588
589 ${MementoSection} "Polski" SecLang_PL
590 SetOutPath "$INSTDIR\translations"
591 File /r "smplayer-build\translations\smplayer_pl.qm"
592 ${MementoSectionEnd}
593
594 ${MementoSection} "Português" SecLang_PT
595 SetOutPath "$INSTDIR\translations"
596 File /r "smplayer-build\translations\smplayer_pt.qm"
597 ${MementoSectionEnd}
598
599 ${MementoSection} "Português (Brasil)" SecLang_PTBR
600 SetOutPath "$INSTDIR\translations"
601 File /r "smplayer-build\translations\smplayer_pt_BR.qm"
602 ${MementoSectionEnd}
603
604 ${MementoSection} "Română" SecLang_roRO
605 SetOutPath "$INSTDIR\translations"
606 File /r "smplayer-build\translations\smplayer_ro_RO.qm"
607 ${MementoSectionEnd}
608
609 ${MementoSection} "Pусский" SecLang_ruRU
610 SetOutPath "$INSTDIR\translations"
611 File /r "smplayer-build\translations\smplayer_ru_RU.qm"
612 ${MementoSectionEnd}
613
614 ${MementoSection} "Slovenčina" SecLang_SK
615 SetOutPath "$INSTDIR\translations"
616 File /r "smplayer-build\translations\smplayer_sk.qm"
617 ${MementoSectionEnd}
618
619 ${MementoSection} "Slovenščina" SecLang_SLSI
620 SetOutPath "$INSTDIR\translations"
621 File /r "smplayer-build\translations\smplayer_sl_SI.qm"
622 ${MementoSectionEnd}
623
624 ${MementoSection} "Cрпски" SecLang_SR
625 SetOutPath "$INSTDIR\translations"
626 File /r "smplayer-build\translations\smplayer_sr.qm"
627 ${MementoSectionEnd}
628
629 ${MementoSection} "Svenska" SecLang_SV
630 SetOutPath "$INSTDIR\translations"
631 File /r "smplayer-build\translations\smplayer_sv.qm"
632 ${MementoSectionEnd}
633
634 ${MementoSection} "Türkçe" SecLang_TR
635 SetOutPath "$INSTDIR\translations"
636 File /r "smplayer-build\translations\smplayer_tr.qm"
637 ${MementoSectionEnd}
638
639 ${MementoSection} "Yкраїнська" SecLang_UKUA
640 SetOutPath "$INSTDIR\translations"
641 File /r "smplayer-build\translations\smplayer_uk_UA.qm"
642 ${MementoSectionEnd}
643
644 ${MementoSection} "Tiếng Việt" SecLang_VIVN
645 SetOutPath "$INSTDIR\translations"
646 File /r "smplayer-build\translations\smplayer_vi_VN.qm"
647 ${MementoSectionEnd}
648
649 ${MementoSection} "简化字" SecLang_ZHCN
650 SetOutPath "$INSTDIR\translations"
651 File /r "smplayer-build\translations\smplayer_zh_CN.qm"
652 ${MementoSectionEnd}
653
654 ${MementoSection} "漢語(繁體)" SecLang_ZHTW
655 SetOutPath "$INSTDIR\translations"
656 File /r "smplayer-build\translations\smplayer_zh_TW.qm"
657 ${MementoSectionEnd}
658
659SectionGroupEnd
660
661;--------------------------------
662;Install/Uninstall information
663Section -Post
664
665 ;Uninstall file
666 WriteUninstaller "$INSTDIR\${SMPLAYER_UNINST_EXE}"
667
668 ;Store installed path & version
669 WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Path" "$INSTDIR"
670 WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Version" "${SMPLAYER_VERSION}"
671
672 ;Allows user to use 'start smplayer.exe'
673 WriteRegStr HKLM "${SMPLAYER_APP_PATHS_KEY}" "" "$INSTDIR\smplayer.exe"
674
675 ;Default Programs Registration (Vista & later)
676 ${If} ${AtLeastWinVista}
677 Call RegisterDefaultPrograms
678 ${EndIf}
679
680 ;Registry Uninstall information
681 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayName" "$(^Name)"
682 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayIcon" "$INSTDIR\smplayer.exe"
683 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayVersion" "${SMPLAYER_VERSION}"
684 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "HelpLink" "http://smplayer.berlios.de/forum"
685 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "Publisher" "Ricardo Villalba"
686 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
687 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLInfoAbout" "http://smplayer.sf.net"
688 WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLUpdateInfo" "http://smplayer.sf.net"
689 WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoModify" "1"
690 WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoRepair" "1"
691
692SectionEnd
693
694${MementoSectionDone}
695
696;--------------------------------
697;Section descriptions
698!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
699 !insertmacro MUI_DESCRIPTION_TEXT ${SecSMPlayer} $(Section_SMPlayer_Desc)
700 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} $(Section_DesktopShortcut_Desc)
701 !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} $(Section_StartMenu_Desc)
702 !insertmacro MUI_DESCRIPTION_TEXT ${SecMPlayer} $(Section_MPlayer_Desc)
703 !insertmacro MUI_DESCRIPTION_TEXT ${SecCodecs} $(Section_MPlayerCodecs_Desc)
704 !insertmacro MUI_DESCRIPTION_TEXT ${SecThemes} $(Section_IconThemes_Desc)
705 !insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} $(Section_Translations_Desc)
706!insertmacro MUI_FUNCTION_DESCRIPTION_END
707
708;--------------------------------
709;Macros
710
711!macro MacroAllExtensions _action
712 !insertmacro ${_action} ".3gp"
713 !insertmacro ${_action} ".ac3"
714 !insertmacro ${_action} ".ape"
715 !insertmacro ${_action} ".asf"
716 !insertmacro ${_action} ".avi"
717 !insertmacro ${_action} ".bin"
718 !insertmacro ${_action} ".dat"
719 !insertmacro ${_action} ".divx"
720 !insertmacro ${_action} ".dv"
721 !insertmacro ${_action} ".dvr-ms"
722 !insertmacro ${_action} ".f4v"
723 !insertmacro ${_action} ".flac"
724 !insertmacro ${_action} ".flv"
725 !insertmacro ${_action} ".hdmov"
726 !insertmacro ${_action} ".iso"
727 !insertmacro ${_action} ".m1v"
728 !insertmacro ${_action} ".m2t"
729 !insertmacro ${_action} ".m2ts"
730 !insertmacro ${_action} ".m2v"
731 !insertmacro ${_action} ".m3u"
732 !insertmacro ${_action} ".m3u8"
733 !insertmacro ${_action} ".m4v"
734 !insertmacro ${_action} ".mkv"
735 !insertmacro ${_action} ".mov"
736 !insertmacro ${_action} ".mp3"
737 !insertmacro ${_action} ".mp4"
738 !insertmacro ${_action} ".mpeg"
739 !insertmacro ${_action} ".mpg"
740 !insertmacro ${_action} ".mpv"
741 !insertmacro ${_action} ".mqv"
742 !insertmacro ${_action} ".nsv"
743 !insertmacro ${_action} ".ogg"
744 !insertmacro ${_action} ".ogm"
745 !insertmacro ${_action} ".ogv"
746 !insertmacro ${_action} ".pls"
747 !insertmacro ${_action} ".ra"
748 !insertmacro ${_action} ".ram"
749 !insertmacro ${_action} ".rec"
750 !insertmacro ${_action} ".rm"
751 !insertmacro ${_action} ".rmvb"
752 !insertmacro ${_action} ".swf"
753 !insertmacro ${_action} ".thd"
754 !insertmacro ${_action} ".ts"
755 !insertmacro ${_action} ".vcd"
756 !insertmacro ${_action} ".vfw"
757 !insertmacro ${_action} ".vob"
758 !insertmacro ${_action} ".vp8"
759 !insertmacro ${_action} ".wav"
760 !insertmacro ${_action} ".webm"
761 !insertmacro ${_action} ".wma"
762 !insertmacro ${_action} ".wmv"
763!macroend
764
765!macro WriteRegStrSupportedTypes EXT
766 WriteRegStr HKLM "${SMPLAYER_REG_KEY}\Capabilities\FileAssociations" ${EXT} "MPlayerFileVideo"
767!macroend
768
769!macro MacroRemoveSMPlayer
770 ;Delete desktop and start menu shortcuts
771 SetDetailsPrint textonly
772 DetailPrint $(Info_Del_Shortcuts)
773 SetDetailsPrint listonly
774
775 SetShellVarContext all
776 Delete "$DESKTOP\SMPlayer.lnk"
777 Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk"
778 Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url"
779 Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk"
780 RMDir "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
781
782 ;Delete directories recursively except for main directory
783 ;Do not recursively delete $INSTDIR
784 SetDetailsPrint textonly
785 DetailPrint $(Info_Del_Files)
786 SetDetailsPrint listonly
787
788 RMDir /r "$INSTDIR\docs"
789 RMDir /r "$INSTDIR\imageformats"
790 RMDir /r "$INSTDIR\mplayer"
791 RMDir /r "$INSTDIR\shortcuts"
792 RMDir /r "$INSTDIR\themes"
793 RMDir /r "$INSTDIR\translations"
794 Delete "$INSTDIR\*.txt"
795 Delete "$INSTDIR\libgcc_s_dw2-1.dll"
796 Delete "$INSTDIR\mingwm10.dll"
797 Delete "$INSTDIR\Q*.dll"
798 Delete "$INSTDIR\smplayer.exe"
799 Delete "$INSTDIR\dxlist.exe"
800
801 ;Delete registry keys
802 SetDetailsPrint textonly
803 DetailPrint $(Info_Del_Registry)
804 SetDetailsPrint listonly
805
806 DeleteRegKey HKLM "${SMPLAYER_REG_KEY}"
807 DeleteRegKey HKLM "${SMPLAYER_APP_PATHS_KEY}"
808 DeleteRegKey HKLM "${SMPLAYER_UNINST_KEY}"
809 DeleteRegKey HKCR "MPlayerFileVideo"
810 DeleteRegValue HKLM "Software\RegisteredApplications" "SMPlayer"
811
812 SetDetailsPrint both
813!macroend
814
815;--------------------------------
816;Installer functions
817
818Function .onInit
819
820 !ifdef PRE_RELEASE
821 MessageBox MB_OK|MB_ICONINFORMATION "This is a pre-release version of SMPlayer. Please report all issues."
822 !endif
823
824 ;Check if setup is already running
825 System::Call 'kernel32::CreateMutexW(i 0, i 0, t "SMPlayerSetup") i .r1 ?e'
826 Pop $R0
827
828 StrCmp $R0 0 +3
829 MessageBox MB_OK|MB_ICONEXCLAMATION $(Installer_Is_Running)
830 Abort
831
832 ;Check for admin on older OSes
833 Call CheckUserRights
834
835 ${If} $Is_Admin == 0
836 MessageBox MB_OK|MB_ICONSTOP $(Installer_No_Admin)
837 Abort
838 ${EndIf}
839
840 Call LoadPreviousSettings
841
842 ;Setup language selection
843 !insertmacro MUI_LANGDLL_DISPLAY
844
845 Call CheckPreviousVersion
846
847 SetShellVarContext all
848
849FunctionEnd
850
851Function .onInstSuccess
852
853 ${MementoSectionSave}
854
855FunctionEnd
856
857Function .onInstFailed
858
859 SetDetailsPrint textonly
860 DetailPrint "Rolling back changes..."
861 SetDetailsPrint listonly
862
863 !insertmacro MacroRemoveSMPlayer
864
865 Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
866 RMDir "$INSTDIR"
867
868FunctionEnd
869
870Function CheckPreviousVersion
871
872 ReadRegStr $Previous_Version HKLM "${SMPLAYER_REG_KEY}" "Version"
873 ReadRegStr $SMPlayer_Path HKLM "${SMPLAYER_REG_KEY}" "Path"
874
875 /* $Previous_Version_State Assignments:
876 $Previous_Version_State=0 This installer is the same version as the installed copy
877 $Previous_Version_State=1 A newer version than this installer is already installed
878 $Previous_Version_State=2 An older version than this installer is already installed */
879 ${VersionCompare} $Previous_Version ${SMPLAYER_VERSION} $Previous_Version_State
880
881 ${If} $Previous_Version_State == 0
882 StrCpy $Inst_Type $(Type_Reinstall)
883 ${ElseIf} $Previous_Version_State == 1
884 StrCpy $Inst_Type $(Type_Downgrade)
885 ${ElseIf} $Previous_Version_State == 2
886 StrCpy $Inst_Type $(Type_Upgrade)
887 ${EndIf}
888
889FunctionEnd
890
891Function CheckUserRights
892
893 ClearErrors
894 UserInfo::GetName
895 ${If} ${Errors}
896 StrCpy $Is_Admin 1
897 Return
898 ${EndIf}
899
900 Pop $UserName
901 UserInfo::GetAccountType
902 Pop $R0
903 ${Switch} $R0
904 ${Case} "Admin"
905 ${Case} "Power"
906 StrCpy $Is_Admin 1
907 ${Break}
908 ${Default}
909 StrCpy $Is_Admin 0
910 ${Break}
911 ${EndSwitch}
912
913FunctionEnd
914
915Function GetVerInfo
916
917 IfFileExists "$PLUGINSDIR\version-info" end_dl_ver_info 0
918 DetailPrint $(VerInfo_DL_Msg)
919 inetc::get /timeout 30000 /resume "" /silent ${VERSION_FILE_URL} "$PLUGINSDIR\version-info" /end
920 Pop $R0
921 StrCmp $R0 OK +2
922 DetailPrint $(VerInfo_DL_Failed)
923
924 end_dl_ver_info:
925
926FunctionEnd
927
928Function LoadPreviousSettings
929
930 ;MPlayer codecs section doesn't use Memento so we need to restore it manually
931 ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" "Installed_Codecs"
932 ${If} $R0 == 1
933 !insertmacro SelectSection ${SecCodecs}
934 ${EndIf}
935
936 ;Gets start menu folder name
937 !insertmacro MUI_STARTMENU_GETFOLDER "SMP_SMenu" $SMPlayer_StartMenuFolder
938
939 ${MementoSectionRestore}
940
941FunctionEnd
942
943Function PageReinstall
944
945 ${If} $Previous_Version == ""
946 ${OrIf} $SMPlayer_Path == ""
947 Abort
948 ${EndIf}
949
950 nsDialogs::Create /NOUNLOAD 1018
951 Pop $Dialog_Reinstall
952
953 nsDialogs::SetRTL $(^RTL)
954
955 !insertmacro MUI_HEADER_TEXT $(Reinstall_Header_Text) $(Reinstall_Header_SubText)
956
957 ${NSD_CreateLabel} 0 0 225u 8u $(Reinstall_Msg1)
958
959 ${NSD_CreateText} 10u 15u 290u 14u "$SMPlayer_Path"
960 Pop $R0
961
962 ${NSD_CreateLabel} 0 40u 100u 8u $(Reinstall_Msg2)
963
964 ${NSD_CreateRadioButton} 10u 58u 200u 8u $(Reinstall_Overwrite)
965 Pop $Reinstall_OverwriteButton
966 ${NSD_CreateRadioButton} 10u 73u 200u 8u $(Reinstall_Uninstall)
967 Pop $Reinstall_UninstallButton
968
969 ${NSD_CreateCheckBox} 0 90u 100% 8u $(Reinstall_Msg4)
970 Pop $Reinstall_ChgSettings
971
972 ${NSD_CreateLabel} 0 115u 100% 16u
973 Pop $Reinstall_Message
974
975 SendMessage $Reinstall_OverwriteButton ${BM_SETCHECK} 1 0
976 EnableWindow $R0 0
977
978 ${If} $Reinstall_ChgSettings_State == 1
979 SendMessage $Reinstall_ChgSettings ${BM_SETCHECK} 1 0
980 ${Endif}
981
982 ${NSD_OnClick} $Reinstall_OverwriteButton PageReinstallUpdate
983 ${NSD_OnClick} $Reinstall_UninstallButton PageReinstallUpdate
984 ${NSD_OnClick} $Reinstall_ChgSettings PageReinstallUpdate
985
986 Call PageReinstallUpdate
987
988 StrCpy $Reinstall_Uninstall 1
989
990 nsDialogs::Show
991
992FunctionEnd
993
994Function PageReinstallLeave
995
996 ${NSD_GetState} $Reinstall_OverwriteButton $Reinstall_OverwriteButton_State
997 ${NSD_GetState} $Reinstall_UninstallButton $Reinstall_UninstallButton_State
998 ${NSD_GetState} $Reinstall_ChgSettings $Reinstall_ChgSettings_State
999
1000FunctionEnd
1001
1002Function PageReinstallUpdate
1003
1004 ${NSD_GetState} $Reinstall_OverwriteButton $Reinstall_OverwriteButton_State
1005 ${NSD_GetState} $Reinstall_UninstallButton $Reinstall_UninstallButton_State
1006 ${NSD_GetState} $Reinstall_ChgSettings $Reinstall_ChgSettings_State
1007
1008 ${If} $Reinstall_OverwriteButton_State == 1
1009
1010 EnableWindow $Reinstall_ChgSettings 1
1011
1012 GetDlgItem $R0 $HWNDPARENT 1
1013 ${If} $Reinstall_ChgSettings_State != 1
1014 SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(StartBtn)"
1015 ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_1)
1016 ${ElseIf} $Reinstall_ChgSettings_State == 1
1017 SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(^NextBtn)"
1018 ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_2)
1019 ${EndIf}
1020
1021 ${ElseIf} $Reinstall_UninstallButton_State == 1
1022
1023 EnableWindow $Reinstall_ChgSettings 0
1024 ${NSD_SetState} $Reinstall_ChgSettings 0
1025
1026 GetDlgItem $R0 $HWNDPARENT 1
1027 SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(^UninstallBtn)"
1028
1029 ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_3)
1030
1031 ${EndIf}
1032
1033FunctionEnd
1034
1035Function PageComponentsPre
1036
1037 ${If} $Reinstall_Uninstall == 1
1038 ${AndIf} $Reinstall_ChgSettings_State != 1
1039 Abort
1040 ${EndIf}
1041
1042FunctionEnd
1043
1044Function PageDirectoryPre
1045
1046 ${If} $Reinstall_Uninstall == 1
1047 ${AndIf} $Reinstall_ChgSettings_State != 1
1048 Abort
1049 ${EndIf}
1050
1051FunctionEnd
1052
1053Function PageStartMenuPre
1054
1055 ${If} $Reinstall_Uninstall == 1
1056 ${AndIf} $Reinstall_ChgSettings_State != 1
1057 Abort
1058 ${EndIf}
1059
1060 ${IfNot} ${SectionIsSelected} ${SecStartMenuShortcut}
1061 Abort
1062 ${EndIf}
1063
1064FunctionEnd
1065
1066Function RegisterDefaultPrograms
1067
1068 WriteRegStr HKCR "MPlayerFileVideo\DefaultIcon" "" '"$INSTDIR\smplayer.exe",1'
1069 WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue" "" "Enqueue in SMPlayer"
1070 WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue\command" "" '"$INSTDIR\smplayer.exe" -add-to-playlist "%1"'
1071 WriteRegStr HKCR "MPlayerFileVideo\shell\open" "FriendlyAppName" "SMPlayer Media Player"
1072 WriteRegStr HKCR "MPlayerFileVideo\shell\open\command" "" '"$INSTDIR\smplayer.exe" "%1"'
1073
1074 ;Modify the list of extensions added in the MacroAllExtensions macro
1075 WriteRegStr HKLM "${SMPLAYER_REG_KEY}\Capabilities" "ApplicationDescription" $(Application_Description)
1076 WriteRegStr HKLM "${SMPLAYER_REG_KEY}\Capabilities" "ApplicationName" "SMPlayer"
1077 WriteRegStr HKLM "Software\RegisteredApplications" "SMPlayer" "${SMPLAYER_REG_KEY}\Capabilities"
1078 !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
1079
1080FunctionEnd
1081
1082/*************************************** Uninstaller *******************************************/
1083
1084Section Uninstall
1085
1086 ;Make sure SMPlayer is installed from where the uninstaller is being executed.
1087 IfFileExists $INSTDIR\smplayer.exe smplayer_installed
1088 MessageBox MB_YESNO $(Uninstaller_NotInstalled) /SD IDNO IDYES smplayer_installed
1089 Abort $(Uninstaller_Aborted)
1090
1091 smplayer_installed:
1092
1093 SetDetailsPrint textonly
1094 DetailPrint $(Info_Rest_Assoc)
1095 SetDetailsPrint listonly
1096
1097 ;Don't restore file associations if reinstalling
1098 ${un.GetParameters} $R0
1099 ${un.GetOptionsS} $R0 "/R" $R1
1100
1101 IfErrors 0 +2
1102 ExecWait '"$INSTDIR\smplayer.exe" -uninstall'
1103
1104 !insertmacro MacroRemoveSMPlayer
1105
1106 Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
1107 RMDir "$INSTDIR"
1108
1109SectionEnd
1110
1111;--------------------------------
1112;Required functions
1113
1114!insertmacro un.GetParameters
1115!insertmacro un.GetOptions
1116
1117;--------------------------------
1118;Uninstaller functions
1119
1120Function un.onInit
1121
1122 ;Check for admin (mimic old Inno Setup behavior)
1123 Call un.CheckUserRights
1124
1125 ${If} $Is_Admin == 0
1126 MessageBox MB_OK|MB_ICONSTOP $(Uninstaller_No_Admin)
1127 Abort
1128 ${EndIf}
1129
1130 ;Gets start menu folder name
1131 !insertmacro MUI_STARTMENU_GETFOLDER "SMP_SMenu" $SMPlayer_StartMenuFolder
1132
1133 ;Get the stored language preference
1134 !insertmacro MUI_UNGETLANGUAGE
1135
1136FunctionEnd
1137
1138Function un.CheckUserRights
1139
1140 ClearErrors
1141 UserInfo::GetName
1142 ${If} ${Errors}
1143 StrCpy $Is_Admin 1
1144 Return
1145 ${EndIf}
1146
1147 Pop $UserName
1148 UserInfo::GetAccountType
1149 Pop $R0
1150 ${Switch} $R0
1151 ${Case} "Admin"
1152 ${Case} "Power"
1153 StrCpy $Is_Admin 1
1154 ${Break}
1155 ${Default}
1156 StrCpy $Is_Admin 0
1157 ${Break}
1158 ${EndSwitch}
1159
1160FunctionEnd
1161
1162Function un.ConfirmPagePre
1163
1164 ${un.GetParameters} $R0
1165
1166 ${un.GetOptionsS} $R0 "/X" $R1
1167 ${Unless} ${Errors}
1168 Abort
1169 ${EndUnless}
1170
1171FunctionEnd
1172
1173Function un.FinishPagePre
1174
1175 ${un.GetParameters} $R0
1176
1177 ${un.GetOptionsS} $R0 "/X" $R1
1178 ${Unless} ${Errors}
1179 Abort
1180 ${EndUnless}
1181
1182FunctionEnd
Note: See TracBrowser for help on using the repository browser.