1 | unit UFormModuleList;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
---|
9 | ComCtrls, ExtCtrls, Menus, ActnList, StdCtrls, SpecializedList, DateUtils,
|
---|
10 | UListViewSort, UModularSystem;
|
---|
11 |
|
---|
12 | type
|
---|
13 | TModuleListOption = (mloShowVersion, mloShowAuthor, mloShowFileName,
|
---|
14 | mloShowIdentification, mloShowLicense, mloShowEnable, mloShowRunning,
|
---|
15 | mloShowDependencies, mloShowInstalled, mloShowInfoBar, mloShowDescription,
|
---|
16 | mloShowStartUpTime, mloAllowInstall, mloAllowEnable, mloAllowRegister, mloAllowStart);
|
---|
17 | TModuleListOptions = set of TModuleListOption;
|
---|
18 |
|
---|
19 | { TFormModuleList }
|
---|
20 |
|
---|
21 | TFormModuleList = class(TForm)
|
---|
22 | ARestart: TAction;
|
---|
23 | ARegister: TAction;
|
---|
24 | AEnable: TAction;
|
---|
25 | ADisable: TAction;
|
---|
26 | AStart: TAction;
|
---|
27 | AStop: TAction;
|
---|
28 | AInstall: TAction;
|
---|
29 | AUninstall: TAction;
|
---|
30 | AUnregister: TAction;
|
---|
31 | ActionList1: TActionList;
|
---|
32 | ImageList1: TImageList;
|
---|
33 | ListViewModules: TListView;
|
---|
34 | Memo1: TMemo;
|
---|
35 | MenuItem1: TMenuItem;
|
---|
36 | MenuItem2: TMenuItem;
|
---|
37 | MenuItem3: TMenuItem;
|
---|
38 | MenuItem4: TMenuItem;
|
---|
39 | MenuItem5: TMenuItem;
|
---|
40 | MenuItem6: TMenuItem;
|
---|
41 | MenuItem7: TMenuItem;
|
---|
42 | MenuItem8: TMenuItem;
|
---|
43 | MenuItem9: TMenuItem;
|
---|
44 | PopupMenu1: TPopupMenu;
|
---|
45 | Splitter1: TSplitter;
|
---|
46 | TimerRedraw: TTimer;
|
---|
47 | ToolBar1: TToolBar;
|
---|
48 | ToolButton1: TToolButton;
|
---|
49 | ToolButton2: TToolButton;
|
---|
50 | ToolButton3: TToolButton;
|
---|
51 | ToolButton4: TToolButton;
|
---|
52 | ToolButton5: TToolButton;
|
---|
53 | ToolButton6: TToolButton;
|
---|
54 | ToolButton7: TToolButton;
|
---|
55 | ToolButton8: TToolButton;
|
---|
56 | procedure ADisableExecute(Sender: TObject);
|
---|
57 | procedure AEnableExecute(Sender: TObject);
|
---|
58 | procedure AInstallExecute(Sender: TObject);
|
---|
59 | procedure AUninstallExecute(Sender: TObject);
|
---|
60 | procedure AUnregisterExecute(Sender: TObject);
|
---|
61 | procedure AStartExecute(Sender: TObject);
|
---|
62 | procedure AStopExecute(Sender: TObject);
|
---|
63 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
64 | procedure FormCreate(Sender: TObject);
|
---|
65 | procedure FormDestroy(Sender: TObject);
|
---|
66 | procedure FormHide(Sender: TObject);
|
---|
67 | procedure FormShow(Sender: TObject);
|
---|
68 | procedure ListViewModulesData(Sender: TObject; Item: TListItem);
|
---|
69 | procedure ListViewModulesSelectItem(Sender: TObject; Item: TListItem;
|
---|
70 | Selected: Boolean);
|
---|
71 | procedure TimerRedrawTimer(Sender: TObject);
|
---|
72 | private
|
---|
73 | FModuleManager: TModuleManager;
|
---|
74 | FOptions: TModuleListOptions;
|
---|
75 | ListViewSort: TListViewSort;
|
---|
76 | function ListViewModulesCompare(Item1, Item2: TObject): Integer;
|
---|
77 | procedure ModulesFilterExecute(ListViewSort: TListViewSort);
|
---|
78 | procedure SetModuleManager(AValue: TModuleManager);
|
---|
79 | procedure SetOptions(AValue: TModuleListOptions);
|
---|
80 | public
|
---|
81 | procedure Reload;
|
---|
82 | procedure UpdateInterface;
|
---|
83 | property Manager: TModuleManager read FModuleManager write SetModuleManager;
|
---|
84 | property Options: TModuleListOptions read FOptions write SetOptions;
|
---|
85 | end;
|
---|
86 |
|
---|
87 | function ModuleToStr(Module: TObject): string;
|
---|
88 |
|
---|
89 | implementation
|
---|
90 |
|
---|
91 | resourcestring
|
---|
92 | SYes = 'Yes';
|
---|
93 | SNo = 'No';
|
---|
94 | SAdditionalModulesInstall = 'In addition to "%0:s" module also dependent modules will be installed: "%1:s"';
|
---|
95 | SAdditionalModulesUninstall = 'In addition to "%0:s" module alse dependent modules will be uninstalled: "%1:s"';
|
---|
96 | SAdditionalModulesStart = 'In addition to "%0:s" module also dependent modules will be started: "%1:s"';
|
---|
97 | SAdditionalModulesStop = 'In addition to "%0:s" module also dependent modules will be stopped: "%1:s"';
|
---|
98 | SIdentification = 'Identification';
|
---|
99 | SName = 'Name';
|
---|
100 | SVersion = 'Version';
|
---|
101 | SLicense = 'License';
|
---|
102 | SDescription = 'Description';
|
---|
103 | SDependencies = 'Dependencies';
|
---|
104 | SAuthor = 'Author';
|
---|
105 | SInstalled = 'Installed';
|
---|
106 | SRunning = 'Running';
|
---|
107 | SEnabled = 'Enabled';
|
---|
108 | SEnable = 'Enable';
|
---|
109 | SDisable = 'Disable';
|
---|
110 | SInstall = 'Install';
|
---|
111 | SUninstall = 'Uninstall';
|
---|
112 | SStart = 'Start';
|
---|
113 | SStop = 'Stop';
|
---|
114 | SRestart = 'Restart';
|
---|
115 | SModuleList = 'Module list';
|
---|
116 |
|
---|
117 | function ModuleToStr(Module: TObject): string;
|
---|
118 | begin
|
---|
119 | Result := TModule(Module).Title;
|
---|
120 | end;
|
---|
121 |
|
---|
122 | { TFormModuleList }
|
---|
123 |
|
---|
124 | procedure TFormModuleList.ListViewModulesData(Sender: TObject; Item: TListItem);
|
---|
125 | begin
|
---|
126 | if (Item.Index >= 0) and (Item.Index < ListViewSort.List.Count) then
|
---|
127 | with TModule(ListViewSort.List[Item.Index]) do begin
|
---|
128 | Item.Caption := Identification;
|
---|
129 | Item.Data := ListViewSort.List[Item.Index];
|
---|
130 | Item.SubItems.Add(Title);
|
---|
131 | if Enabled then Item.SubItems.Add(SYes)
|
---|
132 | else Item.SubItems.Add(SNo);
|
---|
133 | if Installed then Item.SubItems.Add(SYes)
|
---|
134 | else Item.SubItems.Add(SNo);
|
---|
135 | if Running then Item.SubItems.Add(SYes)
|
---|
136 | else Item.SubItems.Add(SNo);
|
---|
137 | if Author <> '' then Item.SubItems.Add(Author)
|
---|
138 | else Item.SubItems.Add(' ');
|
---|
139 | if License <> '' then Item.SubItems.Add(License)
|
---|
140 | else Item.SubItems.Add(' ');
|
---|
141 | if Version <> '' then Item.SubItems.Add(Version)
|
---|
142 | else Item.SubItems.Add(' ');
|
---|
143 | Item.SubItems.Add(Dependencies.Implode(',', StrToStr));
|
---|
144 | if FileName <> '' then Item.SubItems.Add(FileName)
|
---|
145 | else Item.SubItems.Add(' ');
|
---|
146 | Item.SubItems.Add(FloatToStr(Trunc(StartUpTime / OneMillisecond)));
|
---|
147 | end;
|
---|
148 | end;
|
---|
149 |
|
---|
150 | procedure TFormModuleList.ListViewModulesSelectItem(Sender: TObject;
|
---|
151 | Item: TListItem; Selected: Boolean);
|
---|
152 | begin
|
---|
153 | UpdateInterface;
|
---|
154 | Memo1.Clear;
|
---|
155 | if Assigned(ListViewModules.Selected) then
|
---|
156 | with TModule(ListViewModules.Selected.Data) do begin
|
---|
157 | Memo1.Lines.Add(SName + ': ' + Title);
|
---|
158 | if (mloShowIdentification in FOptions) then Memo1.Lines.Add(SIdentification + ': ' + Identification);
|
---|
159 | if (mloShowAuthor in FOptions) and (Author <> '') then Memo1.Lines.Add(SAuthor + ': ' + Author);
|
---|
160 | if (mloShowVersion in FOptions) and (Version <> '') then Memo1.Lines.Add(SVersion + ': ' + Version);
|
---|
161 | if (mloShowLicense in FOptions) and (License <> '') then Memo1.Lines.Add(SLicense + ': ' + License);
|
---|
162 | if (mloShowDependencies in FOptions) and (Dependencies.Count > 0) then
|
---|
163 | Memo1.Lines.Add(SDependencies + ': ' + Dependencies.Implode(', ', StrToStr));
|
---|
164 | if (mloShowDescription in FOptions) and (Description.Count > 0) then
|
---|
165 | Memo1.Lines.Add(SDescription + ': ' + Description.Implode(', ', StrToStr));
|
---|
166 | end;
|
---|
167 | end;
|
---|
168 |
|
---|
169 | procedure TFormModuleList.FormCreate(Sender: TObject);
|
---|
170 | begin
|
---|
171 | ListViewSort := TListViewSort.Create;
|
---|
172 | ListViewSort.ListView := ListViewModules;
|
---|
173 | ListViewSort.Column := 0;
|
---|
174 | ListViewSort.Order := soDown;
|
---|
175 | ListViewSort.OnCompareItem := ListViewModulesCompare;
|
---|
176 | ListViewSort.OnFilter := ModulesFilterExecute;
|
---|
177 |
|
---|
178 | DoubleBuffered := True;
|
---|
179 | ControlStyle := ControlStyle + [csOpaque];
|
---|
180 | ListViewModules.DoubleBuffered := True;
|
---|
181 | ListViewModules.ControlStyle := ListViewModules.ControlStyle + [csOpaque];
|
---|
182 | end;
|
---|
183 |
|
---|
184 | procedure TFormModuleList.FormDestroy(Sender: TObject);
|
---|
185 | begin
|
---|
186 | ListViewModules.Clear;
|
---|
187 | FreeAndNil(ListViewSort);
|
---|
188 | end;
|
---|
189 |
|
---|
190 | procedure TFormModuleList.AUnregisterExecute(Sender: TObject);
|
---|
191 | var
|
---|
192 | I: Integer;
|
---|
193 | begin
|
---|
194 | for I := ListViewModules.Items.Count - 1 downto 0 do
|
---|
195 | if ListViewModules.Items[I].Selected then
|
---|
196 | with TModule(ListViewModules.Items[I].Data) do begin
|
---|
197 | FModuleManager.UnregisterModule(TModule(ListViewModules.Items[I].Data));
|
---|
198 | end;
|
---|
199 | UpdateInterface;
|
---|
200 | end;
|
---|
201 |
|
---|
202 | procedure TFormModuleList.AStartExecute(Sender: TObject);
|
---|
203 | var
|
---|
204 | Modules: TListModule;
|
---|
205 | I: Integer;
|
---|
206 | begin
|
---|
207 | for I := 0 to ListViewModules.Items.Count - 1 do
|
---|
208 | if ListViewModules.Items[I].Selected then
|
---|
209 | with TModule(ListViewModules.Items[I].Data) do
|
---|
210 | if not Running then
|
---|
211 | try
|
---|
212 | Modules := TListModule.Create;
|
---|
213 | Modules.OwnsObjects := False;
|
---|
214 | EnumDependenciesCascade(Modules, [mcNotRunning]);
|
---|
215 | if Modules.Count > 0 then begin
|
---|
216 | if MessageDlg(Format(SAdditionalModulesStart, [
|
---|
217 | Identification, Modules.Implode(',', ModuleToStr)]),
|
---|
218 | mtConfirmation, [mbYes, mbNo], 0) = mrYes then
|
---|
219 | Start;
|
---|
220 | end else Start;
|
---|
221 | finally
|
---|
222 | Modules.Free;
|
---|
223 | end;
|
---|
224 | UpdateInterface;
|
---|
225 | end;
|
---|
226 |
|
---|
227 | procedure TFormModuleList.AStopExecute(Sender: TObject);
|
---|
228 | var
|
---|
229 | Modules: TListModule;
|
---|
230 | I: Integer;
|
---|
231 | begin
|
---|
232 | for I := 0 to ListViewModules.Items.Count - 1 do
|
---|
233 | if ListViewModules.Items[I].Selected then
|
---|
234 | with TModule(ListViewModules.Items[I].Data) do
|
---|
235 | if Running then
|
---|
236 | try
|
---|
237 | Modules := TListModule.Create;
|
---|
238 | Modules.OwnsObjects := False;
|
---|
239 | EnumSuperiorDependenciesCascade(Modules, [mcRunning]);
|
---|
240 | if Modules.Count > 0 then begin
|
---|
241 | if MessageDlg(Format(SAdditionalModulesStop, [
|
---|
242 | Identification,
|
---|
243 | Modules.Implode(',', ModuleToStr)]),
|
---|
244 | mtConfirmation, [mbYes, mbNo], 0) = mrYes then
|
---|
245 | Stop;
|
---|
246 | end else Stop;
|
---|
247 | finally
|
---|
248 | FreeAndNil(Modules);
|
---|
249 | end;
|
---|
250 | UpdateInterface;
|
---|
251 | end;
|
---|
252 |
|
---|
253 | procedure TFormModuleList.AUninstallExecute(Sender: TObject);
|
---|
254 | var
|
---|
255 | Modules: TListModule;
|
---|
256 | I: Integer;
|
---|
257 | begin
|
---|
258 | for I := 0 to ListViewModules.Items.Count - 1 do
|
---|
259 | if ListViewModules.Items[I].Selected then
|
---|
260 | with TModule(ListViewModules.Items[I].Data) do
|
---|
261 | if Installed then
|
---|
262 | try
|
---|
263 | Modules := TListModule.Create;
|
---|
264 | Modules.OwnsObjects := False;
|
---|
265 | EnumSuperiorDependenciesCascade(Modules, [mcInstalled]);
|
---|
266 | if Modules.Count > 0 then begin
|
---|
267 | if MessageDlg(Format(SAdditionalModulesUninstall, [
|
---|
268 | Identification,
|
---|
269 | Modules.Implode(',', ModuleToStr)]),
|
---|
270 | mtConfirmation, [mbYes, mbNo], 0) = mrYes then
|
---|
271 | Uninstall;
|
---|
272 | end else Uninstall;
|
---|
273 | finally
|
---|
274 | Modules.Free;
|
---|
275 | end;
|
---|
276 | UpdateInterface;
|
---|
277 | end;
|
---|
278 |
|
---|
279 | procedure TFormModuleList.FormClose(Sender: TObject;
|
---|
280 | var CloseAction: TCloseAction);
|
---|
281 | begin
|
---|
282 | TimerRedraw.Enabled := False;
|
---|
283 | //Core.PersistentForm.Save(Self);
|
---|
284 | end;
|
---|
285 |
|
---|
286 | procedure TFormModuleList.AInstallExecute(Sender: TObject);
|
---|
287 | var
|
---|
288 | Modules: TListModule;
|
---|
289 | I: Integer;
|
---|
290 | begin
|
---|
291 | for I := 0 to ListViewModules.Items.Count - 1 do
|
---|
292 | if ListViewModules.Items[I].Selected then
|
---|
293 | with TModule(ListViewModules.Items[I].Data) do
|
---|
294 | if not Installed then
|
---|
295 | try
|
---|
296 | Modules := TListModule.Create;
|
---|
297 | Modules.OwnsObjects := False;
|
---|
298 | EnumDependenciesCascade(Modules, [mcNotInstalled]);
|
---|
299 | if Modules.Count > 0 then begin
|
---|
300 | if MessageDlg(Format(SAdditionalModulesInstall, [
|
---|
301 | Identification,
|
---|
302 | Modules.Implode(',', ModuleToStr)]),
|
---|
303 | mtConfirmation, [mbYes, mbNo], 0) = mrYes then
|
---|
304 | Install;
|
---|
305 | end else Install;
|
---|
306 | finally
|
---|
307 | Modules.Free;
|
---|
308 | end;
|
---|
309 | UpdateInterface;
|
---|
310 | end;
|
---|
311 |
|
---|
312 | procedure TFormModuleList.AEnableExecute(Sender: TObject);
|
---|
313 | var
|
---|
314 | Modules: TListModule;
|
---|
315 | I: Integer;
|
---|
316 | begin
|
---|
317 | for I := 0 to ListViewModules.Items.Count - 1 do
|
---|
318 | if ListViewModules.Items[I].Selected then
|
---|
319 | with TModule(ListViewModules.Items[I].Data) do
|
---|
320 | if not Enabled then
|
---|
321 | try
|
---|
322 | Modules := TListModule.Create;
|
---|
323 | Modules.OwnsObjects := False;
|
---|
324 | EnumDependenciesCascade(Modules, [mcNotRunning]);
|
---|
325 | if Modules.Count > 0 then begin
|
---|
326 | if MessageDlg(Format(SAdditionalModulesStart, [
|
---|
327 | Identification, Modules.Implode(',', ModuleToStr)]),
|
---|
328 | mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
|
---|
329 | Enable;
|
---|
330 | Start;
|
---|
331 | end;
|
---|
332 | end else begin
|
---|
333 | Enable;
|
---|
334 | Start;
|
---|
335 | end;
|
---|
336 | finally
|
---|
337 | Modules.Free;
|
---|
338 | end;
|
---|
339 | UpdateInterface;
|
---|
340 | end;
|
---|
341 |
|
---|
342 | procedure TFormModuleList.ADisableExecute(Sender: TObject);
|
---|
343 | var
|
---|
344 | Modules: TListModule;
|
---|
345 | I: Integer;
|
---|
346 | begin
|
---|
347 | for I := 0 to ListViewModules.Items.Count - 1 do
|
---|
348 | if ListViewModules.Items[I].Selected then
|
---|
349 | with TModule(ListViewModules.Items[I].Data) do
|
---|
350 | if Enabled then
|
---|
351 | try
|
---|
352 | Modules := TListModule.Create;
|
---|
353 | Modules.OwnsObjects := False;
|
---|
354 | EnumSuperiorDependenciesCascade(Modules, [mcInstalled]);
|
---|
355 | if Modules.Count > 0 then begin
|
---|
356 | if MessageDlg(Format(SAdditionalModulesUninstall, [
|
---|
357 | Identification,
|
---|
358 | Modules.Implode(',', ModuleToStr)]),
|
---|
359 | mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
|
---|
360 | Stop;
|
---|
361 | Disable;
|
---|
362 | end;
|
---|
363 | end else begin
|
---|
364 | TModule(ListViewModules.Selected.Data).Stop;
|
---|
365 | TModule(ListViewModules.Selected.Data).Disable;
|
---|
366 | end;
|
---|
367 | finally
|
---|
368 | Modules.Free;
|
---|
369 | end;
|
---|
370 | UpdateInterface;
|
---|
371 | end;
|
---|
372 |
|
---|
373 | procedure TFormModuleList.FormHide(Sender: TObject);
|
---|
374 | begin
|
---|
375 | TimerRedraw.Enabled := False;
|
---|
376 | end;
|
---|
377 |
|
---|
378 | procedure TFormModuleList.FormShow(Sender: TObject);
|
---|
379 | begin
|
---|
380 | Reload;
|
---|
381 | UpdateInterface;
|
---|
382 | //TimerRedraw.Enabled := True;
|
---|
383 | //Core.PersistentForm.Load(Self);
|
---|
384 | end;
|
---|
385 |
|
---|
386 | procedure TFormModuleList.TimerRedrawTimer(Sender: TObject);
|
---|
387 | begin
|
---|
388 | Reload;
|
---|
389 | end;
|
---|
390 |
|
---|
391 | function TFormModuleList.ListViewModulesCompare(Item1, Item2: TObject): Integer;
|
---|
392 | begin
|
---|
393 | Result := 0;
|
---|
394 | if Assigned(Item1) and Assigned(Item2) and (ListViewSort.Order <> soNone) then begin
|
---|
395 | with ListViewSort do
|
---|
396 | case Column of
|
---|
397 | 0: Result := CompareString(TModule(Item1).Identification,
|
---|
398 | TModule(Item2).Identification);
|
---|
399 | 1: Result := CompareString(TModule(Item1).Title,
|
---|
400 | TModule(Item2).Title);
|
---|
401 | 2: Result := CompareBoolean(TModule(Item1).Enabled,
|
---|
402 | TModule(Item2).Enabled);
|
---|
403 | 3: Result := CompareBoolean(TModule(Item1).Installed,
|
---|
404 | TModule(Item2).Installed);
|
---|
405 | 4: Result := CompareBoolean(TModule(Item1).Running,
|
---|
406 | TModule(Item2).Running);
|
---|
407 | 5: Result := CompareString(TModule(Item1).Author,
|
---|
408 | TModule(Item2).Author);
|
---|
409 | 6: Result := CompareString(TModule(Item1).License, TModule(
|
---|
410 | Item2).License);
|
---|
411 | 7: Result := CompareString(TModule(Item1).Version, TModule(
|
---|
412 | Item2).Version);
|
---|
413 | 8: Result := CompareString(TModule(Item1).Dependencies.Implode(',', StrToStr),
|
---|
414 | TModule(Item2).Dependencies.Implode(',', StrToStr));
|
---|
415 | 9: Result := CompareString(TModule(Item1).FileName,
|
---|
416 | TModule(Item2).FileName);
|
---|
417 | 10: Result := CompareTime(TModule(Item1).StartUpTime,
|
---|
418 | TModule(Item2).StartUpTime);
|
---|
419 | end;
|
---|
420 | if ListViewSort.Order = soDown then Result := -Result;
|
---|
421 | end else Result := 0;
|
---|
422 | end;
|
---|
423 |
|
---|
424 | procedure TFormModuleList.ModulesFilterExecute(ListViewSort: TListViewSort);
|
---|
425 | var
|
---|
426 | I: Integer;
|
---|
427 | begin
|
---|
428 | if Assigned(FModuleManager) then
|
---|
429 | begin
|
---|
430 | ListViewSort.Source := nil;
|
---|
431 | ListViewSort.List.Clear;
|
---|
432 | //ListViewSort.List.Assign(FModuleManager.Modules);
|
---|
433 | for I := 0 to FModuleManager.Modules.Count - 1 do
|
---|
434 | with TModule(FModuleManager.Modules[I]) do begin
|
---|
435 | ListViewSort.List.Add(FModuleManager.Modules[I]);
|
---|
436 | end;
|
---|
437 | end else begin
|
---|
438 | ListViewSort.Source := nil;
|
---|
439 | ListViewSort.List.Clear;
|
---|
440 | end;
|
---|
441 | end;
|
---|
442 |
|
---|
443 | procedure TFormModuleList.SetModuleManager(AValue: TModuleManager);
|
---|
444 | begin
|
---|
445 | if FModuleManager = AValue then Exit;
|
---|
446 | FModuleManager := AValue;
|
---|
447 | if not (csDestroying in ComponentState) then Reload;
|
---|
448 | end;
|
---|
449 |
|
---|
450 | procedure TFormModuleList.SetOptions(AValue: TModuleListOptions);
|
---|
451 | begin
|
---|
452 | if FOptions = AValue then Exit;
|
---|
453 | FOptions := AValue;
|
---|
454 | UpdateInterface;
|
---|
455 | end;
|
---|
456 |
|
---|
457 | procedure TFormModuleList.Reload;
|
---|
458 | begin
|
---|
459 | if Assigned(ListViewSort) then
|
---|
460 | ListViewSort.Refresh;
|
---|
461 | end;
|
---|
462 |
|
---|
463 | procedure TFormModuleList.UpdateInterface;
|
---|
464 | begin
|
---|
465 | AUnregister.Enabled := Assigned(ListViewModules.Selected) and
|
---|
466 | (mloAllowRegister in FOptions);
|
---|
467 | AUnregister.Visible := (mloAllowRegister in FOptions);
|
---|
468 | ARegister.Enabled := Assigned(ListViewModules.Selected) and
|
---|
469 | (mloAllowRegister in FOptions);
|
---|
470 | ARegister.Visible := (mloAllowRegister in FOptions);
|
---|
471 | AInstall.Enabled := Assigned(ListViewModules.Selected) and
|
---|
472 | not TModule(ListViewModules.Selected.Data).Installed and
|
---|
473 | (mloAllowInstall in FOptions) and
|
---|
474 | TModule(ListViewModules.Selected.Data).Enabled;
|
---|
475 | AInstall.Visible := (mloAllowInstall in FOptions);
|
---|
476 | AUninstall.Enabled := Assigned(ListViewModules.Selected) and
|
---|
477 | TModule(ListViewModules.Selected.Data).Installed and
|
---|
478 | (mloAllowInstall in FOptions);
|
---|
479 | AUninstall.Visible := (mloAllowInstall in FOptions);
|
---|
480 | AStart.Enabled := Assigned(ListViewModules.Selected) and
|
---|
481 | not TModule(ListViewModules.Selected.Data).Running and
|
---|
482 | (mloAllowStart in FOptions);
|
---|
483 | AStart.Visible := (mloAllowStart in FOptions);
|
---|
484 | AStop.Enabled := Assigned(ListViewModules.Selected) and
|
---|
485 | TModule(ListViewModules.Selected.Data).Running and
|
---|
486 | TModule(ListViewModules.Selected.Data).Installed and
|
---|
487 | (mloAllowStart in FOptions);
|
---|
488 | AStop.Visible := (mloAllowStart in FOptions);
|
---|
489 | AEnable.Enabled := Assigned(ListViewModules.Selected) and
|
---|
490 | not TModule(ListViewModules.Selected.Data).Enabled and
|
---|
491 | (mloAllowEnable in FOptions);
|
---|
492 | AEnable.Visible := (mloAllowEnable in FOptions);
|
---|
493 | ADisable.Enabled := Assigned(ListViewModules.Selected) and
|
---|
494 | TModule(ListViewModules.Selected.Data).Enabled and
|
---|
495 | (mloAllowEnable in FOptions);
|
---|
496 | ADisable.Visible := (mloAllowEnable in FOptions);
|
---|
497 | ListViewModules.Column[0].Visible := (mloShowIdentification in FOptions);
|
---|
498 | ListViewModules.Column[1].Visible := True;
|
---|
499 | ListViewModules.Column[2].Visible := (mloShowEnable in FOptions);
|
---|
500 | ListViewModules.Column[3].Visible := (mloShowInstalled in FOptions);
|
---|
501 | ListViewModules.Column[4].Visible := (mloShowRunning in FOptions);
|
---|
502 | ListViewModules.Column[5].Visible := (mloShowAuthor in FOptions);
|
---|
503 | ListViewModules.Column[6].Visible := (mloShowLicense in FOptions);
|
---|
504 | ListViewModules.Column[7].Visible := (mloShowVersion in FOptions);
|
---|
505 | ListViewModules.Column[8].Visible := (mloShowDependencies in FOptions);
|
---|
506 | ListViewModules.Column[9].Visible := (mloShowFileName in FOptions);
|
---|
507 | ListViewModules.Column[10].Visible := (mloShowStartUpTime in FOptions);
|
---|
508 | Memo1.Visible := (mloShowInfoBar in FOptions);
|
---|
509 | Splitter1.Visible := (mloShowInfoBar in FOptions);
|
---|
510 | end;
|
---|
511 |
|
---|
512 | initialization
|
---|
513 | {$I UFormModuleList.lrs}
|
---|
514 |
|
---|
515 | end.
|
---|
516 |
|
---|