Skip to content

Commit

Permalink
Adapt installer UI strings for upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
J5lx committed Oct 1, 2023
1 parent 38fbde6 commit b4341fb
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .github/actions/create-package/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ create_package_windows() {
local basename="$(basename -s .wxl.xlf "$i")"
local locale="${basename#*_}"
local culture="${locale/_/-}"
local lcid="$(pwsh -c "(Get-Culture -Name ${culture}).lcid")"
local lcid="$(pwsh -c "(Get-Culture -Name ${culture}).LCID")"
sed "s/Culture=\"en\"/Culture=\"${culture}\"/;s/Language=\"9\"/Language=\"${lcid}\"/" ../util/installer/pencil2d.wxl > "../util/installer/pencil2d_${locale}.wxl"
tikal.bat -m -fc ../util/installer/okf_xml_wxl -ie utf-8 -oe utf-8 -sd ../util/installer -od ../util/installer "${i}"
done
Expand Down
2 changes: 1 addition & 1 deletion util/installer/pencil2d.bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
LocalizationFile="pencil2d.wxl" />
<Payload SourceFile="pencil2d.dll" bal:BAFunctions="yes" />
<!-- Translations -->
<Payload SourceFile="pencil2d_de.wxl" Name="7/thm.wxl" />
<Payload SourceFile="pencil2d_de.wxl" Name="7\thm.wxl" />
<!-- Assets -->
<Payload SourceFile="pencil2d.png" />
<Payload SourceFile="[email protected]" />
Expand Down
36 changes: 30 additions & 6 deletions util/installer/pencil2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "pathutil.h"
#include "strutil.h"
#include "thmutil.h"
#include "verutil.h"
#include "xmlutil.h"

#include "BootstrapperEngine.h"
Expand Down Expand Up @@ -121,11 +122,36 @@ class Pencil2DBAFunctions : public CBalBaseBAFunctions
__inout BOOL* pfCancel
)
{
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Trying to recover installation options from related bundle %ls.", wzBundleId);
RecoverRelatedBundleStringVariable(wzBundleId, L"InstallFolder", TRUE);
RecoverRelatedBundleNumericVariable(wzBundleId, L"DesktopShortcut");
HRESULT hr = S_OK;
LPWSTR sczVersion = NULL;

if (relationType == BOOTSTRAPPER_RELATION_UPGRADE)
{
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Trying to recover installation options from related bundle %ls.", wzBundleId);
RecoverRelatedBundleStringVariable(wzBundleId, L"InstallFolder", TRUE);
RecoverRelatedBundleNumericVariable(wzBundleId, L"DesktopShortcut");

if (m_command.action == BOOTSTRAPPER_ACTION_INSTALL)
{
hr = BalGetVersionVariable(L"WixBundleVersion", &sczVersion);
BalExitOnFailure(hr, "Failed to get bundle version.");

int nResult;
hr = VerCompareStringVersions(wzVersion, sczVersion, TRUE, &nResult);
BalExitOnFailure(hr, "Failed to compare bundle version: %ls to related bundle version: %ls.", sczVersion, wzVersion);

return __super::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel);
if (nResult < 0)
{
BalSetNumericVariable(L"UpgradeDetected", 1);
}
}
}

hr = __super::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel);

LExit:
ReleaseStr(sczVersion);
return hr;
}

virtual STDMETHODIMP OnPauseAutomaticUpdatesBegin()
Expand Down Expand Up @@ -231,7 +257,6 @@ class Pencil2DBAFunctions : public CBalBaseBAFunctions
{
hr = BalSetStringVariable(wzVariable, wzValue, fFormatted);
BalExitOnFailure(hr, "Failed to set variable %ls to recovered value %ls.", wzVariable, wzValue);
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Recovered related bundle variable %ls: %ls.", wzVariable, wzValue);
}

LExit:
Expand All @@ -256,7 +281,6 @@ class Pencil2DBAFunctions : public CBalBaseBAFunctions

