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

Last change on this file since 178 was 176, checked in by Silvan Scherrer, 9 years ago

smplayer: update trunk to version 16.4

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