]> git.sesse.net Git - vlc/commitdiff
Win32: add VLC to the "Set program access and computer defaults" dialog
authorGeoffroy Couprie <geal@videolan.org>
Sat, 28 Nov 2009 20:14:53 +0000 (21:14 +0100)
committerGeoffroy Couprie <geal@videolan.org>
Sat, 28 Nov 2009 20:17:45 +0000 (21:17 +0100)
The file associations need to be implemented

Makefile.am
configure.ac
extras/package/win32/spad.nsi.in [new file with mode: 0644]
extras/package/win32/vlc.win32.nsi.in

index 0f1146db87d74040c45f0d1007c1c3a6c892126d..26cf733d2c3e1782e829e089bef8eceb1a69d40b 100644 (file)
@@ -53,6 +53,7 @@ EXTRA_DIST = \
        extras/package/rpm/vlc.fedora.spec \
        extras/package/rpm/vlc.altlinux.spec \
        extras/package/win32/vlc.win32.nsi.in \
+       extras/package/win32/spad.nsi.in \
        extras/package/win32/languages/declaration.nsh \
        extras/package/win32/languages/english.nsh \
        extras/package/win32/languages/french.nsh
@@ -60,7 +61,7 @@ EXTRA_DIST = \
 dist_noinst_SCRIPTS = bootstrap toolbox
 nodist_noinst_SCRIPTS = compile
 
-BUILT_SOURCES_distclean = vlc-config extras/package/win32/vlc.win32.nsi
+BUILT_SOURCES_distclean = vlc-config extras/package/win32/vlc.win32.nsi extras/package/win32/spad.nsi
 if HAVE_DARWIN
 BUILT_SOURCES_clean = macosx-sdk
 else
@@ -752,6 +753,7 @@ package-win32-base-debug: package-win-common
 # Copy relevant files
 # Script installer
        cp "$(top_builddir)/extras/package/win32/vlc.win32.nsi" "$(win32_destdir)/"
