[tbb-commits] [Git][tpo/applications/tor-browser-build][main] 2 commits: MB 200: Update the Mullvad Browser Windows installer.
richard (@richard)
git at gitlab.torproject.org
Tue May 7 13:31:50 UTC 2024
richard pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
f1d5ceae by Pier Angelo Vendrame at 2024-05-07T12:17:19+00:00
MB 200: Update the Mullvad Browser Windows installer.
Changed the installation page to look like NSIS's welcome page, as
requested in the issue.
- - - - -
7bc292e1 by Pier Angelo Vendrame at 2024-05-07T12:17:19+00:00
MB 200: Update the Mullvad Browser Windows installer.
Change "Custom" with "Advanced", and "Portable" with "Standalone".
- - - - -
4 changed files:
- projects/browser/windows-installer/browser-install.nsi
- projects/browser/windows-installer/common.nsh
- projects/browser/windows-installer/defines.nsh.in
- + projects/browser/windows-installer/mullvadbrowser.bmp
Changes:
=====================================
projects/browser/windows-installer/browser-install.nsi
=====================================
@@ -10,20 +10,27 @@
!define DEFAULT_INSTALL_DIR "$LocalAppdata\${APP_DIR}\${NAME_NO_SPACES}\${UPDATE_CHANNEL}"
InstallDir "${DEFAULT_INSTALL_DIR}"
+ AutoCloseWindow true
+
;--------------------------------
; Pages
Page custom SetupType SetupTypeLeave
- Page custom CustomSetup CustomSetupLeave
+ Page custom AdvancedSetup AdvancedSetupLeave
; Disable the directory selection when updating
- !define MUI_PAGE_CUSTOMFUNCTION_PRE CustomPageDirectory
+ !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
+ !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageDirectoryShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckIfTargetDirectoryExists
+ !define MUI_PAGE_HEADER_SUBTEXT ""
!insertmacro MUI_PAGE_DIRECTORY
+ !define MUI_PAGE_CUSTOMFUNCTION_LEAVE StartBrowser
!insertmacro MUI_PAGE_INSTFILES
- !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
- !insertmacro MUI_UNPAGE_FINISH
+ ; If we want to restore the finish page in the uninstaller, we have to enable
+ ; it also for the installer (but we can still skip it by adding Quit in
+ ; StartBrowser).
+ ; !insertmacro MUI_UNPAGE_FINISH
; Languages must be defined after pages
!include "languages.nsh"
@@ -35,57 +42,86 @@
var existingInstall
; Installation settings
-var isCustomMode
-var isPortableMode
+var isAdvancedMode
+var isStandaloneMode
var createDesktopShortcut
; Variable used by the setup type page
var typeRadioStandard
-var typeRadioCustom
+var typeRadioAdvanced
var typeRadioClicked
var typeNextButton
-; Variables used in the custom setup page
-var customCheckboxPortable
-var customCheckboxDesktop
+; Variables used in the advanced setup page
+var advancedCheckboxDesktop
+var advancedCheckboxStandalone
+
+ReserveFile ${WELCOME_IMAGE}
Function .onInit
Call CheckRequirements
- !insertmacro MUI_LANGDLL_DISPLAY
+ ; Skip NSIS's language selection prompt and try to use the OS language without
+ ; further confirmations.
+
+ File /oname=$PLUGINSDIR\${WELCOME_IMAGE} "${WELCOME_IMAGE}"
ReadRegStr $existingInstall HKCU "${UNINST_KEY}" "InstallLocation"
StrCpy $createDesktopShortcut "true"
FunctionEnd
Function SetupType
- !insertmacro MUI_HEADER_TEXT "Setup Type" "Choose setup options"
- nsDialogs::Create 1018
+ ; Freely inspired by the built-in page implemented in
+ ; Contrib/Modern UI 2/Pages/Welcome.nsh.
+ ; The problem with the built-in page is that the description label fills all
+ ; the vertical space, preventing the addition of other widgets (they will be
+ ; hidden, will become visible when using Tab, but it will not be possible to
+ ; interact with them with the mouse.
+ nsDialogs::Create 1044
Pop $0
${If} $0 == error
Abort
${EndIf}
+ SetCtlColors $0 "" "${MUI_BGCOLOR}"
+
+ ${NSD_CreateBitmap} 0 0 100% 100% ""
+ Pop $0
+ ${NSD_SetBitmap} $0 $PLUGINSDIR\${WELCOME_IMAGE} $1
+
+ ${NSD_CreateLabel} 120u 10u 195u 28u "Welcome to the ${DISPLAY_NAME} Installer"
+ Pop $0
+ SetCtlColors $0 "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
+ CreateFont $2 "$(^Font)" "12" "700"
+ SendMessage $0 ${WM_SETFONT} $2 0
+
+ ${NSD_CreateLabel} 120u 45u 195u 60u "${INTRO_TEXT}"
+ Pop $0
+ SetCtlColors $0 "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
+
+ ${NSD_CreateLabel} 120u 105u 195u 12u "Installation Type"
+ Pop $0
+ SetCtlColors $0 "" ${MUI_BGCOLOR}
- ${NSD_CreateLabel} 0 0 100% 18% "Choose the type of setup you prefer."
${If} $existingInstall == ""
- ${NSD_CreateRadioButton} 0 18% 100% 6% "Standard"
+ ${NSD_CreateRadioButton} 120u 117u 160u 12u "Standard"
Pop $typeRadioStandard
- ${NSD_CreateRadioButton} 0 30% 100% 6% "Custom"
- Pop $typeRadioCustom
${Else}
- ${NSD_CreateRadioButton} 0 18% 100% 6% "Update your existing installation"
+ ${NSD_CreateRadioButton} 120u 117u 160u 12u "Update current installation"
Pop $typeRadioStandard
- ${NSD_CreateRadioButton} 0 30% 100% 6% "Portable installation"
- Pop $typeRadioCustom
${EndIf}
+ ${NSD_CreateRadioButton} 120u 129u 160u 12u "Advanced"
+ Pop $typeRadioAdvanced
+
+ SetCtlColors $typeRadioStandard "" ${MUI_BGCOLOR}
${NSD_OnClick} $typeRadioStandard SetupTypeRadioClick
- ${NSD_OnClick} $typeRadioCustom SetupTypeRadioClick
+ SetCtlColors $typeRadioAdvanced "" ${MUI_BGCOLOR}
+ ${NSD_OnClick} $typeRadioAdvanced SetupTypeRadioClick
GetDlgItem $typeNextButton $HWNDPARENT 1
; Re-check radios if the user presses back
- ${If} $isCustomMode == "true"
- StrCpy $typeRadioClicked $typeRadioCustom
+ ${If} $isAdvancedMode == "true"
+ StrCpy $typeRadioClicked $typeRadioAdvanced
${Else}
StrCpy $typeRadioClicked $typeRadioStandard
${EndIf}
@@ -93,6 +129,8 @@ Function SetupType
Call SetupTypeUpdate
nsDialogs::Show
+
+ ${NSD_FreeBitmap} $1
FunctionEnd
Function SetupTypeRadioClick
@@ -101,12 +139,12 @@ Function SetupTypeRadioClick
FunctionEnd
Function SetupTypeUpdate
- ${If} $typeRadioClicked == $typeRadioCustom
- StrCpy $isCustomMode "true"
+ ${If} $typeRadioClicked == $typeRadioAdvanced
+ StrCpy $isAdvancedMode "true"
SendMessage $typeNextButton ${WM_SETTEXT} 0 "STR:$(^NextBtn)"
${ElseIf} $typeRadioClicked == $typeRadioStandard
- StrCpy $isCustomMode "false"
- StrCpy $isPortableMode "false"
+ StrCpy $isAdvancedMode "false"
+ StrCpy $isStandaloneMode "false"
${If} $existingInstall == ""
SendMessage $typeNextButton ${WM_SETTEXT} 0 "STR:$(^InstallBtn)"
${Else}
@@ -116,79 +154,81 @@ Function SetupTypeUpdate
FunctionEnd
Function SetupTypeLeave
- ${If} $typeRadioClicked == $typeRadioCustom
- StrCpy $isCustomMode "true"
+ ${If} $typeRadioClicked == $typeRadioAdvanced
+ StrCpy $isAdvancedMode "true"
${ElseIf} $typeRadioClicked == $typeRadioStandard
- StrCpy $isCustomMode "false"
- StrCpy $isPortableMode "false"
+ StrCpy $isAdvancedMode "false"
+ StrCpy $isStandaloneMode "false"
${Else}
Abort
${EndIf}
FunctionEnd
-Function CustomSetup
- ${If} $isCustomMode != "true"
+Function AdvancedSetup
+ ${If} $isAdvancedMode != "true"
Return
${EndIf}
- !insertmacro MUI_HEADER_TEXT "Custom Setup" "Customize your setup options"
+ !insertmacro MUI_HEADER_TEXT "Advanced setup" ""
nsDialogs::Create 1018
Pop $0
${If} $0 == error
Abort
${EndIf}
- ${NSD_CreateCheckbox} 0 18% 100% 6% "Portable installation"
- Pop $customCheckboxPortable
- ${NSD_CreateCheckbox} 0 30% 100% 6% "Create a desktop shortcut"
- Pop $customCheckboxDesktop
- ${NSD_OnClick} $customCheckboxPortable CustomSetupCheckboxClick
- ${NSD_OnClick} $customCheckboxDesktop CustomSetupCheckboxClick
+ ${NSD_CreateCheckbox} 0 18% 100% 6% "Create a desktop shortcut"
+ Pop $advancedCheckboxDesktop
+ ${NSD_CreateCheckbox} 0 30% 100% 6% "Standalone installation"
+ Pop $advancedCheckboxStandalone
+ ${NSD_CreateLabel} 4% 37% 95% 50% "Choose the standalone installation if you want to install Mullvad Browser in its own dedicated folder, without adding it to the Start menu and to the list of applications."
+ Pop $0
+ ${NSD_OnClick} $advancedCheckboxStandalone AdvancedSetupCheckboxClick
+ ${NSD_OnClick} $advancedCheckboxDesktop AdvancedSetupCheckboxClick
- ${If} $existingInstall != ""
- ; If we already have an installation, this is already portable mode.
- StrCpy $isPortableMode "true"
- ${NSD_Check} $customCheckboxPortable
- EnableWindow $customCheckboxPortable 0
- ${ElseIf} $isPortableMode == "true"
- ${NSD_Check} $customCheckboxPortable
- ${EndIf}
${If} $createDesktopShortcut == "true"
- ${NSD_Check} $customCheckboxDesktop
+ ${NSD_Check} $advancedCheckboxDesktop
+ ${EndIf}
+ ${If} $existingInstall != ""
+ ; If we already have an installation, this is already standalone mode.
+ StrCpy $isStandaloneMode "true"
+ ${NSD_Check} $advancedCheckboxStandalone
+ EnableWindow $advancedCheckboxStandalone 0
+ ${ElseIf} $isStandaloneMode == "true"
+ ${NSD_Check} $advancedCheckboxStandalone
${EndIf}
nsDialogs::Show
FunctionEnd
-Function CustomSetupUpdate
- ${NSD_GetState} $customCheckboxPortable $0
+Function AdvancedSetupUpdate
+ ${NSD_GetState} $advancedCheckboxDesktop $0
${If} $0 == "${BST_CHECKED}"
- StrCpy $isPortableMode "true"
+ StrCpy $createDesktopShortcut "true"
${Else}
- StrCpy $isPortableMode "false"
+ StrCpy $createDesktopShortcut "false"
${EndIf}
- ${NSD_GetState} $customCheckboxDesktop $0
+ ${NSD_GetState} $advancedCheckboxStandalone $0
${If} $0 == "${BST_CHECKED}"
- StrCpy $createDesktopShortcut "true"
+ StrCpy $isStandaloneMode "true"
${Else}
- StrCpy $createDesktopShortcut "false"
+ StrCpy $isStandaloneMode "false"
${EndIf}
FunctionEnd
-Function CustomSetupCheckboxClick
+Function AdvancedSetupCheckboxClick
Pop $0
- Call CustomSetupUpdate
+ Call AdvancedSetupUpdate
FunctionEnd
-Function CustomSetupLeave
- Call CustomSetupUpdate
+Function AdvancedSetupLeave
+ Call AdvancedSetupUpdate
FunctionEnd
-Function CustomPageDirectory
- ${If} $isPortableMode == "true"
+Function PageDirectoryPre
+ ${If} $isStandaloneMode == "true"
StrCpy $INSTDIR "${DEFAULT_PORTABLE_DIR}"
- ; Always go through this page in portable mode.
+ ; Always go through this page in standalone mode.
Return
${ElseIf} $existingInstall != ""
; When updating, force the old directory and skip the page.
@@ -198,23 +238,29 @@ Function CustomPageDirectory
StrCpy $INSTDIR "${DEFAULT_INSTALL_DIR}"
${EndIf}
- ${If} $isCustomMode != "true"
+ ${If} $isAdvancedMode != "true"
; Standard install, use the default directory and skip the page.
Abort
${EndIf}
FunctionEnd
+Function PageDirectoryShow
+ ShowWindow $mui.DirectoryPage.Text ${SW_HIDE}
+ ShowWindow $mui.DirectoryPage.SpaceRequired ${SW_HIDE}
+ ShowWindow $mui.DirectoryPage.SpaceAvailable ${SW_HIDE}
+FunctionEnd
+
Section "Browser" SecBrowser
SetOutPath "$INSTDIR"
- ${If} $isPortableMode == "true"
+ ${If} $isStandaloneMode == "true"
File /r "${PROGRAM_SOURCE}\*.*"
CreateShortCut "$INSTDIR\${DISPLAY_NAME}.lnk" "$INSTDIR\Browser\${EXE_NAME}"
${Else}
; Do not use a Browser directory for installs.
File /r "${PROGRAM_SOURCE}\Browser\*.*"
- ; Tell the browser we are not in portable mode anymore.
+ ; Tell the browser we are not in standalone mode anymore.
FileOpen $0 "$INSTDIR\system-install" w
FileClose $0
@@ -231,7 +277,7 @@ Section "Browser" SecBrowser
SectionEnd
Function StartBrowser
- ${If} $isPortableMode == "true"
+ ${If} $isStandaloneMode == "true"
ExecShell "open" "$INSTDIR\${DISPLAY_NAME}.lnk"
${Else}
ExecShell "open" "$INSTDIR\${EXE_NAME}"
=====================================
projects/browser/windows-installer/common.nsh
=====================================
@@ -28,6 +28,9 @@
; Support HiDPI displays
ManifestDPIAware true
+ ; Do not show "Nullsoft Install System vX.XX"
+ BrandingText " "
+
;--------------------------------
; Version information
VIProductVersion "${VERSION_WINDOWS}"
=====================================
projects/browser/windows-installer/defines.nsh.in
=====================================
@@ -22,6 +22,7 @@
[% ELSE -%]
!define ICON_NAME "[% c('var/projectname') %].ico"
[% END -%]
+ !define WELCOME_IMAGE "[% c('var/projectname') %].bmp"
[% IF c('var/mullvad-browser') -%]
; Firefox's --with-user-appdir
@@ -33,6 +34,9 @@
!define URL_ABOUT "https://mullvad.net/en/browser"
!define URL_UPDATE "https://github.com/mullvad/mullvad-browser/releases/[% c('var/torbrowser_version') %]"
!define URL_HELP "https://mullvad.net/help/tag/browser/"
+
+ ; TODO: This will likely be localized in the future.
+ !define INTRO_TEXT "Mullvad Browser is a privacy-focused web browser designed to minimize tracking and fingerprinting."
[% ELSE -%]
; Not defined for Tor Browser
!define APP_DIR "TorProject"
@@ -43,4 +47,6 @@
!define URL_ABOUT "https://www.torproject.org/"
!define URL_UPDATE "https://blog.torproject.org/new[% IF c('var/alpha') %]-alpha[% END %]-release-tor-browser-[% c('var/torbrowser_version') FILTER remove('\.') %]"
!define URL_HELP "https://tb-manual.torproject.org/"
+
+ !define INTRO_TEXT "Tor Browser. Protect yourself against tracking, surveillance, and censorship."
[% END -%]
=====================================
projects/browser/windows-installer/mullvadbrowser.bmp
=====================================
Binary files /dev/null and b/projects/browser/windows-installer/mullvadbrowser.bmp differ
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/86ad0eebbaa61aa0cfccc7e1edf54470ec6fa288...7bc292e19d944728b22fcdaa54755dcf42231fcb
--
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/86ad0eebbaa61aa0cfccc7e1edf54470ec6fa288...7bc292e19d944728b22fcdaa54755dcf42231fcb
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240507/0b96f02a/attachment-0001.htm>
More information about the tbb-commits
mailing list