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

Last change on this file since 188 was 188, checked in by Silvan Scherrer, 8 years ago

SMPlayer: update trunk to version 17.1.0

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