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