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

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

smplayer: update trunk to version 16.8.0

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