+       cp "$(top_builddir)/extras/package/win32/spad.nsi" "$(win32_destdir)/"
        mkdir "$(win32_destdir)/languages"
        cp $(srcdir)/extras/package/win32/languages/*.nsh "$(win32_destdir)/languages/"
 
@@ -925,6 +927,7 @@ package-win32-base-exe: package-win32-base
        else \
            echo 'Error: cannot locate makensis tool'; exit 1; \
        fi; \
+       eval "$$MAKENSIS $(win32_destdir)/spad.nsi"
        eval "$$MAKENSIS $(win32_destdir)/vlc.win32.nsi"
 
 package-win32-base-zip: package-win32-base
index 89634aee4cb7ced211bea4d0508d01885fe1f13f..32a86c3a75c57abd6d4afa0321fb678ff0002a50 100644 (file)
@@ -5250,6 +5250,7 @@ dnl Create vlc-config.in
 VLC_OUTPUT_VLC_CONFIG_IN
 
 AC_CONFIG_FILES([
+  extras/package/win32/spad.nsi
   extras/package/win32/vlc.win32.nsi
   extras/package/macosx/Info.plist
   extras/package/macosx/Resources/English.lproj/InfoPlist.strings
diff --git a/extras/package/win32/spad.nsi.in b/extras/package/win32/spad.nsi.in
new file mode 100644 (file)
index 0000000..ffb782d
--- /dev/null
@@ -0,0 +1,175 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; "set program as default" script for vlc                                        ;
+; more infos at http://msdn.microsoft.com/en-us/library/bb776851%28VS.85%29.aspx ;
+; and http://msdn.microsoft.com/en-us/library/bb776851%28VS.85%29.aspx           ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+!include LogicLib.nsh
+
+Function GetOptions
+       !define GetOptions `!insertmacro GetOptionsCall`
+       !macro GetOptionsCall _PARAMETERS _OPTION _RESULT
+               Push `${_PARAMETERS}`
+               Push `${_OPTION}`
+               Call GetOptions
+               Pop ${_RESULT}
+       !macroend
+       Exch $1
+       Exch
+       Exch $0
+       Exch
+       Push $2
+       Push $3
+       Push $4
+       Push $5
+       Push $6
+       Push $7
+       ClearErrors
+       StrCpy $2 $1 '' 1
+       StrCpy $1 $1 1
+       StrLen $3 $2
+       StrCpy $7 0
+       begin:
+       StrCpy $4 -1
+       StrCpy $6 ''
+       quote:
+       IntOp $4 $4 + 1
+       StrCpy $5 $0 1 $4
+       StrCmp $5$7 '0' notfound
+       StrCmp $5 '' trimright
+       StrCmp $5 '"' 0 +7
+       StrCmp $6 '' 0 +3
+       StrCpy $6 '"'
+       goto quote
+       StrCmp $6 '"' 0 +3
+       StrCpy $6 ''
+       goto quote
+       StrCmp $5 `'` 0 +7
+       StrCmp $6 `` 0 +3
+       StrCpy $6 `'`
+       goto quote
+       StrCmp $6 `'` 0 +3
+       StrCpy $6 ``
+       goto quote
+       StrCmp $5 '`' 0 +7
+       StrCmp $6 '' 0 +3
+       StrCpy $6 '`'
+       goto quote
+       StrCmp $6 '`' 0 +3
+       StrCpy $6 ''
+       goto quote
+       StrCmp $6 '"' quote
+       StrCmp $6 `'` quote
+       StrCmp $6 '`' quote
+       StrCmp $5 $1 0 quote
+       StrCmp $7 0 trimleft trimright
+       trimleft:
+       IntOp $4 $4 + 1
+       StrCpy $5 $0 $3 $4
+       StrCmp $5 '' notfound
+       StrCmp $5 $2 0 quote
+       IntOp $4 $4 + $3
+       StrCpy $0 $0 '' $4
+       StrCpy $4 $0 1
+       StrCmp $4 ' ' 0 +3
+       StrCpy $0 $0 '' 1
+       goto -3
+       StrCpy $7 1
+       goto begin
+       trimright:
+       StrCpy $0 $0 $4
+       StrCpy $4 $0 1 -1
+       StrCmp $4 ' ' 0 +3
+       StrCpy $0 $0 -1
+       goto -3
+       StrCpy $3 $0 1
+       StrCpy $4 $0 1 -1
+       StrCmp $3 $4 0 end
+       StrCmp $3 '"' +3
+       StrCmp $3 `'` +2
+       StrCmp $3 '`' 0 end
+       StrCpy $0 $0 -1 1
+       goto end
+       notfound:
+       SetErrors
+       StrCpy $0 ''
+       end:
+       Pop $7
+       Pop $6
+       Pop $5
+       Pop $4
+       Pop $3
+       Pop $2
+       Pop $1
+       Exch $0
+FunctionEnd
+
+; Remove shortcuts
+!macro HideIcons
+  WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0
+  SetShellVarContext all  ; Set $DESKTOP to All Users
+  ${Unless} ${FileExists} "$DESKTOP\VLC media player.lnk"
+    SetShellVarContext current  ; Set $DESKTOP to the current user's desktop
+  ${EndUnless}
+  ${If} ${FileExists} "$DESKTOP\VLC media player.lnk"
+    Delete "$DESKTOP\VLC media player.lnk"
+  ${EndIf}
+  ${If} ${FileExists} "$QUICKLAUNCH\VLC media player.lnk"
+    Delete "$QUICKLAUNCH\VLC media player.lnk"
+  ${EndIf}
+!macroend
+!define HideIcons "!insertmacro HideIcons"
+
+; Adds shortcuts 
+!macro ShowIcons
+  WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 1
+  SetShellVarContext all  ; Set $DESKTOP to All Users
+  ${Unless} ${FileExists} "$DESKTOP\VLC media player.lnk"
+    CreateShortCut "$DESKTOP\VLC media player.lnk" "$EXEDIR\vlc.exe" "" "$EXEDIR\vlc.exe" 0
+  ${EndUnless}
+  ${Unless} ${FileExists} "$QUICKLAUNCH\VLC media player.lnk"
+    CreateShortCut "$QUICKLAUNCH\VLC media player.lnk" "$EXEDIR\vlc.exe" "" "$EXEDIR\vlc.exe" 0
+  ${EndUnless}
+!macroend
+!define ShowIcons "!insertmacro ShowIcons"
+
+!macro Reinstall
+    MessageBox MB_OK "Not implemented"
+!macroend
+!define Reinstall "!insertmacro reinstall"
+
+Section
+  SetShellVarContext all
+  SetOutPath "$EXEDIR"
+
+    ${GetOptions} $CMDLINE "HideIcons"  $R0
+       IfErrors 0 +2
+       goto showIc
+    !insertmacro HideIcons
+    
+    showIc:
+    ${GetOptions} $CMDLINE "ShowIcons"  $R0
+    IfErrors 0 +2
+    goto reinst
+    !insertmacro ShowIcons
+    
+    reinst:
+    ${GetOptions} $CMDLINE "Reinstall"  $R0
+       IfErrors 0 +2
+       goto end
+    !insertmacro Reinstall
+    
+    end:
+SectionEnd
+
+;"setup" is aded to the file name to trigger the UAC heuristic and request admin privileges
+OutFile "spad-setup.exe"
\ No newline at end of file
index ce3469f3cda434e3f47d9011cbf29581308a6338..3cb8a478456a803bd2375c8f07c6726571591d18 100644 (file)
@@ -441,7 +441,7 @@ Section $Name_Section01 SEC01
 
   !insertmacro CloseUninstallLog
 
-  ; Add VLC to "recomended programs" for the following extensions
+  ; Add VLC to "recommended programs" for the following extensions
   WriteRegStr HKCR Applications\vlc.exe "" ""
   WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
   WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
@@ -459,6 +459,11 @@ Section $Name_Section01 SEC01
   WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
+  WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
+  WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
+  WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
+  WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
+  WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
 
   lbl_done:
 SectionEnd
@@ -870,6 +875,7 @@ Section "un.$Name_Section91" SEC91
   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
   DeleteRegKey HKLM Software\Clients\Media\VLC
+  DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
   DeleteRegKey HKCR "VLC.MediaFile"
 
   DeleteRegKey HKLM \