Procházet zdrojové kódy

Allow user to abort downloads. Avoids extra built in state like on the withuserabort branch: instead requires to script to do the abort.

Also rename UpdateCurPageButtonVisibility for clarity + make it private since public isn't needed.
Martijn Laan před 5 roky
rodič
revize
8cbf81fe3a
2 změnil soubory, kde provedl 7 přidání a 8 odebrání
  1. 6 8
      Projects/Wizard.pas
  2. 1 0
      whatsnew.htm

+ 6 - 8
Projects/Wizard.pas

@@ -208,6 +208,7 @@ type
     function ShouldSkipPage(const PageID: Integer): Boolean;
     procedure UpdateComponentSizes;
     procedure UpdateComponentSizesEnum(Index: Integer; HasChildren: Boolean; Ext: LongInt);
+    procedure UpdateCurPageButtonState;
     procedure UpdatePage(const PageID: Integer);
     procedure UpdateSelectTasksPage;
     procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND;
@@ -234,7 +235,6 @@ type
     procedure IncTopDecHeight(const AControl: TControl; const Amount: Integer);
     function PageFromID(const ID: Integer): TWizardPage;
     function PageIndexFromID(const ID: Integer): Integer;
-    procedure UpdateCurPageButtonVisibility;
     procedure SetCurPage(const NewPageID: Integer);
     procedure SelectComponents(const ASelectComponents: TStringList); overload;
     procedure SelectTasks(const ASelectTasks: TStringList); overload;
@@ -1859,7 +1859,6 @@ end;
 
 function TWizardForm.PrepareToInstall(const WizardComponents, WizardTasks: TStringList): String;
 var
-  WindowDisabler: TWindowDisabler;
   CodeNeedsRestart: Boolean;
   Y: Integer;
   S: String;
@@ -1878,12 +1877,12 @@ begin
     SetCurPage(wpPreparing);
     BackButton.Visible := False;
     NextButton.Visible := False;
+    CancelButton.Enabled := False;
     if InstallMode = imSilent then begin
       SetActiveWindow(Application.Handle);  { ensure taskbar button is selected }
       WizardForm.Show;
     end;
     WizardForm.Update;
-    WindowDisabler := TWindowDisabler.Create;
     try
       DownloadTemporaryFileAllowProcessMessages := True;
       CodeNeedsRestart := False;
@@ -1891,8 +1890,7 @@ begin
       PrepareToInstallNeedsRestart := (Result <> '') and CodeNeedsRestart;
     finally
       DownloadTemporaryFileAllowProcessMessages := False;
-      WindowDisabler.Free;
-      UpdateCurPageButtonVisibility;
+      UpdateCurPageButtonState;
     end;
     Application.BringToFront;
   end;
@@ -2194,7 +2192,7 @@ begin
   Result := -1;
 end;
 
-procedure TWizardForm.UpdateCurPageButtonVisibility;
+procedure TWizardForm.UpdateCurPageButtonState;
 var
   PageIndex: Integer;
   Page: TWizardPage;
@@ -2250,7 +2248,7 @@ begin
     not(CurPageID in [wpWelcome, wpFinished]);
 
   { Set button visibility and captions }
-  UpdateCurPageButtonVisibility;
+  UpdateCurPageButtonState;
 
   BackButton.Caption := SetupMessages[msgButtonBack];
   if CurPageID = wpReady then begin
@@ -2574,7 +2572,7 @@ begin
                 if RmFoundApplications then
                   Break;  { stop on the page }
               finally
-                UpdateCurPageButtonVisibility;
+                UpdateCurPageButtonState;
               end;
             end;
           finally

+ 1 - 0
whatsnew.htm

@@ -62,6 +62,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
   </li>
   <li>Added new <tt>DownloadTemporaryFileSize</tt> support function to get the size of a file without downloading it.</li>
   <li>Added new <tt>GetSHA256OfFile</tt>, <tt>GetSHA256OfString</tt>, and <tt>GetSHA256OfUnicodeString</tt> support functions to calculate SHA-256 hashes.</li>
+  <li><b>Change in default behavior:</b> Setup no longer disables itself entirely while <tt>PrepareToInstall</tt> is running. Instead only the Cancel button is disabled.</li>
 </ul>
 <p><span class="head2">Inno Setup Preprocessor (ISPP) updates</span></p>
 <p>ISPP now uses 64-bit integers and has new functions to more easily compare version numbers:</p>