From e2dc3282a6aaa1eeda71436c7f4135972e59d79f Mon Sep 17 00:00:00 2001 From: Robert Strong Date: Wed, 19 Mar 2014 10:40:04 -0700 Subject: [PATCH] Bug 799215 - Stub installer's dual progress bars are confusing. Use a single progress bar for both. ui-r=philipp, r=bbondy --- browser/branding/aurora/branding.nsi | 1 - browser/branding/nightly/branding.nsi | 1 - browser/branding/official/branding.nsi | 1 - browser/branding/unofficial/branding.nsi | 1 - browser/installer/windows/nsis/stub.nsi | 115 +++++++++--------- .../en-US/installer/nsisstrings.properties | 6 +- .../mozapps/installer/windows/nsis/common.nsh | 67 +++++++--- 7 files changed, 113 insertions(+), 79 deletions(-) diff --git a/browser/branding/aurora/branding.nsi b/browser/branding/aurora/branding.nsi index fcabfa025b0..8843324e95a 100644 --- a/browser/branding/aurora/branding.nsi +++ b/browser/branding/aurora/branding.nsi @@ -42,4 +42,3 @@ !define OPTIONS_BKGRD_COLOR 0x0F1B26 !define INSTALL_BLURB_TEXT_COLOR 0xFFFFFF !define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0xFFFFFF -!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0xA1AAB3 diff --git a/browser/branding/nightly/branding.nsi b/browser/branding/nightly/branding.nsi index 3669d6b38ff..fb5b57d7ef5 100644 --- a/browser/branding/nightly/branding.nsi +++ b/browser/branding/nightly/branding.nsi @@ -42,4 +42,3 @@ !define OPTIONS_BKGRD_COLOR 0x0F1B26 !define INSTALL_BLURB_TEXT_COLOR 0xFFFFFF !define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0xFFFFFF -!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0xA1AAB3 diff --git a/browser/branding/official/branding.nsi b/browser/branding/official/branding.nsi index ef6e8a00f56..94ac2121d96 100644 --- a/browser/branding/official/branding.nsi +++ b/browser/branding/official/branding.nsi @@ -46,4 +46,3 @@ !define OPTIONS_BKGRD_COLOR 0xF0F0F0 !define INSTALL_BLURB_TEXT_COLOR 0x666666 !define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0x666666 -!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0x999999 diff --git a/browser/branding/unofficial/branding.nsi b/browser/branding/unofficial/branding.nsi index e58cab9c394..dad4f29b207 100644 --- a/browser/branding/unofficial/branding.nsi +++ b/browser/branding/unofficial/branding.nsi @@ -42,4 +42,3 @@ !define OPTIONS_BKGRD_COLOR 0x0F1B26 !define INSTALL_BLURB_TEXT_COLOR 0xFFFFFF !define INSTALL_PROGRESS_TEXT_COLOR_NORMAL 0xFFFFFF -!define INSTALL_PROGRESS_TEXT_COLOR_FADED 0xA1AAB3 diff --git a/browser/installer/windows/nsis/stub.nsi b/browser/installer/windows/nsis/stub.nsi index 245a0c55c06..1efd033debc 100644 --- a/browser/installer/windows/nsis/stub.nsi +++ b/browser/installer/windows/nsis/stub.nsi @@ -21,12 +21,9 @@ RequestExecutionLevel user !addplugindir ./ Var Dialog -Var ProgressbarDownload -Var ProgressbarInstall -Var LabelDownloadingDown -Var LabelDownloadingInProgress -Var LabelInstallingInProgress -Var LabelInstallingToBeDone +Var Progressbar +Var LabelDownloading +Var LabelInstalling Var LabelFreeSpace Var CheckboxSetAsDefault Var CheckboxShortcutOnBar ; Used for Quicklaunch or Taskbar as appropriate @@ -63,6 +60,7 @@ Var InitialInstallDir Var HandleDownload Var CanSetAsDefault Var InstallCounterStep +Var InstallStepSize Var TmpVal Var ExitCode @@ -1101,40 +1099,22 @@ Function createInstall ShowWindow $BitmapBlurb3 ${SW_HIDE} ShowWindow $LabelBlurb3 ${SW_HIDE} - nsDialogs::CreateControl /NOUNLOAD STATIC ${DEFAULT_STYLES}|${SS_SUNKEN} 0 260u 166u 1u 30u "" - Pop $0 - - ${NSD_CreateLabelCenter} 103u 180u 157u 20u "$(DOWNLOADING_IN_PROGRESS)" - Pop $LabelDownloadingInProgress - SendMessage $LabelDownloadingInProgress ${WM_SETFONT} $FontNormal 0 - SetCtlColors $LabelDownloadingInProgress ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent - - ${NSD_CreateLabelCenter} 103u 180u 157u 20u "$(DOWNLOADING_DONE)" - Pop $LabelDownloadingDown - SendMessage $LabelDownloadingDown ${WM_SETFONT} $FontItalic 0 - SetCtlColors $LabelDownloadingDown ${INSTALL_PROGRESS_TEXT_COLOR_FADED} transparent - ShowWindow $LabelDownloadingDown ${SW_HIDE} - - ${NSD_CreateLabelCenter} 260uu 180u 84u 20u "$(INSTALLING_TO_BE_DONE)" - Pop $LabelInstallingToBeDone - SendMessage $LabelInstallingToBeDone ${WM_SETFONT} $FontItalic 0 - SetCtlColors $LabelInstallingToBeDone ${INSTALL_PROGRESS_TEXT_COLOR_FADED} transparent - - ${NSD_CreateLabelCenter} 260uu 180u 84u 20u "$(INSTALLING_IN_PROGRESS)" - Pop $LabelInstallingInProgress - SendMessage $LabelInstallingInProgress ${WM_SETFONT} $FontNormal 0 - SetCtlColors $LabelInstallingInProgress ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent - ShowWindow $LabelInstallingInProgress ${SW_HIDE} - - ${NSD_CreateProgressBar} 103u 166u 157u 9u "" - Pop $ProgressbarDownload - ${NSD_AddStyle} $ProgressbarDownload ${PBS_MARQUEE} - SendMessage $ProgressbarDownload ${PBM_SETMARQUEE} 1 \ + ${NSD_CreateProgressBar} 103u 166u 241u 9u "" + Pop $Progressbar + ${NSD_AddStyle} $Progressbar ${PBS_MARQUEE} + SendMessage $Progressbar ${PBM_SETMARQUEE} 1 \ ${ProgressbarMarqueeIntervalMS} ; start=1|stop=0 interval(ms)=+N - ${NSD_CreateProgressBar} 260u 166u 84u 9u "" - Pop $ProgressbarInstall - SendMessage $ProgressbarInstall ${PBM_SETRANGE32} 0 ${InstallProgresSteps} + ${NSD_CreateLabelCenter} 103u 180u 241u 20u "$(DOWNLOADING_LABEL)" + Pop $LabelDownloading + SendMessage $LabelDownloading ${WM_SETFONT} $FontNormal 0 + SetCtlColors $LabelDownloading ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent + + ${NSD_CreateLabelCenter} 103u 180u 241u 20u "$(INSTALLING_LABEL)" + Pop $LabelInstalling + SendMessage $LabelInstalling ${WM_SETFONT} $FontNormal 0 + SetCtlColors $LabelInstalling ${INSTALL_PROGRESS_TEXT_COLOR_NORMAL} transparent + ShowWindow $LabelInstalling ${SW_HIDE} ${NSD_CreateBitmap} ${APPNAME_BMP_EDGE_DU} ${APPNAME_BMP_TOP_DU} \ ${APPNAME_BMP_WIDTH_DU} ${APPNAME_BMP_HEIGHT_DU} "" @@ -1247,8 +1227,8 @@ Function OnDownload IntOp $DownloadRetryCount $DownloadRetryCount + 1 ${If} "$DownloadReset" != "true" StrCpy $DownloadedBytes "0" - ${NSD_AddStyle} $ProgressbarDownload ${PBS_MARQUEE} - SendMessage $ProgressbarDownload ${PBM_SETMARQUEE} 1 \ + ${NSD_AddStyle} $Progressbar ${PBS_MARQUEE} + SendMessage $Progressbar ${PBM_SETMARQUEE} 1 \ ${ProgressbarMarqueeIntervalMS} ; start=1|stop=0 interval(ms)=+N ${EndIf} InetBgDL::Get /RESET /END @@ -1302,9 +1282,13 @@ Function OnDownload StrCpy $DownloadSizeBytes "$4" System::Int64Op $4 / 2 Pop $HalfOfDownload - SendMessage $ProgressbarDownload ${PBM_SETMARQUEE} 0 0 ; start=1|stop=0 interval(ms)=+N - ${RemoveStyle} $ProgressbarDownload ${PBS_MARQUEE} - SendMessage $ProgressbarDownload ${PBM_SETRANGE32} 0 $DownloadSizeBytes + System::Int64Op $HalfOfDownload / ${InstallProgresSteps} + Pop $InstallStepSize + SendMessage $Progressbar ${PBM_SETMARQUEE} 0 0 ; start=1|stop=0 interval(ms)=+N + ${RemoveStyle} $Progressbar ${PBS_MARQUEE} + System::Int64Op $HalfOfDownload + $DownloadSizeBytes + Pop $R9 + SendMessage $Progressbar ${PBM_SETRANGE32} 0 $R9 ${EndIf} ; Don't update the status until after the download starts @@ -1361,12 +1345,14 @@ Function OnDownload LockWindow on ; Update the progress bars first in the UI change so they take affect ; before other UI changes. - SendMessage $ProgressbarDownload ${PBM_SETPOS} $DownloadSizeBytes 0 - SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0 - ShowWindow $LabelDownloadingInProgress ${SW_HIDE} - ShowWindow $LabelInstallingToBeDone ${SW_HIDE} - ShowWindow $LabelInstallingInProgress ${SW_SHOW} - ShowWindow $LabelDownloadingDown ${SW_SHOW} + SendMessage $Progressbar ${PBM_SETPOS} $DownloadSizeBytes 0 + System::Int64Op $InstallStepSize * ${InstallProgressFirstStep} + Pop $R9 + SendMessage $Progressbar ${PBM_SETSTEP} $R9 0 + SendMessage $Progressbar ${PBM_STEPIT} 0 0 + SendMessage $Progressbar ${PBM_SETSTEP} $InstallStepSize 0 + ShowWindow $LabelDownloading ${SW_HIDE} + ShowWindow $LabelInstalling ${SW_SHOW} ShowWindow $LabelBlurb2 ${SW_HIDE} ShowWindow $BitmapBlurb2 ${SW_HIDE} ShowWindow $LabelBlurb3 ${SW_SHOW} @@ -1476,7 +1462,7 @@ Function OnDownload LockWindow off ${EndIf} StrCpy $DownloadedBytes "$3" - SendMessage $ProgressbarDownload ${PBM_SETPOS} $3 0 + SendMessage $Progressbar ${PBM_SETPOS} $3 0 ${EndIf} ${EndIf} FunctionEnd @@ -1511,7 +1497,7 @@ Function StartInstall IntOp $InstallCounterStep $InstallCounterStep + 1 LockWindow on - SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0 + SendMessage $Progressbar ${PBM_STEPIT} 0 0 LockWindow off Exec "$\"$PLUGINSDIR\download.exe$\" /INI=$PLUGINSDIR\${CONFIG_INI}" @@ -1530,7 +1516,7 @@ Function CheckInstall Return ${EndIf} - SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0 + SendMessage $Progressbar ${PBM_STEPIT} 0 0 ${If} ${FileExists} "$INSTDIR\install.log" Delete "$INSTDIR\install.tmp" @@ -1549,26 +1535,32 @@ Function CheckInstall Delete "$PLUGINSDIR\${CONFIG_INI}" System::Call "kernel32::GetTickCount()l .s" Pop $EndInstallPhaseTickCount + System::Int64Op $InstallStepSize * 20 + Pop $InstallStepSize + SendMessage $Progressbar ${PBM_SETSTEP} $InstallStepSize 0 ${NSD_CreateTimer} FinishInstall ${InstallIntervalMS} ${EndUnless} ${EndIf} FunctionEnd Function FinishInstall - ; The full installer has complete but we still need to finish the progress - ; bar so increase the size of the step + ; The full installer has completed but the progress bar still needs to finish + ; so increase the size of the step. IntOp $InstallCounterStep $InstallCounterStep + 20 ${If} ${InstallProgresSteps} < $InstallCounterStep StrCpy $InstallCounterStep "${InstallProgresSteps}" ${EndIf} - SendMessage $ProgressbarInstall ${PBM_SETPOS} $InstallCounterStep 0 ${If} ${InstallProgresSteps} != $InstallCounterStep + SendMessage $Progressbar ${PBM_STEPIT} 0 0 Return ${EndIf} ${NSD_KillTimer} FinishInstall + SendMessage $Progressbar ${PBM_GETRANGE} 0 0 $R9 + SendMessage $Progressbar ${PBM_SETPOS} $R9 0 + ${If} "$CheckboxSetAsDefault" == "1" ${GetParameters} $0 ClearErrors @@ -1603,6 +1595,19 @@ Function FinishInstall StrCpy $ExitCode "${ERR_SUCCESS}" + StrCpy $InstallCounterStep 0 + ${NSD_CreateTimer} FinishProgressBar ${InstallIntervalMS} +FunctionEnd + +Function FinishProgressBar + IntOp $InstallCounterStep $InstallCounterStep + 1 + + ${If} $InstallCounterStep < 10 + Return + ${EndIf} + + ${NSD_KillTimer} FinishProgressBar + Call LaunchApp Call SendPing diff --git a/browser/locales/en-US/installer/nsisstrings.properties b/browser/locales/en-US/installer/nsisstrings.properties index ad7250c982b..01cc914970c 100644 --- a/browser/locales/en-US/installer/nsisstrings.properties +++ b/browser/locales/en-US/installer/nsisstrings.properties @@ -52,10 +52,8 @@ SEND_PING=S&end information about this installation to Mozilla BROWSE_BUTTON=B&rowse… DEST_FOLDER=Destination Folder -DOWNLOADING_IN_PROGRESS=Downloading… -DOWNLOADING_DONE=Downloaded -INSTALLING_TO_BE_DONE=Installing -INSTALLING_IN_PROGRESS=Installing… +DOWNLOADING_LABEL=Downloading $BrandShortName… +INSTALLING_LABEL=Installing $BrandShortName… SELECT_FOLDER_TEXT=Select the folder to install $BrandShortName in. diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index b027de1b86a..bd55ebab050 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -84,7 +84,9 @@ ; !define SHCNF_DWORD 0x0003 ; !define SHCNF_FLUSH 0x1000 -!define SHCNF_DWORDFLUSH 0x1003 +!ifndef SHCNF_DWORDFLUSH + !define SHCNF_DWORDFLUSH 0x1003 +!endif !ifndef SHCNE_ASSOCCHANGED !define SHCNE_ASSOCCHANGED 0x08000000 !endif @@ -949,8 +951,12 @@ !endif !macroend -!define KEY_SET_VALUE 0x0002 -!define KEY_WOW64_64KEY 0x0100 +!ifndef KEY_SET_VALUE + !define KEY_SET_VALUE 0x0002 +!endif +!ifndef KEY_WOW64_64KEY + !define KEY_WOW64_64KEY 0x0100 +!endif !ifndef HAVE_64BIT_OS !define CREATE_KEY_SAM ${KEY_SET_VALUE} !else @@ -7250,24 +7256,53 @@ ################################################################################ # Helpers for the new user interface -!define MAXDWORD 0xffffffff +!ifndef MAXDWORD + !define MAXDWORD 0xffffffff +!endif -!define DT_WORDBREAK 0x0010 -!define DT_SINGLELINE 0x0020 -!define DT_NOCLIP 0x0100 -!define DT_CALCRECT 0x0400 -!define DT_EDITCONTROL 0x2000 -!define DT_RTLREADING 0x00020000 -!define DT_NOFULLWIDTHCHARBREAK 0x00080000 +!ifndef DT_WORDBREAK + !define DT_WORDBREAK 0x0010 +!endif +!ifndef DT_SINGLELINE + !define DT_SINGLELINE 0x0020 +!endif +!ifndef DT_NOCLIP + !define DT_NOCLIP 0x0100 +!endif +!ifndef DT_CALCRECT + !define DT_CALCRECT 0x0400 +!endif +!ifndef DT_EDITCONTROL + !define DT_EDITCONTROL 0x2000 +!endif +!ifndef DT_RTLREADING + !define DT_RTLREADING 0x00020000 +!endif +!ifndef DT_NOFULLWIDTHCHARBREAK + !define DT_NOFULLWIDTHCHARBREAK 0x00080000 +!endif -!define WS_EX_NOINHERITLAYOUT 0x00100000 -!define WS_EX_LAYOUTRTL 0x00400000 +!ifndef WS_EX_NOINHERITLAYOUT + !define WS_EX_NOINHERITLAYOUT 0x00100000 +!endif +!ifndef WS_EX_LAYOUTRTL + !define WS_EX_LAYOUTRTL 0x00400000 +!endif -!define PBS_MARQUEE 0x08 +!ifndef PBS_MARQUEE + !define PBS_MARQUEE 0x08 +!endif -!define /math PBM_SETRANGE32 ${WM_USER} + 6 +!ifndef PBM_SETRANGE32 + !define PBM_SETRANGE32 0x406 +!endif +!ifndef PBM_GETRANGE + !define PBM_GETRANGE 0x407 +!endif -!define SHACF_FILESYSTEM 1 +!ifndef SHACF_FILESYSTEM + !define SHACF_FILESYSTEM 1 +!endif !define MOZ_LOADTRANSPARENT ${LR_LOADFROMFILE}|${LR_LOADTRANSPARENT}|${LR_LOADMAP3DCOLORS}