mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-28 18:41:14 +00:00
templates/windows/installer: Formatting
This commit is contained in:
parent
c9239405e2
commit
63540faf3d
1 changed files with 167 additions and 157 deletions
|
@ -84,26 +84,57 @@ Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||||
[Code]
|
[Code]
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
var
|
var
|
||||||
oPortablePageStaticChoice: TNewRadioButton;
|
oPortablePageStaticChoice: TNewRadioButton;
|
||||||
oPortablePagePortableChoice: TNewRadioButton;
|
oPortablePagePortableChoice: TNewRadioButton;
|
||||||
|
|
||||||
function FindRegistryKey(): String; forward;
|
// InnoSetup
|
||||||
function GetDefaultDirectory(Value: String): String; forward;
|
|
||||||
function GetUninstallerPath(): String; forward;
|
|
||||||
function IsUpgrade(): Boolean; forward;
|
|
||||||
function IsPortablePagePortableChoiceChecked(): Boolean; forward;
|
|
||||||
function UninstallOldVersion(): Integer; forward;
|
|
||||||
procedure OnPortablePagePortableChoiceClick(Sender: TObject); forward;
|
|
||||||
procedure OnPortablePageStaticChoiceClick(Sender: TObject); forward;
|
|
||||||
function CreatePortablePage: TWizardPage; forward;
|
|
||||||
procedure InitializeWizard; forward;
|
procedure InitializeWizard; forward;
|
||||||
function ShouldSkipPage(PageID: Integer): Boolean; forward;
|
function ShouldSkipPage(PageID: Integer): Boolean; forward;
|
||||||
function PrepareToInstall(var NeedsRestart: Boolean): String; forward;
|
function PrepareToInstall(var NeedsRestart: Boolean): String; forward;
|
||||||
|
function GetDefaultDirectory(Value: String): String; forward;
|
||||||
|
|
||||||
|
// Which installation mode is selected?
|
||||||
|
function IsPortablePagePortableChoiceChecked(): Boolean; forward;
|
||||||
|
|
||||||
|
// Other Metadata
|
||||||
|
function FindRegistryKey(): String; forward;
|
||||||
|
function GetUninstallerPath(): String; forward;
|
||||||
|
function IsUpgrade(): Boolean; forward;
|
||||||
|
function UninstallOldVersion(): Integer; forward;
|
||||||
|
|
||||||
|
// Mode Page
|
||||||
|
function CreatePortablePage: TWizardPage; forward;
|
||||||
|
procedure OnPortablePagePortableChoiceClick(Sender: TObject); forward;
|
||||||
|
procedure OnPortablePageStaticChoiceClick(Sender: TObject); forward;
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
function FindRegistryKey(): String;
|
procedure InitializeWizard;
|
||||||
|
var
|
||||||
|
oPortablePage: TWizardPage;
|
||||||
begin
|
begin
|
||||||
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1');
|
oPortablePage := CreatePortablePage();
|
||||||
|
end;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
|
function ShouldSkipPage(PageID: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
|
function PrepareToInstall(var NeedsRestart: Boolean): String;
|
||||||
|
var
|
||||||
|
iResultCode: Integer;
|
||||||
|
begin
|
||||||
|
// Attempt to remove old version if it exists.
|
||||||
|
if (IsUpgrade()) then begin
|
||||||
|
UninstallOldVersion();
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Also ensure that we have the necessary prerequisites installed to run the program.
|
||||||
|
ExtractTemporaryFile('msvc-redist-helper.exe');
|
||||||
|
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, iResultCode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
|
@ -133,6 +164,12 @@ begin
|
||||||
Result := sInstallPath
|
Result := sInstallPath
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
|
function FindRegistryKey(): String;
|
||||||
|
begin
|
||||||
|
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1');
|
||||||
|
end;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
function GetUninstallerPath(): String;
|
function GetUninstallerPath(): String;
|
||||||
var
|
var
|
||||||
|
@ -182,18 +219,18 @@ end;
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
procedure OnPortablePagePortableChoiceClick(Sender: TObject);
|
procedure OnPortablePagePortableChoiceClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
oPortablePageStaticChoice.Checked := False;
|
oPortablePageStaticChoice.Checked := False;
|
||||||
oPortablePagePortableChoice.Checked := True;
|
oPortablePagePortableChoice.Checked := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure OnPortablePageStaticChoiceClick(Sender: TObject);
|
procedure OnPortablePageStaticChoiceClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (not oPortablePageStaticChoice.Enabled) then begin
|
if (not oPortablePageStaticChoice.Enabled) then begin
|
||||||
OnPortablePagePortableChoiceClick(Sender);
|
OnPortablePagePortableChoiceClick(Sender);
|
||||||
end else begin
|
end else begin
|
||||||
oPortablePageStaticChoice.Checked := True;
|
oPortablePageStaticChoice.Checked := True;
|
||||||
oPortablePagePortableChoice.Checked := False;
|
oPortablePagePortableChoice.Checked := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function IsPortablePagePortableChoiceChecked(): Boolean;
|
function IsPortablePagePortableChoiceChecked(): Boolean;
|
||||||
|
@ -203,152 +240,125 @@ end;
|
||||||
|
|
||||||
function CreatePortablePage: TWizardPage;
|
function CreatePortablePage: TWizardPage;
|
||||||
var
|
var
|
||||||
oPage: TWizardPage;
|
oPage: TWizardPage;
|
||||||
oStaticPanel: TPanel;
|
oStaticPanel: TPanel;
|
||||||
oStaticChoice: TNewRadioButton;
|
oStaticChoice: TNewRadioButton;
|
||||||
oStaticText: TLabel;
|
oStaticText: TLabel;
|
||||||
oStaticWarningText: TLabel;
|
oStaticWarningText: TLabel;
|
||||||
oPortablePanel: TPanel;
|
oPortablePanel: TPanel;
|
||||||
oPortableChoice: TNewRadioButton;
|
oPortableChoice: TNewRadioButton;
|
||||||
oPortableText: TLabel;
|
oPortableText: TLabel;
|
||||||
begin
|
begin
|
||||||
// Build a page that asks a user if they want to use Movable or Static installation.
|
// Build a page that asks a user if they want to use Movable or Static installation.
|
||||||
oPage := CreateCustomPage(wpLicense,
|
oPage := CreateCustomPage(wpLicense,
|
||||||
'Installation Type',
|
'Installation Type',
|
||||||
'Select how to install StreamFX on your System');
|
'Select how to install StreamFX on your System');
|
||||||
|
|
||||||
oStaticPanel := TPanel.Create(oPage);
|
oStaticPanel := TPanel.Create(oPage);
|
||||||
oStaticPanel.Parent := oPage.Surface;
|
oStaticPanel.Parent := oPage.Surface;
|
||||||
oStaticPanel.ParentBackground := False;
|
oStaticPanel.ParentBackground := False;
|
||||||
oStaticPanel.Left := ScaleX(5);
|
oStaticPanel.Left := ScaleX(5);
|
||||||
oStaticPanel.Top := ScaleY(5);
|
oStaticPanel.Top := ScaleY(5);
|
||||||
oStaticPanel.Width := oPage.SurfaceWidth - ScaleX(10);
|
oStaticPanel.Width := oPage.SurfaceWidth - ScaleX(10);
|
||||||
oStaticPanel.Height := ScaleY(100);
|
oStaticPanel.Height := ScaleY(100);
|
||||||
oStaticPanel.Anchors := [akLeft, akTop, akRight];
|
oStaticPanel.Anchors := [akLeft, akTop, akRight];
|
||||||
oStaticPanel.Color := clWindow;
|
oStaticPanel.Color := clWindow;
|
||||||
oStaticPanel.BevelKind := bkTile;
|
oStaticPanel.BevelKind := bkTile;
|
||||||
oStaticPanel.BevelInner := bvNone;
|
oStaticPanel.BevelInner := bvNone;
|
||||||
oStaticPanel.BevelOuter := bvRaised;
|
oStaticPanel.BevelOuter := bvRaised;
|
||||||
oStaticPanel.BevelWidth := 1;
|
oStaticPanel.BevelWidth := 1;
|
||||||
oStaticPanel.OnClick := @OnPortablePageStaticChoiceClick;
|
oStaticPanel.OnClick := @OnPortablePageStaticChoiceClick;
|
||||||
|
|
||||||
oStaticChoice := TNewRadioButton.Create(oStaticPanel);
|
oStaticChoice := TNewRadioButton.Create(oStaticPanel);
|
||||||
oPortablePageStaticChoice := oStaticChoice;
|
oPortablePageStaticChoice := oStaticChoice;
|
||||||
oStaticChoice.Parent := oStaticPanel;
|
oStaticChoice.Parent := oStaticPanel;
|
||||||
oStaticChoice.ParentBackground := False;
|
oStaticChoice.ParentBackground := False;
|
||||||
oStaticChoice.Left := ScaleX(5);
|
oStaticChoice.Left := ScaleX(5);
|
||||||
oStaticChoice.Top := ScaleY(5);
|
oStaticChoice.Top := ScaleY(5);
|
||||||
oStaticChoice.Width := oStaticPanel.Width - ScaleX(10);
|
oStaticChoice.Width := oStaticPanel.Width - ScaleX(10);
|
||||||
oStaticChoice.Height := ScaleY(20);
|
oStaticChoice.Height := ScaleY(20);
|
||||||
oStaticChoice.Anchors := [akLeft, akTop, akRight];
|
oStaticChoice.Anchors := [akLeft, akTop, akRight];
|
||||||
oStaticChoice.Caption := 'Static';
|
oStaticChoice.Caption := 'Static';
|
||||||
oStaticChoice.Font.Style := [fsBold];
|
oStaticChoice.Font.Style := [fsBold];
|
||||||
oStaticChoice.OnClick := @OnPortablePageStaticChoiceClick;
|
oStaticChoice.OnClick := @OnPortablePageStaticChoiceClick;
|
||||||
|
|
||||||
oStaticText := TLabel.Create(oStaticPanel);
|
oStaticText := TLabel.Create(oStaticPanel);
|
||||||
oStaticText.Parent := oStaticPanel;
|
oStaticText.Parent := oStaticPanel;
|
||||||
oStaticText.AutoSize := False;
|
oStaticText.AutoSize := False;
|
||||||
oStaticText.Left := ScaleX(5);
|
oStaticText.Left := ScaleX(5);
|
||||||
oStaticText.Top := ScaleY(5) + oStaticChoice.Top + oStaticChoice.Height;
|
oStaticText.Top := ScaleY(5) + oStaticChoice.Top + oStaticChoice.Height;
|
||||||
oStaticText.Width := oStaticPanel.Width - ScaleX(10);
|
oStaticText.Width := oStaticPanel.Width - ScaleX(10);
|
||||||
oStaticText.Height := oStaticPanel.Height - ScaleX(5) - oStaticText.Top;
|
oStaticText.Height := oStaticPanel.Height - ScaleX(5) - oStaticText.Top;
|
||||||
oStaticText.Anchors := [akLeft, akTop, akRight];
|
oStaticText.Anchors := [akLeft, akTop, akRight];
|
||||||
oStaticText.WordWrap := True
|
oStaticText.WordWrap := True
|
||||||
oStaticText.Caption := 'Install for use in a static version of OBS Studio, with all necessary features to support it.';
|
oStaticText.Caption := 'Install for use in a static version of OBS Studio, with all necessary features to support it.';
|
||||||
oStaticText.OnClick := @OnPortablePageStaticChoiceClick;
|
oStaticText.OnClick := @OnPortablePageStaticChoiceClick;
|
||||||
|
|
||||||
oPortablePanel := TPanel.Create(oPage);
|
oPortablePanel := TPanel.Create(oPage);
|
||||||
oPortablePanel.Parent := oPage.Surface;
|
oPortablePanel.Parent := oPage.Surface;
|
||||||
oPortablePanel.ParentBackground := False;
|
oPortablePanel.ParentBackground := False;
|
||||||
oPortablePanel.Left := ScaleX(5);
|
oPortablePanel.Left := ScaleX(5);
|
||||||
oPortablePanel.Top := ScaleY(5) + oStaticPanel.Top + oStaticPanel.Height;
|
oPortablePanel.Top := ScaleY(5) + oStaticPanel.Top + oStaticPanel.Height;
|
||||||
oPortablePanel.Width := oPage.SurfaceWidth - ScaleX(10);
|
oPortablePanel.Width := oPage.SurfaceWidth - ScaleX(10);
|
||||||
oPortablePanel.Height := ScaleY(100);
|
oPortablePanel.Height := ScaleY(100);
|
||||||
oPortablePanel.Anchors := [akLeft, akTop, akRight];
|
oPortablePanel.Anchors := [akLeft, akTop, akRight];
|
||||||
oPortablePanel.Color := clWindow;
|
oPortablePanel.Color := clWindow;
|
||||||
oPortablePanel.BevelKind := bkTile;
|
oPortablePanel.BevelKind := bkTile;
|
||||||
oPortablePanel.BevelInner := bvNone;
|
oPortablePanel.BevelInner := bvNone;
|
||||||
oPortablePanel.BevelOuter := bvRaised;
|
oPortablePanel.BevelOuter := bvRaised;
|
||||||
oPortablePanel.BevelWidth := 1;
|
oPortablePanel.BevelWidth := 1;
|
||||||
oPortablePanel.OnClick := @OnPortablePagePortableChoiceClick;
|
oPortablePanel.OnClick := @OnPortablePagePortableChoiceClick;
|
||||||
|
|
||||||
oPortableChoice := TNewRadioButton.Create(oPortablePanel);
|
oPortableChoice := TNewRadioButton.Create(oPortablePanel);
|
||||||
oPortablePagePortableChoice := oPortableChoice;
|
oPortablePagePortableChoice := oPortableChoice;
|
||||||
oPortableChoice.Parent := oPortablePanel;
|
oPortableChoice.Parent := oPortablePanel;
|
||||||
oPortableChoice.ParentBackground := False;
|
oPortableChoice.ParentBackground := False;
|
||||||
oPortableChoice.Left := ScaleX(5);
|
oPortableChoice.Left := ScaleX(5);
|
||||||
oPortableChoice.Top := ScaleY(5);
|
oPortableChoice.Top := ScaleY(5);
|
||||||
oPortableChoice.Width := oPortablePanel.Width - ScaleX(10);
|
oPortableChoice.Width := oPortablePanel.Width - ScaleX(10);
|
||||||
oPortableChoice.Height := ScaleY(20);
|
oPortableChoice.Height := ScaleY(20);
|
||||||
oPortableChoice.Anchors := [akLeft, akTop, akRight];
|
oPortableChoice.Anchors := [akLeft, akTop, akRight];
|
||||||
oPortableChoice.Caption := 'Portable';
|
oPortableChoice.Caption := 'Portable';
|
||||||
oPortableChoice.Font.Style := [fsBold];
|
oPortableChoice.Font.Style := [fsBold];
|
||||||
oPortableChoice.OnClick := @OnPortablePagePortableChoiceClick;
|
oPortableChoice.OnClick := @OnPortablePagePortableChoiceClick;
|
||||||
|
|
||||||
oPortableText := TLabel.Create(oPortablePanel);
|
oPortableText := TLabel.Create(oPortablePanel);
|
||||||
oPortableText.Parent := oPortablePanel;
|
oPortableText.Parent := oPortablePanel;
|
||||||
oPortableText.AutoSize := False;
|
oPortableText.AutoSize := False;
|
||||||
oPortableText.Left := ScaleX(5);
|
oPortableText.Left := ScaleX(5);
|
||||||
oPortableText.Top := ScaleY(5) + oPortableChoice.Top + oPortableChoice.Height;
|
oPortableText.Top := ScaleY(5) + oPortableChoice.Top + oPortableChoice.Height;
|
||||||
oPortableText.Width := oPortablePanel.Width - ScaleX(10);
|
oPortableText.Width := oPortablePanel.Width - ScaleX(10);
|
||||||
oPortableText.Height := oPortablePanel.Height - ScaleX(5) - oPortableText.Top;
|
oPortableText.Height := oPortablePanel.Height - ScaleX(5) - oPortableText.Top;
|
||||||
oPortableText.Anchors := [akLeft, akTop, akRight];
|
oPortableText.Anchors := [akLeft, akTop, akRight];
|
||||||
oPortableText.WordWrap := True
|
oPortableText.WordWrap := True
|
||||||
oPortableText.Caption := 'Install for use in portable or multi-environment scenarios, which require StreamFX to not be tied to the System itself. The uninstaller, automatic updates and other system-dependent features will be unavailable.';
|
oPortableText.Caption := 'Install for use in portable or multi-environment scenarios, which require StreamFX to not be tied to the System itself. The uninstaller, automatic updates and other system-dependent features will be unavailable.';
|
||||||
oPortableText.OnClick := @OnPortablePagePortableChoiceClick;
|
oPortableText.OnClick := @OnPortablePagePortableChoiceClick;
|
||||||
|
|
||||||
if (not IsAdmin()) then begin
|
if (not IsAdmin()) then begin
|
||||||
oStaticWarningText := TLabel.Create(oStaticPanel);
|
oStaticWarningText := TLabel.Create(oStaticPanel);
|
||||||
oStaticWarningText.Parent := oStaticPanel;
|
oStaticWarningText.Parent := oStaticPanel;
|
||||||
oStaticWarningText.AutoSize := False;
|
oStaticWarningText.AutoSize := False;
|
||||||
oStaticWarningText.Left := ScaleX(5);
|
oStaticWarningText.Left := ScaleX(5);
|
||||||
oStaticWarningText.Top := oPortablePanel.Height - ScaleY(5) - ScaleY(15);
|
oStaticWarningText.Top := oPortablePanel.Height - ScaleY(5) - ScaleY(15);
|
||||||
oStaticWarningText.Width := oPortablePanel.Width - ScaleX(10);
|
oStaticWarningText.Width := oPortablePanel.Width - ScaleX(10);
|
||||||
oStaticWarningText.Height := ScaleY(15);
|
oStaticWarningText.Height := ScaleY(15);
|
||||||
oStaticWarningText.Anchors := [akLeft, akBottom, akRight];
|
oStaticWarningText.Anchors := [akLeft, akBottom, akRight];
|
||||||
oStaticWarningText.WordWrap := True
|
oStaticWarningText.WordWrap := True
|
||||||
oStaticWarningText.Font.Color := clRed;
|
oStaticWarningText.Font.Color := clRed;
|
||||||
oStaticWarningText.Font.Style := [fsBold];
|
oStaticWarningText.Font.Style := [fsBold];
|
||||||
oStaticWarningText.Caption := 'Please launch the Installer as Administrator for static installations.';
|
oStaticWarningText.Caption := 'Please launch the Installer as Administrator for static installations.';
|
||||||
|
|
||||||
oStaticPanel.Enabled := False;
|
oStaticPanel.Enabled := False;
|
||||||
oStaticChoice.Enabled := False;
|
oStaticChoice.Enabled := False;
|
||||||
oStaticText.Enabled := False;
|
oStaticText.Enabled := False;
|
||||||
|
|
||||||
oStaticChoice.Checked := False;
|
oStaticChoice.Checked := False;
|
||||||
oPortableChoice.Checked := True;
|
oPortableChoice.Checked := True;
|
||||||
end else begin
|
end else begin
|
||||||
oStaticChoice.Checked := True;
|
oStaticChoice.Checked := True;
|
||||||
oPortableChoice.Checked := False;
|
oPortableChoice.Checked := False;
|
||||||
end;
|
|
||||||
|
|
||||||
Result := oPage;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure InitializeWizard;
|
|
||||||
var
|
|
||||||
oPortablePage: TWizardPage;
|
|
||||||
begin
|
|
||||||
oPortablePage := CreatePortablePage();
|
|
||||||
end;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
|
||||||
function ShouldSkipPage(PageID: Integer): Boolean;
|
|
||||||
begin
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
|
||||||
function PrepareToInstall(var NeedsRestart: Boolean): String;
|
|
||||||
var
|
|
||||||
iResultCode: Integer;
|
|
||||||
begin
|
|
||||||
// Attempt to remove old version if it exists.
|
|
||||||
if (IsUpgrade()) then begin
|
|
||||||
UninstallOldVersion();
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Also ensure that we have the necessary prerequisites installed to run the program.
|
Result := oPage;
|
||||||
ExtractTemporaryFile('msvc-redist-helper.exe');
|
|
||||||
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, iResultCode);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue