fix(windows): combine install and installnow frms

This commit is contained in:
rc-swag 2025-03-24 10:43:36 +10:00
parent 3b72fc0929
commit 49c077485e
8 changed files with 18 additions and 114 deletions

View file

@ -182,7 +182,6 @@ uses
Keyman.System.UpdateStateMachine in 'main\Keyman.System.UpdateStateMachine.pas',
Keyman.System.DownloadUpdate in 'main\Keyman.System.DownloadUpdate.pas',
Keyman.System.ExecutionHistory in '..\..\..\..\common\windows\delphi\general\Keyman.System.ExecutionHistory.pas',
Keyman.Configuration.UI.UfrmStartInstallNow in 'main\Keyman.Configuration.UI.UfrmStartInstallNow.pas' {frmInstallNow},
Keyman.Configuration.UI.UfrmStartInstall in 'main\Keyman.Configuration.UI.UfrmStartInstall.pas' {frmStartInstall};
{$R VERSION.RES}

View file

@ -354,9 +354,6 @@
<DCCReference Include="main\Keyman.System.UpdateStateMachine.pas"/>
<DCCReference Include="main\Keyman.System.DownloadUpdate.pas"/>
<DCCReference Include="..\..\..\..\common\windows\delphi\general\Keyman.System.ExecutionHistory.pas"/>
<DCCReference Include="main\Keyman.Configuration.UI.UfrmStartInstallNow.pas">
<Form>frmInstallNow</Form>
</DCCReference>
<DCCReference Include="main\Keyman.Configuration.UI.UfrmStartInstall.pas">
<Form>frmStartInstall</Form>
</DCCReference>

View file

@ -16,7 +16,7 @@ object frmStartInstall: TfrmStartInstall
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object lblInstallUpdate: TLabel
object lblUpdateMessage: TLabel
Left = 111
Top = 113
Width = 205

View file

@ -25,14 +25,15 @@ type
TfrmStartInstall = class(TfrmKeymanBase)
cmdInstall: TButton;
cmdLater: TButton;
lblInstallUpdate: TLabel;
lblUpdateMessage: TLabel;
imgKeymanLogo: TImage;
procedure FormCreate(Sender: TObject);
private
FRestartRequired: Boolean;
public
constructor Create(AOwner: TComponent; const RestartRequired: Boolean); reintroduce;
end;
implementation
uses
MessageIdentifiers,
@ -40,12 +41,21 @@ uses
{$R *.dfm}
constructor TfrmStartInstall.Create(AOwner: TComponent; const RestartRequired: Boolean);
begin
inherited Create(AOwner);
FRestartRequired := RestartRequired;
end;
procedure TfrmStartInstall.FormCreate(Sender: TObject);
begin
inherited;
cmdInstall.Caption := MsgFromId(S_Update_Now);
cmdLater.Caption := MsgFromId(S_Later);
lblInstallUpdate.Caption := MsgFromId(S_Ready_To_Install);
if FRestartRequired then
lblUpdateMessage.Caption := MsgFromId(S_Update_Restart_Req)
else
lblUpdateMessage.Caption := MsgFromId(S_Ready_To_Install);
end;
end.

View file

@ -1,52 +0,0 @@
object frmStartInstallNow: TfrmStartInstallNow
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Keyman Update'
ClientHeight = 164
ClientWidth = 354
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object lblUpdateMessage: TLabel
Left = 16
Top = 32
Width = 323
Height = 19
Caption = 'Updating now will require a computer restart.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object cmdInstall: TButton
Left = 147
Top = 120
Width = 75
Height = 25
Caption = 'Update'
ModalResult = 1
TabOrder = 0
end
object cmdLater: TButton
Left = 247
Top = 120
Width = 75
Height = 25
Caption = 'Close'
ModalResult = 8
TabOrder = 1
end
end

View file

@ -1,50 +0,0 @@
{
Keyman is copyright (C) SIL Global. MIT License.
// TODO: #12887 Localise all the labels and captions.
}
unit Keyman.Configuration.UI.UfrmStartInstallNow;
interface
uses
System.Classes,
System.SysUtils,
System.Variants,
Vcl.Controls,
Vcl.Dialogs,
Vcl.ExtCtrls,
Vcl.Forms,
Vcl.Graphics,
Vcl.StdCtrls,
Winapi.Messages,
Winapi.Windows,
UfrmKeymanBase,
UserMessages;
type
TfrmStartInstallNow = class(TfrmKeymanBase)
cmdInstall: TButton;
cmdLater: TButton;
lblUpdateMessage: TLabel;
procedure FormCreate(Sender: TObject);
private
public
end;
implementation
uses
MessageIdentifiers,
MessageIdentifierConsts;
{$R *.dfm}
procedure TfrmStartInstallNow.FormCreate(Sender: TObject);
begin
inherited;
cmdInstall.Caption := MsgFromId(S_Update);
cmdLater.Caption := MsgFromId(S_Button_Close);
lblUpdateMessage.Caption := MsgFromId(S_Update_Restart_Req);
end;
end.

View file

@ -194,7 +194,7 @@ uses
Keyman.Configuration.System.HttpServer.App.ConfigMain,
Keyman.Configuration.UI.InstallFile,
Keyman.Configuration.UI.UfrmSettingsManager,
Keyman.Configuration.UI.UfrmStartInstallNow,
Keyman.Configuration.UI.UfrmStartInstall,
RegistryKeys,
SupportXMLRenderer,
UfrmChangeHotkey,
@ -816,13 +816,13 @@ procedure TfrmMain.Update_ApplyNow;
var
ShellPath : string;
FResult, InstallNow: Boolean;
frmStartInstallNow: TfrmStartInstallNow;
frmStartInstallNow: TfrmStartInstall;
begin
InstallNow := True;
// Confirm User is ok that this will require a reset
if HasKeymanRun then
begin
frmStartInstallNow := TfrmStartInstallNow.Create(nil);
frmStartInstallNow := TfrmStartInstall.Create(nil, true);
try
if frmStartInstallNow.ShowModal = mrOk then
InstallNow := True

View file

@ -673,7 +673,7 @@ begin
(FMode in [fmStart, fmSplash, fmMain, fmAbout,
fmHelp, fmShowHelp, fmSettings, fmBoot]) then
begin
frmStartInstall := TfrmStartInstall.Create(nil);
frmStartInstall := TfrmStartInstall.Create(nil, false);
try
Result := frmStartInstall.ShowModal = mrOk;
finally