forked from Valkirie/HandheldCompanion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateUninstallWizard.iss
193 lines (168 loc) · 8.1 KB
/
UpdateUninstallWizard.iss
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
[Code]
var
UninstallFirstPage: TNewNotebookPage;
UninstallSecondPage: TNewNotebookPage;
UninstallBackButton: TNewButton;
UninstallNextButton: TNewButton;
checkListBox: TNewCheckListBox;
keepAllCheck, profilesCheck, hotkeysCheck, applicationSettingsCheck:integer;
keepVigemCheckbox, keepHidHideCheckbox: TNewCheckBox;
procedure UpdateUninstallWizard;
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
begin
UninstallProgressForm.PageNameLabel.Caption := 'Select Settings To Be Kept';
UninstallProgressForm.PageDescriptionLabel.Caption := 'Which items are to be kept?';
end
else
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallSecondPage then
begin
UninstallProgressForm.PageNameLabel.Caption := 'Select Dependency Applications To Be Kept';
UninstallProgressForm.PageDescriptionLabel.Caption := 'Which applications should be kept?';
end;
UninstallBackButton.Visible:= (UninstallProgressForm.InnerNotebook.ActivePage <> UninstallFirstPage);
if UninstallProgressForm.InnerNotebook.ActivePage <> UninstallSecondPage then
begin
UninstallNextButton.Caption := 'Next';
UninstallNextButton.ModalResult := mrNone;
end
else
begin
UninstallNextButton.Caption := 'Uninstall';
{ Make the "Uninstall" button break the ShowModal loop }
UninstallNextButton.ModalResult := mrOK;
end;
end;
procedure UninstallNextButtonClick(Sender: TObject);
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallSecondPage then
begin
UninstallNextButton.Visible := False;
UninstallBackButton.Visible := False;
end
else
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallFirstPage then
begin
UninstallProgressForm.InnerNotebook.ActivePage := UninstallSecondPage;
end;
UpdateUninstallWizard;
end;
end;
procedure UninstallBackButtonClick(Sender: TObject);
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallSecondPage then
begin
UninstallProgressForm.InnerNotebook.ActivePage := UninstallFirstPage;
end;
UpdateUninstallWizard;
end;
procedure onClickCheckListBox(Sender: TObject);
begin
end;
procedure InitializeUninstallProgressForm();
var
PageText: TNewStaticText;
PageNameLabel: string;
PageDescriptionLabel: string;
CancelButtonEnabled: Boolean;
CancelButtonModalResult: Integer;
begin
if not UninstallSilent then
begin
{ Create the first page and make it active }
UninstallFirstPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallFirstPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallFirstPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallFirstPage.Align := alClient;
PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallFirstPage;
PageText.Top := UninstallProgressForm.StatusLabel.Top;
PageText.Left := UninstallProgressForm.StatusLabel.Left;
PageText.Width := UninstallProgressForm.StatusLabel.Width;
PageText.Height := UninstallProgressForm.StatusLabel.Height;
PageText.AutoSize := False;
PageText.ShowAccelChar := False;
PageText.Caption := 'Press Next to proceed with uninstallation.';
checkListBox := TNewCheckListBox.Create(UninstallFirstPage);
checkListBox.Parent := UninstallFirstPage;
checkListBox.Left := UninstallProgressForm.StatusLabel.Left;
checkListBox.Top := PageText.Top + PageText.height + 16;
checkListBox.Width := 450;
checkListBox.Height := ScaleY(97);
checkListBox.Flat := True;
keepAllCheck:= checkListBox.AddCheckBox('Keep all', '', 0, True, True, True, True, nil);
profilesCheck:= checkListBox.AddCheckBox('Keep profiles', '', 1, True, True, False, True, nil);
hotkeysCheck:= checkListBox.AddCheckBox('Keep hotkeys', '', 1, True, True, False,True, nil);
applicationSettingsCheck:= checkListBox.AddCheckBox('Keep settings', '', 1, True, True, False,True, nil);
checkListBox.onClick:= @onClickCheckListBox;
UninstallProgressForm.InnerNotebook.ActivePage := UninstallFirstPage;
PageNameLabel := UninstallProgressForm.PageNameLabel.Caption;
PageDescriptionLabel := UninstallProgressForm.PageDescriptionLabel.Caption;
{ Create the second page }
UninstallSecondPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallSecondPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallSecondPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallSecondPage.Align := alClient;
PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallSecondPage;
PageText.Top := UninstallProgressForm.StatusLabel.Top;
PageText.Left := UninstallProgressForm.StatusLabel.Left;
PageText.Width := UninstallProgressForm.StatusLabel.Width;
PageText.Height := UninstallProgressForm.StatusLabel.Height;
PageText.AutoSize := False;
PageText.ShowAccelChar := False;
PageText.Caption := 'Press Uninstall to proceeed with uninstallation.';
keepVigemCheckbox := TNewCheckBox.Create(UninstallProgressForm);
keepVigemCheckbox.Parent := UninstallSecondPage;
keepVigemCheckbox.Left := UninstallProgressForm.StatusLabel.Left;
keepVigemCheckbox.Top := PageText.Top + PageText.height + 16;
keepVigemCheckbox.Caption := 'Keep Vigem';
keepVigemCheckbox.checked:= false;
keepHidhideCheckbox := TNewCheckBox.Create(UninstallProgressForm);
keepHidhideCheckbox.Parent := UninstallSecondPage;
keepHidhideCheckbox.Left := UninstallProgressForm.StatusLabel.Left;
keepHidhideCheckbox.Top := keepVigemCheckbox.Top + PageText.height + 6;
keepHidhideCheckbox.Caption := 'Keep HidHide';
keepHidhideCheckbox.checked:= false;
UninstallNextButton := TNewButton.Create(UninstallProgressForm);
UninstallNextButton.Parent := UninstallProgressForm;
UninstallNextButton.Left :=
UninstallProgressForm.CancelButton.Left -
UninstallProgressForm.CancelButton.Width -
ScaleX(10);
UninstallNextButton.Top := UninstallProgressForm.CancelButton.Top;
UninstallNextButton.Width := UninstallProgressForm.CancelButton.Width;
UninstallNextButton.Height := UninstallProgressForm.CancelButton.Height;
UninstallNextButton.OnClick := @UninstallNextButtonClick;
UninstallBackButton := TNewButton.Create(UninstallProgressForm);
UninstallBackButton.Parent := UninstallProgressForm;
UninstallBackButton.Left :=
UninstallNextButton.Left - UninstallNextButton.Width -
ScaleX(10);
UninstallBackButton.Top := UninstallProgressForm.CancelButton.Top;
UninstallBackButton.Width := UninstallProgressForm.CancelButton.Width;
UninstallBackButton.Height := UninstallProgressForm.CancelButton.Height;
UninstallBackButton.Caption := SetupMessage(msgButtonBack);
UninstallBackButton.OnClick := @UninstallBackButtonClick;
UninstallBackButton.TabOrder := UninstallProgressForm.CancelButton.TabOrder;
UninstallNextButton.TabOrder := UninstallBackButton.TabOrder + 1;
UninstallProgressForm.CancelButton.TabOrder :=
UninstallNextButton.TabOrder + 1;
{ Run our wizard pages }
UpdateUninstallWizard;
CancelButtonEnabled := UninstallProgressForm.CancelButton.Enabled
UninstallProgressForm.CancelButton.Enabled := True;
CancelButtonModalResult := UninstallProgressForm.CancelButton.ModalResult;
UninstallProgressForm.CancelButton.ModalResult := mrCancel;
UninstallProgressForm.ActiveControl := UninstallNextButton;
if UninstallProgressForm.ShowModal = mrCancel then
Abort;
{ Restore the standard page payout }
UninstallProgressForm.CancelButton.Enabled := CancelButtonEnabled;
UninstallProgressForm.CancelButton.ModalResult := CancelButtonModalResult;
UninstallProgressForm.PageNameLabel.Caption := PageNameLabel;
UninstallProgressForm.PageDescriptionLabel.Caption := PageDescriptionLabel;
UninstallProgressForm.InnerNotebook.ActivePage := UninstallProgressForm.InstallingPage;
end;
end;