Skip to content

Commit

Permalink
WinGui: Improvements to the installer.
Browse files Browse the repository at this point in the history
- Make desktop shortcuts optional.  (Choice of adding for all users, or current user now available)
- Start menu shortcuts now installs for all users by default.
- The installer for the release will now default to the same name we use on the website for ease of deployment.
  • Loading branch information
sr55 committed May 22, 2020
1 parent 06fee7e commit 3d3b664
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 22 deletions.
58 changes: 44 additions & 14 deletions win/CS/HandBrakeWPF/Installer/Installer64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,30 @@
SetCompressor lzma
ManifestDPIAware true

; MUI 1.67 compatible ------
!include "MUI.nsh"
!include WinVer.nsh

; Required for Github Actions (or local builds were inetc is not part of the installed NSIS)
; Extract inetc.zip to the HandBrake root directory into a folder called plugins.
!addplugindir /x86-ansi "..\..\..\..\..\..\plugins\Plugins\x86-ansi"

; MUI 1.67 compatible ------
!include "MUI.nsh"
!include WinVer.nsh

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "HandBrakepineapple.ico"
!define MUI_UNICON "HandBrakepineapple.ico"
; GPL is not an EULA, no need to agree to it.
!define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
!define MUI_LICENSEPAGE_TEXT_BOTTOM "You are now aware of your rights. Click Next to continue."

!define MUI_WELCOMEFINISHPAGE_BITMAP "InstallerBackground.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "doc\COPYING"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
Expand All @@ -56,7 +58,7 @@ ManifestDPIAware true
; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "HandBrake-${PRODUCT_VERSION_NUMBER}-Win_GUI.exe"
OutFile "HandBrake-${PRODUCT_VERSION_NUMBER}-x86_64-Win_GUI.exe"

!include WordFunc.nsh
!insertmacro VersionCompare
Expand Down Expand Up @@ -117,9 +119,10 @@ Function .onInit
done:
FunctionEnd

Section "HandBrake" SEC01
Section "HandBrake" SectionApp
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
SectionIn RO ; Read only, always installed

; Begin Check .NET version
StrCpy $InstallDotNET "No"
Expand Down Expand Up @@ -147,10 +150,7 @@ Section "HandBrake" SEC01
${EndIf}

; Install Files
File "HandBrake.exe"
CreateDirectory "$SMPROGRAMS\HandBrake"
CreateShortCut "$SMPROGRAMS\HandBrake\HandBrake.lnk" "$INSTDIR\HandBrake.exe"
CreateShortCut "$DESKTOP\HandBrake.lnk" "$INSTDIR\HandBrake.exe"
File "*.exe"
File "*.dll"
File "*.template"
File "*.config"
Expand Down Expand Up @@ -188,16 +188,32 @@ Section "HandBrake" SEC01
SetOutPath "$INSTDIR\ja"
SetOverwrite ifnewer
File "ja\*.*"


SetOutPath "$INSTDIR\pt-BR"
SetOverwrite ifnewer
File "pt-BR\*.*"
File "pt-BR\*.*"

; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
SetOverwrite ifnewer
File "doc\*.*"

; Start Menu Shortcut for All users.
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\HandBrake"
CreateShortCut "$SMPROGRAMS\HandBrake\HandBrake.lnk" "$INSTDIR\HandBrake.exe"
SectionEnd

Section /o "Desktop shortcut " SectionDesktop
SetShellVarContext current
CreateShortCut "$SMPROGRAMS\HandBrake\HandBrake.lnk" "$INSTDIR\HandBrake.exe"
CreateShortCut "$DESKTOP\HandBrake.lnk" "$INSTDIR\HandBrake.exe"
SectionEnd

Section "Desktop shortcut (all users)" SectionDesktopAll
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\HandBrake\HandBrake.lnk" "$INSTDIR\HandBrake.exe"
CreateShortCut "$DESKTOP\HandBrake.lnk" "$INSTDIR\HandBrake.exe"
SectionEnd

Section -AdditionalIcons
Expand All @@ -213,6 +229,13 @@ Section -Post
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
SectionEnd

; User Interface
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SectionApp} "The HandBrake Applicaiton"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDesktop} "Add a shortcut for the current user only."
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDesktopAll} "Add a shortcut for all users."
!insertmacro MUI_FUNCTION_DESCRIPTION_END


Function un.onUninstSuccess
HideWindow
Expand Down Expand Up @@ -250,7 +273,7 @@ Section Uninstall
Delete "$INSTDIR\tr\*.*"
RMDir "$INSTDIR\tr"
Delete "$INSTDIR\ja\*.*"
RMDir "$INSTDIR\ja"
RMDir "$INSTDIR\ja"
Delete "$INSTDIR\pt-BR\*.*"
RMDir "$INSTDIR\pt-BR"

