From 76b23b097263612334ba5df1d276d035c9509999 Mon Sep 17 00:00:00 2001 From: Hien To Date: Tue, 1 Oct 2024 16:32:01 +0700 Subject: [PATCH] fix: Installer progress bar should not 100% while downloading dependencies --- engine/templates/windows/installer-beta.iss | 22 ++++++++++++++++++- .../templates/windows/installer-nightly.iss | 22 ++++++++++++++++++- engine/templates/windows/installer.iss | 22 ++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/engine/templates/windows/installer-beta.iss b/engine/templates/windows/installer-beta.iss index 56feecd6e..71119a182 100644 --- a/engine/templates/windows/installer-beta.iss +++ b/engine/templates/windows/installer-beta.iss @@ -39,6 +39,13 @@ var ResultCode: Integer; begin ExpandedAppDir := ExpandConstant('{app}'); + + // Set the maximum value for the progress bar to 100 (representing 100%) + WizardForm.ProgressGauge.Max := 100; + + // Set the progress bar to 80% + WizardForm.ProgressGauge.Position := 80; + WizardForm.ProgressGauge.Update; // Add {app} to PATH CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]); @@ -48,15 +55,28 @@ begin WizardForm.StatusLabel.Caption := 'Downloading llama.cpp engine and dependencies ...'; WizardForm.StatusLabel.Update; + // Set the progress bar to 85% after adding to PATH + WizardForm.ProgressGauge.Position := 85; + WizardForm.ProgressGauge.Update; + // Download llamacpp engine by default CortexInstallCmd := Format('"%s\cortex-beta.exe" engines install cortex.llamacpp', [ExpandedAppDir]); Exec('cmd.exe', '/C ' + CortexInstallCmd, '', SW_HIDE, ewWaitUntilTerminated, ResultCode); - // Clear the status message after completion + // Set the progress bar to 90% after downloading the engine + WizardForm.ProgressGauge.Position := 90; + WizardForm.ProgressGauge.Update; + + // Clear status message after completion WizardForm.StatusLabel.Caption := ''; WizardForm.StatusLabel.Update; + + // Set the progress bar to 100% after completion + WizardForm.ProgressGauge.Position := 100; + WizardForm.ProgressGauge.Update; end; + procedure DeleteCurrentUserCortexFolderAndConfig; var UserCortexFolder: String; diff --git a/engine/templates/windows/installer-nightly.iss b/engine/templates/windows/installer-nightly.iss index 9e5ce68d0..80c5b6358 100644 --- a/engine/templates/windows/installer-nightly.iss +++ b/engine/templates/windows/installer-nightly.iss @@ -39,6 +39,13 @@ var ResultCode: Integer; begin ExpandedAppDir := ExpandConstant('{app}'); + + // Set the maximum value for the progress bar to 100 (representing 100%) + WizardForm.ProgressGauge.Max := 100; + + // Set the progress bar to 80% + WizardForm.ProgressGauge.Position := 80; + WizardForm.ProgressGauge.Update; // Add {app} to PATH CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]); @@ -48,15 +55,28 @@ begin WizardForm.StatusLabel.Caption := 'Downloading llama.cpp engine and dependencies ...'; WizardForm.StatusLabel.Update; + // Set the progress bar to 85% after adding to PATH + WizardForm.ProgressGauge.Position := 85; + WizardForm.ProgressGauge.Update; + // Download llamacpp engine by default CortexInstallCmd := Format('"%s\cortex-nightly.exe" engines install cortex.llamacpp', [ExpandedAppDir]); Exec('cmd.exe', '/C ' + CortexInstallCmd, '', SW_HIDE, ewWaitUntilTerminated, ResultCode); - // Clear the status message after completion + // Set the progress bar to 90% after downloading the engine + WizardForm.ProgressGauge.Position := 90; + WizardForm.ProgressGauge.Update; + + // Clear status message after completion WizardForm.StatusLabel.Caption := ''; WizardForm.StatusLabel.Update; + + // Set the progress bar to 100% after completion + WizardForm.ProgressGauge.Position := 100; + WizardForm.ProgressGauge.Update; end; + procedure DeleteCurrentUserCortexFolderAndConfig; var UserCortexFolder: String; diff --git a/engine/templates/windows/installer.iss b/engine/templates/windows/installer.iss index 32a0dfe09..f10125ab8 100644 --- a/engine/templates/windows/installer.iss +++ b/engine/templates/windows/installer.iss @@ -39,6 +39,13 @@ var ResultCode: Integer; begin ExpandedAppDir := ExpandConstant('{app}'); + + // Set the maximum value for the progress bar to 100 (representing 100%) + WizardForm.ProgressGauge.Max := 100; + + // Set the progress bar to 80% + WizardForm.ProgressGauge.Position := 80; + WizardForm.ProgressGauge.Update; // Add {app} to PATH CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]); @@ -48,15 +55,28 @@ begin WizardForm.StatusLabel.Caption := 'Downloading llama.cpp engine and dependencies ...'; WizardForm.StatusLabel.Update; + // Set the progress bar to 85% after adding to PATH + WizardForm.ProgressGauge.Position := 85; + WizardForm.ProgressGauge.Update; + // Download llamacpp engine by default CortexInstallCmd := Format('"%s\cortex.exe" engines install cortex.llamacpp', [ExpandedAppDir]); Exec('cmd.exe', '/C ' + CortexInstallCmd, '', SW_HIDE, ewWaitUntilTerminated, ResultCode); - // Clear the status message after completion + // Set the progress bar to 90% after downloading the engine + WizardForm.ProgressGauge.Position := 90; + WizardForm.ProgressGauge.Update; + + // Clear status message after completion WizardForm.StatusLabel.Caption := ''; WizardForm.StatusLabel.Update; + + // Set the progress bar to 100% after completion + WizardForm.ProgressGauge.Position := 100; + WizardForm.ProgressGauge.Update; end; + procedure DeleteCurrentUserCortexFolderAndConfig; var UserCortexFolder: String;