hr = BalSetNumericVariable(wzVariable, llValue);
BalExitOnFailure(hr, "Failed to set variable %ls to recovered value %lld.", wzVariable, llValue);
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Recovered related bundle variable %ls: %lld.", wzVariable, llValue);

LExit:
ReleaseStr(wzValue);
Expand Down
17 changes: 11 additions & 6 deletions util/installer/pencil2d.thm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

<Window Width="640" Height="413" HexStyle="100a0000" FontId="Normal" Caption="#(loc.Caption)">
<ImageControl X="20" Y="20" Width="600" Height="175" ImageId="pencil2d" Visible="yes"/>
<Label Name="InstallVersion" X="20" Y="-22" Width="246" Height="17" FontId="Normal" DisablePrefix="yes" VisibleCondition="WixStdBAShowVersion">
<Text>#(loc.InstallVersion)</Text>
<Text Condition="NightlyBuildNumber AND NightlyBuildTimestamp">#(loc.InstallVersionNightly)</Text>
<Label Name="Version" X="20" Y="-22" Width="246" Height="17" FontId="Normal" DisablePrefix="yes" VisibleCondition="WixStdBAShowVersion">
<Text>#(loc.Version)</Text>
<Text Condition="NightlyBuildNumber AND NightlyBuildTimestamp">#(loc.VersionNightly)</Text>
</Label>

