From 875e6992568d3275a4261d0e9ad90a8542127d66 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Thu, 8 Oct 2020 15:23:35 +1100 Subject: [PATCH] fix(windows): show version with tag in setup Fixes #3680. Note that because the installer version may differ from the Keyman version that will actually be installed, the installer version number is a bit hidden away in the Options dialog, to try and reduce potential for confusion. For example, if a user already has the installer downloaded, but a new version of Keyman is available, then by default the installer will try and download the new version rather than install the current version. --- windows/src/desktop/setup/SetupStrings.pas | 2 ++ windows/src/desktop/setup/UfrmInstallOptions.dfm | 7 +++++++ windows/src/desktop/setup/UfrmInstallOptions.pas | 4 ++++ windows/src/desktop/setup/locale/en/strings.xml | 3 +++ .../general/Keyman.System.UpdateCheckResponse.pas | 13 +++++++++++-- 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/windows/src/desktop/setup/SetupStrings.pas b/windows/src/desktop/setup/SetupStrings.pas index 503a1147d3..e75122ab75 100644 --- a/windows/src/desktop/setup/SetupStrings.pas +++ b/windows/src/desktop/setup/SetupStrings.pas @@ -85,6 +85,8 @@ type ssOptionsPackageLanguageAssociation, ssOptionsDefaultLanguage, + ssInstallerVersion, + { Download dialog } ssDownloadingTitle, diff --git a/windows/src/desktop/setup/UfrmInstallOptions.dfm b/windows/src/desktop/setup/UfrmInstallOptions.dfm index b30731d206..776a467991 100644 --- a/windows/src/desktop/setup/UfrmInstallOptions.dfm +++ b/windows/src/desktop/setup/UfrmInstallOptions.dfm @@ -74,6 +74,13 @@ object frmInstallOptions: TfrmInstallOptions Font.Style = [fsBold] ParentFont = False end + object lblInstallerVersion: TLabel + Left = 8 + Top = 358 + Width = 102 + Height = 16 + Caption = 'lblInstallerVersion' + end object chkStartWithWindows: TCheckBox Left = 8 Top = 100 diff --git a/windows/src/desktop/setup/UfrmInstallOptions.pas b/windows/src/desktop/setup/UfrmInstallOptions.pas index 46f130c4a6..a9ebe80d35 100644 --- a/windows/src/desktop/setup/UfrmInstallOptions.pas +++ b/windows/src/desktop/setup/UfrmInstallOptions.pas @@ -48,6 +48,7 @@ type lblDefaultKeymanSettings: TLabel; lblSelectModulesToInstall: TLabel; lblAssociatedKeyboardLanguage: TLabel; + lblInstallerVersion: TLabel; procedure FormCreate(Sender: TObject); procedure cmdOKClick(Sender: TObject); private @@ -97,6 +98,7 @@ implementation uses bootstrapmain, + KeymanVersion, SetupStrings; { TfrmInstallOptions } @@ -125,6 +127,8 @@ begin chkCheckForUpdates.Visible := FAllowOptions; chkStartWithWindows.Visible := FAllowOptions; + lblInstallerVersion.Caption := FInstallInfo.Text(ssInstallerVersion, [KeymanVersion.CKeymanVersionInfo.VersionWithTag]); + SetupDynamicOptions; end; diff --git a/windows/src/desktop/setup/locale/en/strings.xml b/windows/src/desktop/setup/locale/en/strings.xml index b2a7de5765..4859c96b16 100644 --- a/windows/src/desktop/setup/locale/en/strings.xml +++ b/windows/src/desktop/setup/locale/en/strings.xml @@ -55,6 +55,9 @@ Restart now? Upgrade keyboards installed with older versions to version $VERSION Share anonymous usage statistics with keyman.com + + Setup version: %0:s + Install $APPNAME %0:s diff --git a/windows/src/global/delphi/general/Keyman.System.UpdateCheckResponse.pas b/windows/src/global/delphi/general/Keyman.System.UpdateCheckResponse.pas index f90d04324e..ffa876b04b 100644 --- a/windows/src/global/delphi/general/Keyman.System.UpdateCheckResponse.pas +++ b/windows/src/global/delphi/general/Keyman.System.UpdateCheckResponse.pas @@ -89,8 +89,17 @@ begin FNewVersion := node.Values['version'].Value; FFileName := node.Values['file'].Value; FInstallURL := node.Values['url'].Value; - FInstallSize := (node.Values['size'] as TJSONNumber).AsInt64; - FStatus := ucrsUpdateReady; + if node.Values['size'] is TJSONNumber then + begin + FInstallSize := (node.Values['size'] as TJSONNumber).AsInt64; + FStatus := ucrsUpdateReady; + end + else + begin + FInstallSize := 0; + FStatus := ucrsNoUpdate; + FErrorMessage := 'No valid updates found.'; + end; end else begin