This repository has been archived by the owner on Jul 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
PageSummary.pas
158 lines (138 loc) · 3.89 KB
/
PageSummary.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
{**
DelphiPI (Delphi Package Installer)
Author : ibrahim dursun (ibrahimdursun gmail)
License : GNU General Public License 2.0
**}
unit PageSummary;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Vcl.Controls, Forms,
Dialogs, PageBase, StdCtrls;
type
TSummaryPage = class(TWizardPage)
Label1: TLabel;
btnSave: TButton;
edtSummary: TMemo;
Label2: TLabel;
procedure btnSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
function Indented(const line: string):string;
procedure AddBaseFolder(const summary: TStringList);
procedure AddDelphiVersion(const summary: TStringList);
procedure AddPackageList(const summary: TStringList);
procedure AddSourcePathList(const summary: TStringList);
procedure AddHelpFileList(const summary: TStringList);
public
procedure UpdateWizardState; override;
end;
var
SummaryPage: TSummaryPage;
implementation
uses ScriptPersister,WizardIntfs, PackageInfo, gnugettext;
{$R *.dfm}
{ TFinishedPage }
procedure TSummaryPage.AddBaseFolder(const summary: TStringList);
begin
summary.Add(_('Base Folder:'));
summary.Add(Indented(fCompilationData.BaseFolder));
end;
procedure TSummaryPage.AddDelphiVersion(const summary: TStringList);
begin
summary.Add(_('Delphi Version:'));
summary.Add(Indented(fCompilationData.Installation.IDEVersionNumberStr));
end;
procedure TSummaryPage.AddHelpFileList(const summary: TStringList);
var
helpfile: string;
begin
summary.Add(_('Help Files:'));
for helpfile in fCompilationData.HelpFiles do
summary.Add(Indented(helpfile));
end;
procedure TSummaryPage.AddPackageList(const summary: TStringList);
var
I: Integer;
erroredPackages: TStringList;
packageName: String;
begin
summary.Add(_('Package List:'));
erroredPackages := TStringList.Create;
try
for I := 0 to fCompilationData.PackageList.Count - 1 do
with fCompilationData.PackageList[i] do
begin
summary.Add(Indented(FileName));
if Status = psError then
erroredPackages.Add(FileName);
end;
if erroredPackages.Count > 0 then
begin
summary.Add(_('However, following packages had some errors:'));
for packageName in erroredPackages do
summary.Add(Indented(packageName));
end;
finally
erroredPackages.Free;
end;
end;
procedure TSummaryPage.AddSourcePathList(const summary: TStringList);
//var
// path: string;
begin
// summary.Add(_('Source File Paths:'));
// for path in fCompilationData.SourceFilePaths do
// summary.Add(Indented(path));
end;
procedure TSummaryPage.btnSaveClick(Sender: TObject);
var
dialog: TSaveDialog;
scripter: TScriptPersister;
begin
dialog := TSaveDialog.Create(self);
try
if dialog.Execute then begin
scripter := TScriptPersister.Create;
try
scripter.Save(fCompilationData, dialog.FileName);
finally
scripter.Free;
end;
end;
finally
dialog.Free;
end;
end;
procedure TSummaryPage.FormCreate(Sender: TObject);
var
summary: TStringList;
begin
inherited;
if fCompilationData = nil then exit;
summary := TStringList.Create;
try
AddBaseFolder(summary);
AddDelphiVersion(summary);
AddPackageList(summary);
AddSourcePathList(summary);
AddHelpFileList(summary);
finally
edtSummary.Lines.Assign(summary);
summary.Free;
end;
end;
function TSummaryPage.Indented(const line: string): string;
begin
Result := ' ' + line;
end;
procedure TSummaryPage.UpdateWizardState;
begin
inherited;
fWizardController.SetHeader(_('Finished'));
fWizardController.SetDescription(_('Installation Summary'));
with fWizardController.GetAction(wbtNext) do
Caption := _('&Exit');
with fWizardController.GetAction(wbtBack) do
Visible := false;
end;
end.