<Page Name="Loading">
Expand All @@ -28,7 +28,10 @@
<Page Name="Install">
<Checkbox Name="EulaAcceptCheckbox" X="95" Y="215" Width="450" Height="17" TabStop="yes" FontId="Normal" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>
<Hypertext Name="EulaHyperlink" X="111" Y="238" Width="200" Height="17" TabStop="yes" FontId="Normal" HideWhenDisabled="yes">&lt;a href=&quot;#&quot;&gt;#(loc.InstallLicenseLinkText)&lt;/a&gt;</Hypertext>
<Button Name="InstallButton" X="195" Y="295" Width="250" Height="40" TabStop="yes" FontId="Normal">#(loc.InstallInstallButton)</Button>
<Button Name="InstallButton" X="195" Y="295" Width="250" Height="40" TabStop="yes" FontId="Normal">
<Text>#(loc.InstallInstallButton)</Text>
<Text Condition="UpgradeDetected">#(loc.InstallUpgradeButton)</Text>
</Button>
<Button Name="OptionsButton" X="-20" Y="-24" Width="16" Height="16" TabStop="yes" FontId="Normal" VisibleCondition="NOT WixStdBASuppressOptionsUI">
<ButtonImage ImageId="cog" />
<ButtonHoverImage ImageId="cog-hover" />
Expand Down Expand Up @@ -72,7 +75,8 @@
<Text Condition="WixBundleAction = 2">#(loc.SuccessLayoutText)</Text>
<Text Condition="WixBundleAction = 3 OR WixBundleAction = 4">#(loc.SuccessUninstallText)</Text>
<Text Condition="WixBundleAction = 5">#(loc.SuccessCacheText)</Text>
<Text Condition="WixBundleAction = 6">#(loc.SuccessInstallText)</Text>
<Text Condition="WixBundleAction = 6 AND NOT UpgradeDetected">#(loc.SuccessInstallText)</Text>
<Text Condition="WixBundleAction = 6 AND UpgradeDetected">#(loc.SuccessUpgradeText)</Text>
<Text Condition="WixBundleAction = 7">#(loc.SuccessModifyText)</Text>
<Text Condition="WixBundleAction = 8">#(loc.SuccessRepairText)</Text>
</Label>
Expand All @@ -89,7 +93,8 @@
<Text Condition="WixBundleAction = 2">#(loc.FailureLayoutText)</Text>
<Text Condition="WixBundleAction = 3 OR WixBundleAction = 4">#(loc.FailureUninstallText)</Text>
<Text Condition="WixBundleAction = 5">#(loc.FailureCacheText)</Text>
<Text Condition="WixBundleAction = 6">#(loc.FailureInstallText)</Text>
<Text Condition="WixBundleAction = 6 AND NOT UpgradeDetected">#(loc.FailureInstallText)</Text>
<Text Condition="WixBundleAction = 6 AND UpgradeDetected">#(loc.FailureUpgradeText)</Text>
<Text Condition="WixBundleAction = 7">#(loc.FailureModifyText)</Text>
<Text Condition="WixBundleAction = 8">#(loc.FailureRepairText)</Text>
</Label>
Expand Down
7 changes: 5 additions & 2 deletions util/installer/pencil2d.wxl
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
<String Id="ExecuteUpgradePackagesMessage" Value="Upgrading packages" />
<!-- Theme -->
<String Id="Caption" Value="[WixBundleName] Setup" />
<String Id="Version" Value="Version [WixBundleVersion]" />
<String Id="VersionNightly" Value="Build [NightlyBuildNumber] ([NightlyBuildTimestamp])" />
<String Id="CheckingForUpdatesLabel" Value="Checking for updates" />
<String Id="UpdateButton" Value="&amp;Update to version [WixStdBAUpdateAvailable]" />
<String Id="HelpText" Value="/install | /repair | /uninstall | /layout [directory] &#x2013; install, repair, uninstall or create a complete local copy of the bundle in directory.&#xA;&#xA;/passive | /quiet &#x2013; suppress interactive prompts or both UI and prompts.&#xA;/norestart &#x2013; suppress any attempts to restart. By default UI will prompt before restart.&#xA;/log [logfile] &#x2013; log to a custom file. By default a log file is created in %TEMP%.&#xA;&#xA;InstallFolder=[directory] | DesktopShortcut=[0|1] &#x2013; Overwrite installation options." />
<String Id="InstallVersion" Value="Version [WixBundleVersion]" />
<String Id="InstallVersionNightly" Value="Build [NightlyBuildNumber] ([NightlyBuildTimestamp])" />
<String Id="InstallAcceptCheckbox" Value="I &amp;accept the terms and conditions of the GNU General Public License, version 2" />
<String Id="InstallLicenseLinkText" Value="View license terms" />
<String Id="InstallInstallButton" Value="&amp;Install [WixBundleName]" />
<String Id="InstallUpgradeButton" Value="&amp;Upgrade [WixBundleName]" />
<String Id="InstallOptionsButton" Value="Options" />
<String Id="OptionsLocationLabel" Value="Install location:" />
<String Id="OptionsBrowseButton" Value="&amp;Browse" />
Expand All @@ -45,6 +46,7 @@
<String Id="SuccessUninstallText" Value="[WixBundleName] was successfully uninstalled." />
<String Id="SuccessCacheText" Value="[WixBundleName] was successfully cached." />
<String Id="SuccessInstallText" Value="[WixBundleName] was successfully installed." />
<String Id="SuccessUpgradeText" Value="[WixBundleName] was successfully upgraded." />
<String Id="SuccessModifyText" Value="[WixBundleName] was successfully modified." />
<String Id="SuccessRepairText" Value="[WixBundleName] was successfully repaired." />
<String Id="SuccessRestartText" Value="To start using [WixBundleName], please restart your computer." />
Expand All @@ -56,6 +58,7 @@
<String Id="FailureUninstallText" Value="Failed to uninstall [WixBundleName]." />
<String Id="FailureCacheText" Value="Failed to cache [WixBundleName]." />
<String Id="FailureInstallText" Value="Failed to install [WixBundleName]." />
<String Id="FailureUpgradeText" Value="Failed to upgrade [WixBundleName]." />
<String Id="FailureModifyText" Value="Failed to modify [WixBundleName]." />
<String Id="FailureRepairText" Value="Failed to repair [WixBundleName]." />
<String Id="FailureHyperlinkLogText" Value="One or more issues caused the operation to fail. Please fix the issues and then retry. For more information see the &lt;a href=&quot;#&quot;&gt;log file&lt;/a&gt;." />
Expand Down
Loading

0 comments on commit b4341fb

Please sign in to comment.