Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 727c611

Browse files
committed
Implement page for selecting install type
1 parent a6ab203 commit 727c611

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

ElixirWeb.iss

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ type
6161
TStringTable = array of TStringList;
6262
6363
var
64-
PSelInstallType: TInputOptionWizardPage;
64+
PSelInstallType: TInputOptionWizardPage;
65+
itypeLatestRelease: Integer;
66+
itypeLatestPrerelease: Integer;
67+
itypeCustom: Integer;
6568
PSelRelease: TWizardPage;
6669
PSelReleaseListBox: TNewCheckListBox;
6770
@@ -166,8 +169,7 @@ begin
166169
Result := TStrings(PSelReleaseListBox.ItemObject[i]);
167170
break;
168171
end;
169-
end;
170-
Result := nil;
172+
end;
171173
end;
172174
173175
function ConstGetTargetReleaseVersion(Param: String): String;
@@ -183,11 +185,28 @@ end;
183185
procedure CurPageChanged(CurPageID: Integer);
184186
begin
185187
if CurPageID = wpPreparing then begin
188+
if PSelInstallType.SelectedValueIndex = itypeLatestRelease then begin
189+
TargetRelease := GetListBoxLatestRelease(False);
190+
end else if (not (itypeLatestPrerelease = -1)) and (PSelInstallType.SelectedValueIndex = itypeLatestPrerelease) then begin
191+
TargetRelease := GetListBoxLatestRelease(True);
192+
end else begin
193+
TargetRelease := GetListBoxSelectedRelease();
194+
end;
195+
186196
idpAddFile(GetURL(TargetRelease), ExpandConstant('{tmp}\Precompiled.zip'));
187197
idpDownloadAfter(wpPreparing);
188198
end;
189199
end;
190200
201+
function ShouldSkipPage(PageID: Integer): Boolean;
202+
begin
203+
if PageID = PSelRelease.ID then begin
204+
Result := not (PSelInstallType.SelectedValueIndex = itypeCustom);
205+
end else begin
206+
Result := False;
207+
end;
208+
end;
209+
191210
function PrepareToInstall(var NeedsRestart: Boolean): String;
192211
begin
193212
if not ErlangIsInstalled then begin
@@ -212,7 +231,15 @@ begin
212231
PSelReleaseListBox.Parent := PSelRelease.Surface;
213232
214233
PopulatePSelReleaseListBox(CSVToStringTable(ExpandConstant('{tmp}\releases.csv')));
215-
TargetRelease := GetListBoxLatestRelease(False);
234+
235+
itypeLatestRelease := PSelInstallType.Add('Install the latest stable release (v' + GetVersion(GetListBoxLatestRelease(False)) + ')');
236+
PSelInstallType.SelectedValueIndex := itypeLatestRelease;
237+
if not (GetListBoxLatestRelease(True) = nil) then begin
238+
itypeLatestPrerelease := PSelInstallType.Add('Install the latest prerelease (v' + GetVersion(GetListBoxLatestRelease(True)) + ')');
239+
end else begin
240+
itypeLatestPrerelease := -1;
241+
end;
242+
itypeCustom := PSelInstallType.Add('Select another release to install');
216243
end;
217244
218245
function InitializeSetup(): Boolean;

0 commit comments

Comments
 (0)