Expand All @@ -264,6 +287,13 @@ Section Uninstall

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"

SetShellVarContext all
Delete "$SMPROGRAMS\HandBrake Nightly\Uninstall.lnk"
Delete "$SMPROGRAMS\HandBrake Nightly\HandBrake Nightly.lnk"
RMDir "$SMPROGRAMS\HandBrake Nightly"
Delete "$DESKTOP\HandBrake Nightly.lnk"

SetAutoClose true
SectionEnd

Expand Down
46 changes: 38 additions & 8 deletions win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ ManifestDPIAware true
; GPL is not an EULA, no need to agree to it.
!define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
!define MUI_LICENSEPAGE_TEXT_BOTTOM "You are now aware of your rights. Click Next to continue."

!define MUI_WELCOMEFINISHPAGE_BITMAP "InstallerBackground.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "doc\COPYING"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
Expand Down Expand Up @@ -116,9 +118,10 @@ Function .onInit
done:
FunctionEnd

Section "HandBrake" SEC01
Section "HandBrake" SectionApp
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
SectionIn RO ; Read only, always installed

; Begin Check .NET version
StrCpy $InstallDotNET "No"
Expand Down Expand Up @@ -147,9 +150,6 @@ Section "HandBrake" SEC01

; Install Files
File "*.exe"
CreateDirectory "$SMPROGRAMS\HandBrake Nightly"
CreateShortCut "$SMPROGRAMS\HandBrake Nightly\HandBrake Nightly.lnk" "$INSTDIR\HandBrake.exe"
CreateShortCut "$DESKTOP\HandBrake Nightly.lnk" "$INSTDIR\HandBrake.exe"
File "*.dll"
File "*.template"
File "*.config"
Expand Down Expand Up @@ -186,8 +186,8 @@ Section "HandBrake" SEC01

SetOutPath "$INSTDIR\ja"
SetOverwrite ifnewer
File "ja\*.*"

File "ja\*.*"

SetOutPath "$INSTDIR\pt-BR"
SetOverwrite ifnewer
File "pt-BR\*.*"
Expand All @@ -196,6 +196,23 @@ Section "HandBrake" SEC01
SetOutPath "$INSTDIR\doc"
SetOverwrite ifnewer
File "doc\*.*"

; Start Menu Shortcut for All users.
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\HandBrake Nightly"
CreateShortCut "$SMPROGRAMS\HandBrake Nightly\HandBrake Nightly.lnk" "$INSTDIR\HandBrake.exe"
SectionEnd

Section /o "Desktop shortcut " SectionDesktop
SetShellVarContext current
CreateShortCut "$SMPROGRAMS\HandBrake Nightly\HandBrake Nightly.lnk" "$INSTDIR\HandBrake.exe"
CreateShortCut "$DESKTOP\HandBrake Nightly.lnk" "$INSTDIR\HandBrake.exe"
SectionEnd

Section "Desktop shortcut (all users)" SectionDesktopAll
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\HandBrake Nightly\HandBrake Nightly.lnk" "$INSTDIR\HandBrake.exe"
CreateShortCut "$DESKTOP\HandBrake Nightly.lnk" "$INSTDIR\HandBrake.exe"
SectionEnd

Section -AdditionalIcons
Expand All @@ -211,6 +228,12 @@ Section -Post
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
SectionEnd

; User Interface
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SectionApp} "The HandBrake Applicaiton"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDesktop} "Add a shortcut for the current user only."
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDesktopAll} "Add a shortcut for all users."
!insertmacro MUI_FUNCTION_DESCRIPTION_END

Function un.onUninstSuccess
HideWindow
Expand Down Expand Up @@ -246,7 +269,7 @@ Section Uninstall
Delete "$INSTDIR\tr\*.*"
RMDir "$INSTDIR\tr"
Delete "$INSTDIR\ja\*.*"
RMDir "$INSTDIR\ja"
RMDir "$INSTDIR\ja"
Delete "$INSTDIR\pt-BR\*.*"
RMDir "$INSTDIR\pt-BR"

Expand All @@ -259,6 +282,13 @@ Section Uninstall

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"

SetShellVarContext all
Delete "$SMPROGRAMS\HandBrake Nightly\Uninstall.lnk"
Delete "$SMPROGRAMS\HandBrake Nightly\HandBrake Nightly.lnk"
RMDir "$SMPROGRAMS\HandBrake Nightly"
Delete "$DESKTOP\HandBrake Nightly.lnk"

SetAutoClose true
SectionEnd

Expand Down

0 comments on commit 3d3b664

Please sign in to comment.