1 | ; Installer script for win32 SMPlayer
|
---|
2 | ; Written by redxii (redxii@users.sourceforge.net)
|
---|
3 |
|
---|
4 | ;--------------------------------
|
---|
5 | ;Compressor
|
---|
6 |
|
---|
7 | SetCompressor /SOLID lzma
|
---|
8 | SetCompressorDictSize 32
|
---|
9 |
|
---|
10 | ;--------------------------------
|
---|
11 | ;Additional plugin folders
|
---|
12 |
|
---|
13 | !addplugindir .
|
---|
14 |
|
---|
15 | ;--------------------------------
|
---|
16 | ;Defines
|
---|
17 |
|
---|
18 | !ifdef VER_REVISION
|
---|
19 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
---|
20 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
---|
21 | !else ifndef VER_REVISION
|
---|
22 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}"
|
---|
23 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.0"
|
---|
24 | !endif
|
---|
25 |
|
---|
26 | !define SMPLAYER_APP_PATHS_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\smplayer.exe"
|
---|
27 | !define SMPLAYER_DEFPROGRAMS_KEY "Software\Clients\Media\SMPlayer\Capabilities"
|
---|
28 | !define SMPLAYER_REG_KEY "Software\SMPlayer"
|
---|
29 |
|
---|
30 | !define SMPLAYER_UNINST_EXE "uninst.exe"
|
---|
31 | !define SMPLAYER_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SMPlayer"
|
---|
32 |
|
---|
33 | ;Fallback versions
|
---|
34 | ;These can be changed in the compiler, otherwise
|
---|
35 | ;if not defined the values shown here will be used.
|
---|
36 | !ifndef DEFAULT_CODECS_VERSION
|
---|
37 | !define DEFAULT_CODECS_VERSION "windows-essential-20071007"
|
---|
38 | !endif
|
---|
39 | !ifndef WITH_MPLAYER
|
---|
40 | !ifndef DEFAULT_MPLAYER_VERSION
|
---|
41 | !define DEFAULT_MPLAYER_VERSION "mplayer-svn-28311-2"
|
---|
42 | !endif
|
---|
43 | !endif
|
---|
44 |
|
---|
45 | ;--------------------------------
|
---|
46 | ;General
|
---|
47 |
|
---|
48 | ;Name and file
|
---|
49 | Name "SMPlayer ${SMPLAYER_VERSION}"
|
---|
50 | BrandingText "SMPlayer for Windows v${SMPLAYER_VERSION}"
|
---|
51 | !ifdef WITH_MPLAYER
|
---|
52 | OutFile "smplayer-${SMPLAYER_VERSION}-win32.exe"
|
---|
53 | !else ifndef WITH_MPLAYER
|
---|
54 | OutFile "smplayer-${SMPLAYER_VERSION}-win32-webdl.exe"
|
---|
55 | !endif
|
---|
56 |
|
---|
57 | ;Version tab properties
|
---|
58 | VIProductVersion "${SMPLAYER_PRODUCT_VERSION}"
|
---|
59 | VIAddVersionKey "ProductName" "SMPlayer"
|
---|
60 | VIAddVersionKey "ProductVersion" "${SMPLAYER_VERSION}"
|
---|
61 | VIAddVersionKey "FileVersion" "${SMPLAYER_VERSION}"
|
---|
62 | VIAddVersionKey "LegalCopyright" ""
|
---|
63 | !ifdef WITH_MPLAYER
|
---|
64 | VIAddVersionKey "FileDescription" "SMPlayer Installer (w/ MPlayer)"
|
---|
65 | !else ifndef WITH_MPLAYER
|
---|
66 | VIAddVersionKey "FileDescription" "SMPlayer Installer (MPlayer Web Downloader)"
|
---|
67 | !endif
|
---|
68 |
|
---|
69 | ;Default installation folder
|
---|
70 | InstallDir "$PROGRAMFILES\SMPlayer"
|
---|
71 |
|
---|
72 | ;Get installation folder from registry if available
|
---|
73 | InstallDirRegKey HKLM "${SMPLAYER_REG_KEY}" "Path"
|
---|
74 |
|
---|
75 | ;Vista+ XML manifest, does not affect older OSes
|
---|
76 | RequestExecutionLevel admin
|
---|
77 |
|
---|
78 | ShowInstDetails show
|
---|
79 | ShowUnInstDetails show
|
---|
80 |
|
---|
81 | ;--------------------------------
|
---|
82 | ;Variables
|
---|
83 |
|
---|
84 | Var CODEC_VERSION
|
---|
85 | Var IS_ADMIN
|
---|
86 | !ifndef WITH_MPLAYER
|
---|
87 | Var MPLAYER_VERSION
|
---|
88 | !endif
|
---|
89 | Var PREVIOUS_VERSION
|
---|
90 | Var PREVIOUS_VERSION_STATE
|
---|
91 | Var REINSTALL_UNINSTALL
|
---|
92 | Var REINSTALL_UNINSTALLBUTTON
|
---|
93 | Var USERNAME
|
---|
94 |
|
---|
95 | ;--------------------------------
|
---|
96 | ;Interface Settings
|
---|
97 |
|
---|
98 | ; License page
|
---|
99 | !define MUI_LICENSEPAGE_RADIOBUTTONS
|
---|
100 |
|
---|
101 | ; Components page
|
---|
102 | !define MUI_COMPONENTSPAGE_SMALLDESC
|
---|
103 |
|
---|
104 | ; Finish page
|
---|
105 | !define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
---|
106 | !define MUI_FINISHPAGE_RUN $INSTDIR\smplayer.exe
|
---|
107 | !define MUI_FINISHPAGE_RUN_NOTCHECKED
|
---|
108 | ;!define MUI_FINISHPAGE_RUN_PARAMETERS http://88.191.30.130:8050
|
---|
109 | !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Release_notes.txt
|
---|
110 | !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
---|
111 | !define MUI_FINISHPAGE_SHOWREADME_TEXT "View Release Notes"
|
---|
112 |
|
---|
113 | ; Misc
|
---|
114 | !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
|
---|
115 | !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
|
---|
116 | !define MUI_ABORTWARNING
|
---|
117 |
|
---|
118 | ;Installer/Uninstaller icons
|
---|
119 | !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
|
---|
120 | !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
|
---|
121 |
|
---|
122 | ;Language Selection Dialog Settings
|
---|
123 | !define MUI_LANGDLL_REGISTRY_ROOT HKLM
|
---|
124 | !define MUI_LANGDLL_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
|
---|
125 | !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
|
---|
126 |
|
---|
127 | ;Memento Settings
|
---|
128 | !define MEMENTO_REGISTRY_ROOT HKLM
|
---|
129 | !define MEMENTO_REGISTRY_KEY "${SMPLAYER_REG_KEY}"
|
---|
130 |
|
---|
131 | ;--------------------------------
|
---|
132 | ;Include Modern UI and functions
|
---|
133 |
|
---|
134 | !include MUI2.nsh
|
---|
135 | !include FileFunc.nsh
|
---|
136 | !include Memento.nsh
|
---|
137 | !include nsDialogs.nsh
|
---|
138 | !include Sections.nsh
|
---|
139 | !include WinVer.nsh
|
---|
140 | !include WordFunc.nsh
|
---|
141 |
|
---|
142 | ;--------------------------------
|
---|
143 | ;Pages
|
---|
144 |
|
---|
145 | ;Install pages
|
---|
146 | !insertmacro MUI_PAGE_WELCOME
|
---|
147 | !insertmacro MUI_PAGE_LICENSE "smplayer-build\Copying.txt"
|
---|
148 | Page custom PageReinstall PageLeaveReinstall
|
---|
149 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
|
---|
150 | !insertmacro MUI_PAGE_COMPONENTS
|
---|
151 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
|
---|
152 | !insertmacro MUI_PAGE_DIRECTORY
|
---|
153 | !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageInstfilesShow
|
---|
154 | !insertmacro MUI_PAGE_INSTFILES
|
---|
155 | !insertmacro MUI_PAGE_FINISH
|
---|
156 |
|
---|
157 | ;Uninstall pages
|
---|
158 | !define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
|
---|
159 | !insertmacro MUI_UNPAGE_CONFIRM
|
---|
160 | !insertmacro MUI_UNPAGE_INSTFILES
|
---|
161 | !define MUI_PAGE_CUSTOMFUNCTION_PRE un.FinishPagePre
|
---|
162 | !insertmacro MUI_UNPAGE_FINISH
|
---|
163 |
|
---|
164 | ;--------------------------------
|
---|
165 | ;Languages
|
---|
166 |
|
---|
167 | !insertmacro MUI_LANGUAGE "Basque"
|
---|
168 | !insertmacro MUI_LANGUAGE "Catalan"
|
---|
169 | !insertmacro MUI_LANGUAGE "Czech"
|
---|
170 | !insertmacro MUI_LANGUAGE "Danish"
|
---|
171 | !insertmacro MUI_LANGUAGE "Dutch"
|
---|
172 | !insertmacro MUI_LANGUAGE "English"
|
---|
173 | !insertmacro MUI_LANGUAGE "Finnish"
|
---|
174 | !insertmacro MUI_LANGUAGE "French"
|
---|
175 | !insertmacro MUI_LANGUAGE "German"
|
---|
176 | !insertmacro MUI_LANGUAGE "Hebrew"
|
---|
177 | !insertmacro MUI_LANGUAGE "Hungarian"
|
---|
178 | !insertmacro MUI_LANGUAGE "Italian"
|
---|
179 | !insertmacro MUI_LANGUAGE "Norwegian"
|
---|
180 | !insertmacro MUI_LANGUAGE "Polish"
|
---|
181 | !insertmacro MUI_LANGUAGE "Portuguese"
|
---|
182 | !insertmacro MUI_LANGUAGE "Russian"
|
---|
183 | !insertmacro MUI_LANGUAGE "Slovak"
|
---|
184 | !insertmacro MUI_LANGUAGE "Slovenian"
|
---|
185 | !insertmacro MUI_LANGUAGE "Spanish"
|
---|
186 |
|
---|
187 | ; Custom translations for setup
|
---|
188 |
|
---|
189 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\basque.nsh"
|
---|
190 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\catalan.nsh"
|
---|
191 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\czech.nsh"
|
---|
192 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\danish.nsh"
|
---|
193 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\dutch.nsh"
|
---|
194 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\english.nsh"
|
---|
195 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\finnish.nsh"
|
---|
196 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\french.nsh"
|
---|
197 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\german.nsh"
|
---|
198 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\hebrew.nsh"
|
---|
199 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\hungarian.nsh"
|
---|
200 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\italian.nsh"
|
---|
201 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\norwegian.nsh"
|
---|
202 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\polish.nsh"
|
---|
203 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\portuguese.nsh"
|
---|
204 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\russian.nsh"
|
---|
205 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\slovak.nsh"
|
---|
206 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\slovenian.nsh"
|
---|
207 | !insertmacro LANGFILE_INCLUDE "svn\smplayer\setup\translations\spanish.nsh"
|
---|
208 |
|
---|
209 | ;--------------------------------
|
---|
210 | ;Reserve Files
|
---|
211 |
|
---|
212 | ;These files should be inserted before other files in the data block
|
---|
213 | ;Keep these lines before any File command
|
---|
214 | ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
|
---|
215 |
|
---|
216 | !insertmacro MUI_RESERVEFILE_LANGDLL
|
---|
217 | ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
|
---|
218 |
|
---|
219 | ;--------------------------------
|
---|
220 | ;Installer Types
|
---|
221 |
|
---|
222 | InstType "Typical"
|
---|
223 | InstType "Compact"
|
---|
224 | InstType "Full"
|
---|
225 |
|
---|
226 | ;--------------------------------
|
---|
227 | ;Installer Sections
|
---|
228 |
|
---|
229 | ;--------------------------------
|
---|
230 | ;Main SMPlayer files
|
---|
231 | Section SMPlayer SMPlayer
|
---|
232 |
|
---|
233 | SectionIn 1 2 3 RO
|
---|
234 | SetOutPath "$INSTDIR"
|
---|
235 | File "smplayer-build\*"
|
---|
236 |
|
---|
237 | ;SMPlayer docs
|
---|
238 | SetOutPath "$INSTDIR\docs"
|
---|
239 | File /r "smplayer-build\docs\*.*"
|
---|
240 |
|
---|
241 | ;Qt imageformats
|
---|
242 | SetOutPath "$INSTDIR\imageformats"
|
---|
243 | File /r "smplayer-build\imageformats\*.*"
|
---|
244 |
|
---|
245 | ;SMPlayer key shortcuts
|
---|
246 | SetOutPath "$INSTDIR\shortcuts"
|
---|
247 | File /r "smplayer-build\shortcuts\*.*"
|
---|
248 |
|
---|
249 | SetOutPath "$PLUGINSDIR"
|
---|
250 | File 7za.exe
|
---|
251 |
|
---|
252 | ;Initialize to 0 if don't exist (based on error flag)
|
---|
253 | ClearErrors
|
---|
254 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer
|
---|
255 | ${If} ${Errors}
|
---|
256 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x0
|
---|
257 | ${EndIf}
|
---|
258 | ClearErrors
|
---|
259 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs
|
---|
260 | ${If} ${Errors}
|
---|
261 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
---|
262 | ${EndIf}
|
---|
263 |
|
---|
264 | SectionEnd
|
---|
265 |
|
---|
266 | ;--------------------------------
|
---|
267 | ;Desktop shortcut
|
---|
268 | ${MementoSection} "Desktop Shortcut" DesktopIcon
|
---|
269 | SectionIn 1 3
|
---|
270 |
|
---|
271 | SetOutPath "$INSTDIR"
|
---|
272 | SetShellVarContext all
|
---|
273 | CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
---|
274 |
|
---|
275 | ${MementoSectionEnd}
|
---|
276 |
|
---|
277 | ;--------------------------------
|
---|
278 | ;Start menu shortcuts
|
---|
279 | ${MementoSection} "Start Menu Shortcut" StartMenuIcon
|
---|
280 | SectionIn 1 3
|
---|
281 |
|
---|
282 | SetOutPath "$INSTDIR"
|
---|
283 | SetShellVarContext all
|
---|
284 | CreateDirectory "$SMPROGRAMS\SMPlayer"
|
---|
285 | CreateShortCut "$SMPROGRAMS\SMPlayer\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
---|
286 | WriteINIStr "$SMPROGRAMS\SMPlayer\SMPlayer on the Web.url" "InternetShortcut" "URL" "http://smplayer.sf.net"
|
---|
287 | CreateShortCut "$SMPROGRAMS\SMPlayer\Uninstall SMPlayer.lnk" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
288 |
|
---|
289 | ${MementoSectionEnd}
|
---|
290 |
|
---|
291 | ;--------------------------------
|
---|
292 | ;MPlayer & MPlayer Codecs
|
---|
293 | SectionGroup /e "MPlayer Components"
|
---|
294 |
|
---|
295 | !ifdef WITH_MPLAYER
|
---|
296 | Section MPlayer MPlayer
|
---|
297 | SectionIn 1 2 3 RO
|
---|
298 |
|
---|
299 | SetOutPath "$INSTDIR\mplayer"
|
---|
300 | File /r "smplayer-build\mplayer\*.*"
|
---|
301 |
|
---|
302 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
|
---|
303 |
|
---|
304 | SectionEnd
|
---|
305 | !else ifndef WITH_MPLAYER
|
---|
306 | Section MPlayer MPlayer
|
---|
307 | SectionIn 1 2 3 RO
|
---|
308 | AddSize 16800
|
---|
309 |
|
---|
310 | Call GetVerInfo
|
---|
311 |
|
---|
312 | ;Read from version-info
|
---|
313 | ;If it was unable to download, set version to that defined in DEFAULT_MPLAYER_VERSION
|
---|
314 | ${If} ${FileExists} "$PLUGINSDIR\version-info"
|
---|
315 | ReadINIStr $MPLAYER_VERSION "$PLUGINSDIR\version-info" smplayer mplayer
|
---|
316 | ${Else}
|
---|
317 | StrCpy $MPLAYER_VERSION ${DEFAULT_MPLAYER_VERSION}
|
---|
318 | ${EndIf}
|
---|
319 |
|
---|
320 | retry_mplayer:
|
---|
321 |
|
---|
322 | DetailPrint $(MPLAYER_IS_DOWNLOADING)
|
---|
323 | inetc::get /timeout 30000 /resume "" /caption $(MPLAYER_IS_DOWNLOADING) /banner "Downloading $MPLAYER_VERSION.7z" \
|
---|
324 | "http://downloads.sourceforge.net/smplayer/$MPLAYER_VERSION.7z?big_mirror=0" \
|
---|
325 | "$PLUGINSDIR\$MPLAYER_VERSION.7z"
|
---|
326 | Pop $R0
|
---|
327 | StrCmp $R0 OK 0 check_mplayer
|
---|
328 |
|
---|
329 | ;Extract
|
---|
330 | nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\$MPLAYER_VERSION.7z" -y -o"$PLUGINSDIR"'
|
---|
331 |
|
---|
332 | ;Copy
|
---|
333 | CreateDirectory "$INSTDIR\mplayer"
|
---|
334 | CopyFiles /SILENT "$PLUGINSDIR\$MPLAYER_VERSION\*" "$INSTDIR\mplayer"
|
---|
335 |
|
---|
336 | check_mplayer:
|
---|
337 | ;This label does not necessarily mean there was a download error, so check first
|
---|
338 | ${If} $R0 != "OK"
|
---|
339 | DetailPrint $(MPLAYER_DL_FAILED)
|
---|
340 | ${EndIf}
|
---|
341 |
|
---|
342 | IfFileExists "$INSTDIR\mplayer\mplayer.exe" mplayerInstSuccess mplayerInstFailed
|
---|
343 | mplayerInstSuccess:
|
---|
344 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
|
---|
345 | Goto done
|
---|
346 | mplayerInstFailed:
|
---|
347 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(MPLAYER_DL_RETRY) /SD IDCANCEL IDRETRY retry_mplayer
|
---|
348 | Abort $(MPLAYER_INST_FAILED)
|
---|
349 |
|
---|
350 | done:
|
---|
351 |
|
---|
352 | SectionEnd
|
---|
353 | !endif
|
---|
354 |
|
---|
355 | ;--------------------------------
|
---|
356 | ;MPlayer codecs
|
---|
357 | Section /o "Binary Codecs" Codecs
|
---|
358 | SectionIn 3
|
---|
359 | AddSize 22300
|
---|
360 |
|
---|
361 | Call GetVerInfo
|
---|
362 |
|
---|
363 | ;Read from version-info
|
---|
364 | ;If it was unable to download, set version to that defined in DEFAULT_CODECS_VERSION
|
---|
365 | ${If} ${FileExists} "$PLUGINSDIR\version-info"
|
---|
366 | ReadINIStr $CODEC_VERSION "$PLUGINSDIR\version-info" smplayer mplayercodecs
|
---|
367 | ${Else}
|
---|
368 | StrCpy $CODEC_VERSION ${DEFAULT_CODECS_VERSION}
|
---|
369 | ${EndIf}
|
---|
370 |
|
---|
371 | retry_codecs:
|
---|
372 |
|
---|
373 | DetailPrint $(CODECS_IS_DOWNLOADING)
|
---|
374 | inetc::get /timeout 30000 /resume "" /caption $(CODECS_IS_DOWNLOADING) /banner "Downloading $CODEC_VERSION.zip" \
|
---|
375 | "http://www.mplayerhq.hu/MPlayer/releases/codecs/$CODEC_VERSION.zip" \
|
---|
376 | "$PLUGINSDIR\$CODEC_VERSION.zip"
|
---|
377 | Pop $R0
|
---|
378 | StrCmp $R0 OK 0 check_codecs
|
---|
379 |
|
---|
380 | ;Extract
|
---|
381 | nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\$CODEC_VERSION.zip" -y -o"$PLUGINSDIR"'
|
---|
382 |
|
---|
383 | ;Copy
|
---|
384 | CreateDirectory "$INSTDIR\mplayer\codecs"
|
---|
385 | CopyFiles /SILENT "$PLUGINSDIR\$CODEC_VERSION\*" "$INSTDIR\mplayer\codecs"
|
---|
386 |
|
---|
387 | check_codecs:
|
---|
388 | ;This label does not necessarily mean there was a download error, so check first
|
---|
389 | ${If} $R0 != "OK"
|
---|
390 | DetailPrint $(CODECS_DL_FAILED)
|
---|
391 | ${EndIf}
|
---|
392 |
|
---|
393 | IfFileExists "$INSTDIR\mplayer\codecs\*.dll" codecsInstSuccess codecsInstFailed
|
---|
394 | codecsInstSuccess:
|
---|
395 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x1
|
---|
396 | Goto done
|
---|
397 | codecsInstFailed:
|
---|
398 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(CODECS_DL_RETRY) /SD IDCANCEL IDRETRY retry_codecs
|
---|
399 | DetailPrint $(CODECS_INST_FAILED)
|
---|
400 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
---|
401 | Sleep 5000
|
---|
402 |
|
---|
403 | done:
|
---|
404 |
|
---|
405 | SectionEnd
|
---|
406 |
|
---|
407 | SectionGroupEnd
|
---|
408 |
|
---|
409 | ;--------------------------------
|
---|
410 | ;Icon themes
|
---|
411 | ${MementoSection} "Icon Themes" Themes
|
---|
412 |
|
---|
413 | SectionIn 1 3
|
---|
414 | SetOutPath "$INSTDIR\themes"
|
---|
415 | File /r "smplayer-build\themes\*.*"
|
---|
416 |
|
---|
417 | ${MementoSectionEnd}
|
---|
418 |
|
---|
419 | ;--------------------------------
|
---|
420 | ;Translations
|
---|
421 | ${MementoSection} Translations Translations
|
---|
422 |
|
---|
423 | SectionIn 1 3
|
---|
424 | SetOutPath "$INSTDIR\translations"
|
---|
425 | File /r "smplayer-build\translations\*.*"
|
---|
426 |
|
---|
427 | ${MementoSectionEnd}
|
---|
428 |
|
---|
429 | ;--------------------------------
|
---|
430 | ;Install/Uninstall information
|
---|
431 | Section -Post
|
---|
432 |
|
---|
433 | ;Uninstall file
|
---|
434 | WriteUninstaller "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
435 |
|
---|
436 | ;Store installed path & version
|
---|
437 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Path" "$INSTDIR"
|
---|
438 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Version" "${SMPLAYER_VERSION}"
|
---|
439 |
|
---|
440 | ;Allows user to use 'start smplayer.exe'
|
---|
441 | WriteRegStr HKLM "${SMPLAYER_APP_PATHS_KEY}" "" "$INSTDIR\smplayer.exe"
|
---|
442 |
|
---|
443 | ;Registry entries needed for Default Programs in Vista & later
|
---|
444 | ${If} ${AtLeastWinVista}
|
---|
445 | Call DefaultProgramsReg
|
---|
446 | ${EndIf}
|
---|
447 |
|
---|
448 | ;Registry Uninstall information
|
---|
449 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayName" "$(^Name)"
|
---|
450 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayIcon" "$INSTDIR\smplayer.exe"
|
---|
451 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayVersion" "${SMPLAYER_VERSION}"
|
---|
452 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "HelpLink" "http://smplayer.berlios.de/forum"
|
---|
453 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "Publisher" "RVM"
|
---|
454 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
455 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLInfoAbout" "http://smplayer.sf.net"
|
---|
456 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLUpdateInfo" "http://smplayer.sf.net"
|
---|
457 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoModify" "1"
|
---|
458 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoRepair" "1"
|
---|
459 |
|
---|
460 | SectionEnd
|
---|
461 |
|
---|
462 | ${MementoSectionDone}
|
---|
463 |
|
---|
464 | ;--------------------------------
|
---|
465 | ;Section descriptions
|
---|
466 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
---|
467 | !insertmacro MUI_DESCRIPTION_TEXT ${SMPlayer} "SMPlayer, shared libraries, and documentation."
|
---|
468 | !insertmacro MUI_DESCRIPTION_TEXT ${DesktopIcon} "Creates a shortcut on the desktop."
|
---|
469 | !insertmacro MUI_DESCRIPTION_TEXT ${StartMenuIcon} "Creates start menu shortcuts."
|
---|
470 | !ifdef WITH_MPLAYER
|
---|
471 | !insertmacro MUI_DESCRIPTION_TEXT ${MPlayer} "The engine behind SMPlayer, required for playback."
|
---|
472 | !else ifndef WITH_MPLAYER
|
---|
473 | !insertmacro MUI_DESCRIPTION_TEXT ${MPlayer} "Downloads/installs MPlayer; requires an active internet connection. Required for playback."
|
---|
474 | !endif
|
---|
475 | !insertmacro MUI_DESCRIPTION_TEXT ${Codecs} "Downloads/installs optional binary codecs for MPlayer; requires an active internet connection."
|
---|
476 | !insertmacro MUI_DESCRIPTION_TEXT ${Themes} "Additional icon themes for SMPlayer."
|
---|
477 | !insertmacro MUI_DESCRIPTION_TEXT ${Translations} "Translations for the SMPlayer interface && help into 30+ additional languages."
|
---|
478 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
---|
479 |
|
---|
480 | ;--------------------------------
|
---|
481 | ;Installer functions
|
---|
482 |
|
---|
483 | Function .onInit
|
---|
484 |
|
---|
485 | /* Check if setup is already running */
|
---|
486 | System::Call 'kernel32::CreateMutexW(i 0, i 0, t "MPlayerSMPlayer") i .r1 ?e'
|
---|
487 | Pop $R0
|
---|
488 |
|
---|
489 | StrCmp $R0 0 +3
|
---|
490 | MessageBox MB_OK|MB_ICONEXCLAMATION $(SMPLAYER_INSTALLER_IS_RUNNING)
|
---|
491 | Abort
|
---|
492 |
|
---|
493 | /* Privileges Check */
|
---|
494 | Call CheckUserRights
|
---|
495 |
|
---|
496 | ;Check for admin (mimic old Inno Setup behavior)
|
---|
497 | ${If} $IS_ADMIN == 0
|
---|
498 | MessageBox MB_OK|MB_ICONSTOP $(SMPLAYER_INSTALLER_NO_ADMIN)
|
---|
499 | Abort
|
---|
500 | ${EndIf}
|
---|
501 |
|
---|
502 | /* Ask for setup language */
|
---|
503 | !insertmacro MUI_LANGDLL_DISPLAY
|
---|
504 |
|
---|
505 | Call CheckPreviousVersion
|
---|
506 |
|
---|
507 | Call LoadPreviousSettings
|
---|
508 |
|
---|
509 | FunctionEnd
|
---|
510 |
|
---|
511 | Function .onInstSuccess
|
---|
512 |
|
---|
513 | ${MementoSectionSave}
|
---|
514 |
|
---|
515 | FunctionEnd
|
---|
516 |
|
---|
517 | Function .onInstFailed
|
---|
518 |
|
---|
519 | Call UninstallSMPlayer
|
---|
520 |
|
---|
521 | Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
522 | RMDir "$INSTDIR"
|
---|
523 |
|
---|
524 | FunctionEnd
|
---|
525 |
|
---|
526 | Function .onSelChange
|
---|
527 |
|
---|
528 | SectionGetFlags ${Codecs} $R0
|
---|
529 | ${If} $R0 != $R1
|
---|
530 | StrCpy $R1 $R0
|
---|
531 | IntOp $R0 $R0 & ${SF_SELECTED}
|
---|
532 | ${If} $R0 == ${SF_SELECTED}
|
---|
533 | MessageBox MB_OK $(MPLAYER_CODEC_INFORMATION)
|
---|
534 | ${EndIf}
|
---|
535 | ${EndIf}
|
---|
536 |
|
---|
537 | FunctionEnd
|
---|
538 |
|
---|
539 | Function CheckPreviousVersion
|
---|
540 |
|
---|
541 | ReadRegStr $PREVIOUS_VERSION HKLM "${SMPLAYER_REG_KEY}" "Version"
|
---|
542 |
|
---|
543 | ${VersionCompare} $PREVIOUS_VERSION ${SMPLAYER_VERSION} $PREVIOUS_VERSION_STATE
|
---|
544 | ;$PREVIOUS_VERSION_STATE=0 This installer is the same version as the installed copy
|
---|
545 | ;$PREVIOUS_VERSION_STATE=1 A newer version than this installer is already installed
|
---|
546 | ;$PREVIOUS_VERSION_STATE=2 An older version than this installer is already installed
|
---|
547 |
|
---|
548 | FunctionEnd
|
---|
549 |
|
---|
550 | Function CheckUserRights
|
---|
551 |
|
---|
552 | ClearErrors
|
---|
553 | UserInfo::GetName
|
---|
554 | ${If} ${Errors}
|
---|
555 | StrCpy $IS_ADMIN 1
|
---|
556 | Return
|
---|
557 | ${EndIf}
|
---|
558 |
|
---|
559 | Pop $USERNAME
|
---|
560 | UserInfo::GetAccountType
|
---|
561 | Pop $R0
|
---|
562 | ${Switch} $R0
|
---|
563 | ${Case} "Admin"
|
---|
564 | ${Case} "Power"
|
---|
565 | StrCpy $IS_ADMIN 1
|
---|
566 | ${Break}
|
---|
567 | ${Default}
|
---|
568 | StrCpy $IS_ADMIN 0
|
---|
569 | ${Break}
|
---|
570 | ${EndSwitch}
|
---|
571 |
|
---|
572 | FunctionEnd
|
---|
573 |
|
---|
574 | Function DefaultProgramsReg
|
---|
575 |
|
---|
576 | ;HKEY_CLASSES_ROOT ProgId registration
|
---|
577 | WriteRegStr HKCR "MPlayerFileVideo\DefaultIcon" "" '"$INSTDIR\smplayer.exe",1'
|
---|
578 | WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue" "" "Enqueue in SMPlayer"
|
---|
579 | WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue\command" "" '"$INSTDIR\smplayer.exe" -add-to-playlist "%1"'
|
---|
580 | WriteRegStr HKCR "MPlayerFileVideo\shell\open" "FriendlyAppName" "SMPlayer Media Player"
|
---|
581 | WriteRegStr HKCR "MPlayerFileVideo\shell\open\command" "" '"$INSTDIR\smplayer.exe" "%1"'
|
---|
582 |
|
---|
583 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}" "ApplicationDescription" $(APPLICATION_DESCRIPTION)
|
---|
584 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}" "ApplicationName" "SMPlayer"
|
---|
585 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".3gp" "MPlayerFileVideo"
|
---|
586 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ac3" "MPlayerFileVideo"
|
---|
587 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ape" "MPlayerFileVideo"
|
---|
588 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".asf" "MPlayerFileVideo"
|
---|
589 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".avi" "MPlayerFileVideo"
|
---|
590 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".bin" "MPlayerFileVideo"
|
---|
591 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".dat" "MPlayerFileVideo"
|
---|
592 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".divx" "MPlayerFileVideo"
|
---|
593 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".dv" "MPlayerFileVideo"
|
---|
594 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".dvr-ms" "MPlayerFileVideo"
|
---|
595 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".flac" "MPlayerFileVideo"
|
---|
596 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".flv" "MPlayerFileVideo"
|
---|
597 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".iso" "MPlayerFileVideo"
|
---|
598 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".m1v" "MPlayerFileVideo"
|
---|
599 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".m2t" "MPlayerFileVideo"
|
---|
600 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".m2ts" "MPlayerFileVideo"
|
---|
601 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".m2v" "MPlayerFileVideo"
|
---|
602 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".m3u" "MPlayerFileVideo"
|
---|
603 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".m3u8" "MPlayerFileVideo"
|
---|
604 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".m4v" "MPlayerFileVideo"
|
---|
605 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mkv" "MPlayerFileVideo"
|
---|
606 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mov" "MPlayerFileVideo"
|
---|
607 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mp3" "MPlayerFileVideo"
|
---|
608 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mp4" "MPlayerFileVideo"
|
---|
609 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mpeg" "MPlayerFileVideo"
|
---|
610 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mpg" "MPlayerFileVideo"
|
---|
611 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mpv" "MPlayerFileVideo"
|
---|
612 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".mqv" "MPlayerFileVideo"
|
---|
613 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".nsv" "MPlayerFileVideo"
|
---|
614 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ogg" "MPlayerFileVideo"
|
---|
615 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ogm" "MPlayerFileVideo"
|
---|
616 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ogv" "MPlayerFileVideo"
|
---|
617 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".pls" "MPlayerFileVideo"
|
---|
618 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ra" "MPlayerFileVideo"
|
---|
619 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ram" "MPlayerFileVideo"
|
---|
620 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".rec" "MPlayerFileVideo"
|
---|
621 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".rm" "MPlayerFileVideo"
|
---|
622 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".rmvb" "MPlayerFileVideo"
|
---|
623 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".swf" "MPlayerFileVideo"
|
---|
624 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".ts" "MPlayerFileVideo"
|
---|
625 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".vcd" "MPlayerFileVideo"
|
---|
626 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".vfw" "MPlayerFileVideo"
|
---|
627 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".vob" "MPlayerFileVideo"
|
---|
628 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".wav" "MPlayerFileVideo"
|
---|
629 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".wma" "MPlayerFileVideo"
|
---|
630 | WriteRegStr HKLM "${SMPLAYER_DEFPROGRAMS_KEY}\FileAssociations" ".wmv" "MPlayerFileVideo"
|
---|
631 | WriteRegStr HKLM "Software\RegisteredApplications" "SMPlayer" "${SMPLAYER_DEFPROGRAMS_KEY}"
|
---|
632 |
|
---|
633 | FunctionEnd
|
---|
634 |
|
---|
635 | Function GetVerInfo
|
---|
636 |
|
---|
637 | IfFileExists "$PLUGINSDIR\version-info" end_dl_ver_info 0
|
---|
638 | DetailPrint $(VERINFO_IS_DOWNLOADING)
|
---|
639 | inetc::get /timeout 30000 /resume "" /silent "http://smplayer.sourceforge.net/mplayer-version-info" \
|
---|
640 | "$PLUGINSDIR\version-info"
|
---|
641 | Pop $R0
|
---|
642 | StrCmp $R0 OK +2
|
---|
643 | DetailPrint $(VERINFO_DL_FAILED)
|
---|
644 |
|
---|
645 | end_dl_ver_info:
|
---|
646 |
|
---|
647 | FunctionEnd
|
---|
648 |
|
---|
649 | Function LoadPreviousSettings
|
---|
650 |
|
---|
651 | ;MPlayer codecs section doesn't use Memento so we need to restore it manually
|
---|
652 | ReadRegStr $R0 HKLM "${SMPLAYER_REG_KEY}" "Installed_Codecs"
|
---|
653 | ${If} $R0 == 1
|
---|
654 | !insertmacro SelectSection ${Codecs}
|
---|
655 | ${EndIf}
|
---|
656 |
|
---|
657 | ${MementoSectionRestore}
|
---|
658 |
|
---|
659 | FunctionEnd
|
---|
660 |
|
---|
661 | Function PageReinstall
|
---|
662 |
|
---|
663 | ${If} $PREVIOUS_VERSION == ""
|
---|
664 | Abort
|
---|
665 | ${EndIf}
|
---|
666 |
|
---|
667 | nsDialogs::Create /NOUNLOAD 1018
|
---|
668 | Pop $0
|
---|
669 |
|
---|
670 | ${If} $PREVIOUS_VERSION_STATE == 2
|
---|
671 |
|
---|
672 | !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install SMPlayer."
|
---|
673 | nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "An older version of SMPlayer is installed on your system. Select the operation you want to perform and click Next to continue."
|
---|
674 | Pop $R0
|
---|
675 | nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Upgrade SMPlayer using previous settings (recommended)"
|
---|
676 | Pop $REINSTALL_UNINSTALLBUTTON
|
---|
677 | nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
|
---|
678 | Pop $R0
|
---|
679 |
|
---|
680 | ${If} $REINSTALL_UNINSTALL == ""
|
---|
681 | StrCpy $REINSTALL_UNINSTALL 1
|
---|
682 | ${EndIf}
|
---|
683 |
|
---|
684 | ${ElseIf} $PREVIOUS_VERSION_STATE == 1
|
---|
685 |
|
---|
686 | !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install SMPlayer."
|
---|
687 | nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "A newer version of SMPlayer is already installed! It is not recommended that you downgrade to an older version. Select the operation you want to perform and click Next to continue."
|
---|
688 | Pop $R0
|
---|
689 | nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Downgrade SMPlayer using previous settings (recommended)"
|
---|
690 | Pop $REINSTALL_UNINSTALLBUTTON
|
---|
691 | nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
|
---|
692 | Pop $R0
|
---|
693 |
|
---|
694 | ${If} $REINSTALL_UNINSTALL == ""
|
---|
695 | StrCpy $REINSTALL_UNINSTALL 1
|
---|
696 | ${EndIf}
|
---|
697 |
|
---|
698 | ${ElseIf} $PREVIOUS_VERSION_STATE == 0
|
---|
699 |
|
---|
700 | !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
|
---|
701 | nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "SMPlayer ${SMPLAYER_VERSION} is already installed. Select the operation you want to perform and click Next to continue."
|
---|
702 | Pop $R0
|
---|
703 | nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Add/Remove/Reinstall components"
|
---|
704 | Pop $R0
|
---|
705 | nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Uninstall SMPlayer"
|
---|
706 | Pop $REINSTALL_UNINSTALLBUTTON
|
---|
707 |
|
---|
708 | ${If} $REINSTALL_UNINSTALL == ""
|
---|
709 | StrCpy $REINSTALL_UNINSTALL 2
|
---|
710 | ${EndIf}
|
---|
711 |
|
---|
712 | ${Else}
|
---|
713 |
|
---|
714 | MessageBox MB_ICONSTOP "Unknown value of PREVIOUS_VERSION_STATE, aborting" /SD IDOK
|
---|
715 | Abort
|
---|
716 |
|
---|
717 | ${EndIf}
|
---|
718 |
|
---|
719 | ${If} $REINSTALL_UNINSTALL == 1
|
---|
720 | SendMessage $REINSTALL_UNINSTALLBUTTON ${BM_SETCHECK} 1 0
|
---|
721 | ${Else}
|
---|
722 | SendMessage $R0 ${BM_SETCHECK} 1 0
|
---|
723 | ${EndIf}
|
---|
724 |
|
---|
725 | nsDialogs::Show
|
---|
726 |
|
---|
727 | FunctionEnd
|
---|
728 |
|
---|
729 | Function PageComponentsPre
|
---|
730 |
|
---|
731 | ${If} $REINSTALL_UNINSTALL == 1
|
---|
732 | Abort
|
---|
733 | ${EndIf}
|
---|
734 |
|
---|
735 | FunctionEnd
|
---|
736 |
|
---|
737 | Function PageDirectoryPre
|
---|
738 |
|
---|
739 | ${If} $REINSTALL_UNINSTALL == 1
|
---|
740 | Abort
|
---|
741 | ${EndIf}
|
---|
742 |
|
---|
743 | FunctionEnd
|
---|
744 |
|
---|
745 | Function PageInstfilesShow
|
---|
746 |
|
---|
747 | ${If} $REINSTALL_UNINSTALL != ""
|
---|
748 | Call RunUninstaller
|
---|
749 | BringToFront
|
---|
750 | ${EndIf}
|
---|
751 |
|
---|
752 | FunctionEnd
|
---|
753 |
|
---|
754 | Function PageLeaveReinstall
|
---|
755 |
|
---|
756 | SendMessage $REINSTALL_UNINSTALLBUTTON ${BM_GETCHECK} 0 0 $R0
|
---|
757 | ${If} $R0 == 1
|
---|
758 | ; Option to uninstall old version selected
|
---|
759 | StrCpy $REINSTALL_UNINSTALL 1
|
---|
760 | ${Else}
|
---|
761 | ; Custom up/downgrade or add/remove/reinstall
|
---|
762 | StrCpy $REINSTALL_UNINSTALL 2
|
---|
763 | ${EndIf}
|
---|
764 |
|
---|
765 | ${If} $REINSTALL_UNINSTALL == 1
|
---|
766 | ${If} $PREVIOUS_VERSION_STATE == 0
|
---|
767 | Call RunUninstaller
|
---|
768 | Quit
|
---|
769 | ${Else}
|
---|
770 | ${EndIf}
|
---|
771 |
|
---|
772 | ${EndIf}
|
---|
773 |
|
---|
774 | FunctionEnd
|
---|
775 |
|
---|
776 | Function RunUninstaller
|
---|
777 |
|
---|
778 | ReadRegStr $R1 HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString"
|
---|
779 |
|
---|
780 | ${If} $R1 == ""
|
---|
781 | Return
|
---|
782 | ${EndIf}
|
---|
783 |
|
---|
784 | ;Run uninstaller
|
---|
785 | HideWindow
|
---|
786 |
|
---|
787 | ClearErrors
|
---|
788 |
|
---|
789 | ${If} $PREVIOUS_VERSION_STATE == 0
|
---|
790 | ${AndIf} $REINSTALL_UNINSTALL == 1
|
---|
791 | ExecWait '$R1 _?=$INSTDIR'
|
---|
792 | ${Else}
|
---|
793 | ExecWait '$R1 /frominstall _?=$INSTDIR'
|
---|
794 | ${EndIf}
|
---|
795 |
|
---|
796 | IfErrors no_remove_uninstaller
|
---|
797 |
|
---|
798 | IfFileExists "$INSTDIR\${SMPLAYER_UNINST_EXE}" 0 no_remove_uninstaller
|
---|
799 |
|
---|
800 | Delete "$R1"
|
---|
801 | RMDir $INSTDIR
|
---|
802 |
|
---|
803 | no_remove_uninstaller:
|
---|
804 |
|
---|
805 | FunctionEnd
|
---|
806 |
|
---|
807 | ;--------------------------------
|
---|
808 | ;Shared functions
|
---|
809 |
|
---|
810 | !macro UninstallSMPlayerMacro un
|
---|
811 | Function ${un}UninstallSMPlayer
|
---|
812 |
|
---|
813 | ;Delete desktop and start menu shortcuts
|
---|
814 | SetDetailsPrint textonly
|
---|
815 | DetailPrint "Deleting Shortcuts..."
|
---|
816 | SetDetailsPrint listonly
|
---|
817 |
|
---|
818 | SetShellVarContext all
|
---|
819 | Delete "$DESKTOP\SMPlayer.lnk"
|
---|
820 | Delete "$SMPROGRAMS\SMPlayer\SMPlayer.lnk"
|
---|
821 | Delete "$SMPROGRAMS\SMPlayer\SMPlayer on the Web.url"
|
---|
822 | Delete "$SMPROGRAMS\SMPlayer\Uninstall SMPlayer.lnk"
|
---|
823 | RMDir "$SMPROGRAMS\SMPlayer"
|
---|
824 |
|
---|
825 | ;Delete directories recursively except for main directory
|
---|
826 | ;Do not recursively delete $INSTDIR
|
---|
827 | SetDetailsPrint textonly
|
---|
828 | DetailPrint "Deleting Files..."
|
---|
829 | SetDetailsPrint listonly
|
---|
830 |
|
---|
831 | RMDir /r "$INSTDIR\docs"
|
---|
832 | RMDir /r "$INSTDIR\imageformats"
|
---|
833 | RMDir /r "$INSTDIR\mplayer"
|
---|
834 | RMDir /r "$INSTDIR\shortcuts"
|
---|
835 | RMDir /r "$INSTDIR\themes"
|
---|
836 | RMDir /r "$INSTDIR\translations"
|
---|
837 | Delete "$INSTDIR\*.txt"
|
---|
838 | Delete "$INSTDIR\mingwm10.dll"
|
---|
839 | Delete "$INSTDIR\Q*.dll"
|
---|
840 | Delete "$INSTDIR\smplayer.exe"
|
---|
841 | Delete "$INSTDIR\dxlist.exe"
|
---|
842 |
|
---|
843 | ;Delete registry keys
|
---|
844 | SetDetailsPrint textonly
|
---|
845 | DetailPrint "Deleting Registry Keys..."
|
---|
846 | SetDetailsPrint listonly
|
---|
847 |
|
---|
848 | DeleteRegKey HKLM "${SMPLAYER_REG_KEY}"
|
---|
849 | DeleteRegKey HKLM "${SMPLAYER_APP_PATHS_KEY}"
|
---|
850 | DeleteRegKey HKLM "${SMPLAYER_UNINST_KEY}"
|
---|
851 | DeleteRegKey HKCR "MPlayerFileVideo"
|
---|
852 | DeleteRegKey HKLM "Software\Clients\Media\SMPlayer"
|
---|
853 | DeleteRegValue HKLM "Software\RegisteredApplications" "SMPlayer"
|
---|
854 |
|
---|
855 | SetDetailsPrint both
|
---|
856 |
|
---|
857 | FunctionEnd
|
---|
858 | !macroend
|
---|
859 | !insertmacro UninstallSMPlayerMacro ""
|
---|
860 | !insertmacro UninstallSMPlayerMacro "un."
|
---|
861 |
|
---|
862 | /*************************************** Uninstaller *******************************************/
|
---|
863 |
|
---|
864 | Section Uninstall
|
---|
865 |
|
---|
866 | ;Make sure SMPlayer is installed from where the uninstaller is being executed.
|
---|
867 | IfFileExists $INSTDIR\smplayer.exe smplayer_installed
|
---|
868 | MessageBox MB_YESNO $(SMPLAYER_NOT_INSTALLED) /SD IDNO IDYES smplayer_installed
|
---|
869 | Abort $(UNINSTALL_ABORTED)
|
---|
870 |
|
---|
871 | smplayer_installed:
|
---|
872 |
|
---|
873 | SetDetailsPrint textonly
|
---|
874 | DetailPrint "Restoring file associations..."
|
---|
875 | SetDetailsPrint listonly
|
---|
876 |
|
---|
877 | ;Don't restore file associations if reinstalling
|
---|
878 | ${un.GetParameters} $R0
|
---|
879 | ${un.GetOptions} $R0 "/frominstall" $R1
|
---|
880 |
|
---|
881 | IfErrors 0 +2
|
---|
882 | ExecWait '"$INSTDIR\smplayer.exe" -uninstall'
|
---|
883 |
|
---|
884 | Call un.UninstallSMPlayer
|
---|
885 |
|
---|
886 | Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
887 | RMDir "$INSTDIR"
|
---|
888 |
|
---|
889 | SectionEnd
|
---|
890 |
|
---|
891 | ;--------------------------------
|
---|
892 | ;Required functions
|
---|
893 |
|
---|
894 | !insertmacro un.GetParameters
|
---|
895 | !insertmacro un.GetOptions
|
---|
896 |
|
---|
897 | ;--------------------------------
|
---|
898 | ;Uninstaller functions
|
---|
899 |
|
---|
900 | Function un.onInit
|
---|
901 |
|
---|
902 | Call un.CheckUserRights
|
---|
903 |
|
---|
904 | ;Check for admin (mimic old Inno Setup behavior)
|
---|
905 | ${If} $IS_ADMIN == 0
|
---|
906 | MessageBox MB_OK|MB_ICONSTOP $(UNINSTALL_NO_ADMIN)
|
---|
907 | Abort
|
---|
908 | ${EndIf}
|
---|
909 |
|
---|
910 | ;Get the stored language preference
|
---|
911 | !insertmacro MUI_UNGETLANGUAGE
|
---|
912 |
|
---|
913 | FunctionEnd
|
---|
914 |
|
---|
915 | Function un.CheckUserRights
|
---|
916 |
|
---|
917 | ClearErrors
|
---|
918 | UserInfo::GetName
|
---|
919 | ${If} ${Errors}
|
---|
920 | StrCpy $IS_ADMIN 1
|
---|
921 | Return
|
---|
922 | ${EndIf}
|
---|
923 |
|
---|
924 | Pop $USERNAME
|
---|
925 | UserInfo::GetAccountType
|
---|
926 | Pop $R0
|
---|
927 | ${Switch} $R0
|
---|
928 | ${Case} "Admin"
|
---|
929 | ${Case} "Power"
|
---|
930 | StrCpy $IS_ADMIN 1
|
---|
931 | ${Break}
|
---|
932 | ${Default}
|
---|
933 | StrCpy $IS_ADMIN 0
|
---|
934 | ${Break}
|
---|
935 | ${EndSwitch}
|
---|
936 |
|
---|
937 | FunctionEnd
|
---|
938 |
|
---|
939 | Function un.ConfirmPagePre
|
---|
940 |
|
---|
941 | ${un.GetParameters} $R0
|
---|
942 |
|
---|
943 | ${un.GetOptions} $R0 "/frominstall" $R1
|
---|
944 | ${Unless} ${Errors}
|
---|
945 | Abort
|
---|
946 | ${EndUnless}
|
---|
947 |
|
---|
948 | FunctionEnd
|
---|
949 |
|
---|
950 | Function un.FinishPagePre
|
---|
951 |
|
---|
952 | ${un.GetParameters} $R0
|
---|
953 |
|
---|
954 | ${un.GetOptions} $R0 "/frominstall" $R1
|
---|
955 | ${Unless} ${Errors}
|
---|
956 | Abort
|
---|
957 | ${EndUnless}
|
---|
958 |
|
---|
959 | FunctionEnd
|
---|