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