-
Notifications
You must be signed in to change notification settings - Fork 5
/
HGI.Main.pas
774 lines (718 loc) · 23.1 KB
/
HGI.Main.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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
unit HGI.Main;
interface
uses
Winapi.Windows, System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Layouts, FMX.Objects, FMX.Controls.Presentation, FMX.Edit, FMX.StdCtrls,
HGI.View.Item, HGI.GetItAPI, FMX.Ani, FMX.Filter.Effects, FMX.Menus, HGI.Item,
System.Threading, HGI.GetItCmd, System.ImageList, FMX.ImgList, HGM.LineStorage;
type
TFormMain = class(TForm)
LayoutHead: TLayout;
LayoutMenu: TLayout;
LayoutClient: TLayout;
Rectangle2: TRectangle;
StyleBook: TStyleBook;
RadioButtonComponents: TRadioButton;
RadioButtonAll: TRadioButton;
RadioButtonLibs: TRadioButton;
Layout3: TLayout;
LabelCaption: TLabel;
Path1: TPath;
RadioButtonTrial: TRadioButton;
RadioButtonIT: TRadioButton;
RadioButtonIDPlugins: TRadioButton;
RadioButtonStyles: TRadioButton;
RadioButtonTools: TRadioButton;
RadioButtonSampleProjects: TRadioButton;
RadioButtonPatchesFixes: TRadioButton;
VertScrollBoxCats: TVertScrollBox;
VertScrollBoxContent: TVertScrollBox;
LayoutDesc: TLayout;
Layout1: TLayout;
FlowLayoutItems: TFlowLayout;
FramePackageItem3: TFramePackageItem;
FramePackageItem4: TFramePackageItem;
FramePackageItem5: TFramePackageItem;
FramePackageItem6: TFramePackageItem;
Circle1: TCircle;
PathCurrentCat: TPath;
LabelCurrentCatTitle: TLabel;
LabelCurrentCatDesc: TLabel;
TimerSearch: TTimer;
RadioButtonPython: TRadioButton;
LayoutLoading: TLayout;
RectangleShd: TRectangle;
FloatAnimationShd: TFloatAnimation;
AniIndicator1: TAniIndicator;
LayoutInfo: TLayout;
LabelInfo: TLabel;
LayoutMore: TLayout;
ButtonMore: TButton;
Layout2: TLayout;
Layout4: TLayout;
RadioButtonNew: TRadioButton;
Line1: TLine;
RadioButtonPromoted: TRadioButton;
ButtonServer: TButton;
ButtonServerList: TButton;
PopupMenuServerList: TPopupMenu;
MenuItemD11: TMenuItem;
MenuItemD104: TMenuItem;
MenuItemD103: TMenuItem;
RadioButtonInstalled: TRadioButton;
ImageList16: TImageList;
LineStoragePath: TLineStorage;
RadioButtonPlatforms: TRadioButton;
Rectangle1: TRectangle;
EditSearch: TEdit;
ClearEditButtonSearch: TClearEditButton;
ButtonPers: TButton;
ButtonPersList: TButton;
PopupMenuPersList: TPopupMenu;
MenuItemPersDelphi: TMenuItem;
MenuItemPersCPP: TMenuItem;
LayoutActions: TLayout;
ButtonOptions: TButton;
Path2: TPath;
PopupOptions: TPopup;
Label1: TLabel;
PopupMenuOrderList: TPopupMenu;
MenuItemOrderName: TMenuItem;
MenuItemOrderDate: TMenuItem;
RadioButtonOrderName: TRadioButton;
RadioButtonOrderDate: TRadioButton;
Line2: TLine;
RadioButtonTeeChart: TRadioButton;
RadioButtonFonts: TRadioButton;
RadioButtonHelp: TRadioButton;
RadioButtonDUnit: TRadioButton;
RadioButtonSamples: TRadioButton;
Line3: TLine;
RadioButtonInterbase: TRadioButton;
RadioButtonIoT: TRadioButton;
procedure EditSearchChangeTracking(Sender: TObject);
procedure LayoutHeadResized(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FlowLayoutItemsResized(Sender: TObject);
procedure RadioButtonAllChange(Sender: TObject);
procedure TimerSearchTimer(Sender: TObject);
procedure FloatAnimationShdFinish(Sender: TObject);
procedure ButtonMoreClick(Sender: TObject);
procedure RadioButtonNewChange(Sender: TObject);
procedure MenuItemD103Click(Sender: TObject);
procedure ButtonServerListClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure MenuItemShowCommandClick(Sender: TObject);
procedure ButtonPersListClick(Sender: TObject);
procedure MenuItemPersClick(Sender: TObject);
procedure ButtonOptionsClick(Sender: TObject);
procedure MenuItemOrderClick(Sender: TObject);
procedure RadioButtonOrderNameChange(Sender: TObject);
private
FInited: Boolean;
FCategory: string;
FOffset: Integer;
FOrder: Integer;
FIDEList: TArray<TIDEEntity>;
FCurrentIDE: TIDEEntity;
FPool: TTHreadPool;
FIsNew: Boolean;
FLastSearch: string;
FGetItCmd: TGetItCmd;
FPers: string;
FGlobalOrder: Integer;
function GetPers: string;
procedure LoadPackages(More: Boolean);
procedure ClearItems;
procedure LoadingBegin;
procedure LoadingEnd;
procedure NeedMore(Value: Boolean);
procedure SetCurrentIDE(const Version: string);
function IsInstalled(const Id: string): Boolean;
procedure FOnItemAction(Sender: TObject; const ItemId: string; Action: TItemAction);
procedure AddToInstall(const ItemId: string);
procedure AddToUninstall(const ItemId: string);
procedure RemoveInstalled(const ItemId: string);
procedure AddInstalled(const ItemId: string);
function ExistsItem(const ItemId: string): Boolean;
procedure SetItemInstallState(const ItemId: string; State: Boolean);
procedure DownloadItem(const ItemId: string);
function GetItemById(const ItemId: string; out Item: TGetItPackage): Boolean;
procedure ShowCommandLine(const ItemId: string);
procedure SetPers(const Value: string);
procedure SetOrder(const Value: Integer);
procedure LoadCustomServers;
end;
const
CardMinW = 320;
PageSize = 50;
var
FormMain: TFormMain;
procedure OpenUrl(const URL: string);
implementation
uses
System.Math, System.IniFiles, System.IOUtils, DarkModeApi.FMX, Winapi.ShellAPI,
FMX.Platform.Win;
{$R *.fmx}
procedure OpenUrl(const URL: string);
begin
ShellExecute(ApplicationHWND, 'open', PChar(URL), nil, nil, SW_SHOWNORMAL);
end;
procedure TFormMain.EditSearchChangeTracking(Sender: TObject);
begin
ClearEditButtonSearch.Visible := not EditSearch.Text.IsEmpty;
TimerSearch.Enabled := False;
TimerSearch.Enabled := True;
end;
procedure TFormMain.LoadingBegin;
begin
LabelInfo.Text := 'Loading ...';
LayoutInfo.Visible := True;
LayoutLoading.Visible := True;
RectangleShd.Opacity := 0;
FloatAnimationShd.Enabled := False;
FloatAnimationShd.Inverse := False;
FloatAnimationShd.StartFromCurrent := True;
FloatAnimationShd.Start;
end;
procedure TFormMain.LoadingEnd;
begin
FloatAnimationShd.Enabled := False;
FloatAnimationShd.Inverse := True;
FloatAnimationShd.StartFromCurrent := True;
FloatAnimationShd.Start;
end;
procedure TFormMain.ButtonMoreClick(Sender: TObject);
begin
LoadPackages(True);
end;
procedure TFormMain.ButtonOptionsClick(Sender: TObject);
begin
PopupOptions.PlacementTarget := ButtonOptions;
var Pt: TPointF := ClientToScreen(ButtonOptions.AbsoluteRect.TopLeft);
Pt.Offset(0, ButtonOptions.Height);
PopupOptions.Placement := TPlacement.Left;
//PopupOptions.PlacementRectangle.Rect := TRectF.Create(Pt, PopupOptions.Width, PopupOptions.Height);
PopupOptions.Popup;
end;
procedure TFormMain.ButtonPersListClick(Sender: TObject);
begin
PopupMenuPersList.PopupComponent := ButtonPers;
var Pt: TPointF := ClientToScreen(ButtonPers.AbsoluteRect.TopLeft);
Pt.Offset(0, ButtonPers.Height);
PopupMenuPersList.Popup(Pt.X, Pt.Y);
end;
procedure TFormMain.ButtonServerListClick(Sender: TObject);
begin
PopupMenuServerList.PopupComponent := ButtonServer;
var Pt: TPointF := ClientToScreen(ButtonServer.AbsoluteRect.TopLeft);
Pt.Offset(0, ButtonServer.Height);
PopupMenuServerList.Popup(Pt.X, Pt.Y);
end;
procedure TFormMain.ClearItems;
begin
FlowLayoutItems.BeginUpdate;
try
while FlowLayoutItems.ControlsCount > 0 do
FlowLayoutItems.Controls[0].Free;
finally
FlowLayoutItems.EndUpdate;
end;
FlowLayoutItems.RecalcSize;
end;
procedure TFormMain.NeedMore(Value: Boolean);
begin
LayoutMore.Visible := Value;
end;
function TFormMain.IsInstalled(const Id: string): Boolean;
begin
for var Item in FCurrentIDE.Elements do
if Item = Id then
Exit(True);
Result := False;
end;
function TFormMain.ExistsItem(const ItemId: string): Boolean;
begin
for var Control in FlowLayoutItems.Controls do
if Control is TFramePackageItem then
if TFramePackageItem(Control).Id = ItemId then
Exit(True);
Result := False;
end;
function TFormMain.GetItemById(const ItemId: string; out Item: TGetItPackage): Boolean;
begin
for var Control in FlowLayoutItems.Controls do
if Control is TFramePackageItem then
if TFramePackageItem(Control).Id = ItemId then
begin
Item := TFramePackageItem(Control).Item;
Exit(Assigned(Item));
end;
Result := False;
end;
function TFormMain.GetPers: string;
begin
Result := FPers;
end;
procedure TFormMain.SetItemInstallState(const ItemId: string; State: Boolean);
begin
for var Control in FlowLayoutItems.Controls do
if Control is TFramePackageItem then
if TFramePackageItem(Control).Id = ItemId then
TFramePackageItem(Control).IsInstalled := State;
end;
procedure TFormMain.LoadPackages(More: Boolean);
begin
if not FInited then
Exit;
if not More then
FOffset := 0
else
Inc(FOffset, PageSize);
NeedMore(False);
if FIsNew then
FOrder := 2
else
FOrder := FGlobalOrder;
LoadingBegin;
var Pers := GetPers;
TTask.Run(
procedure
var
Items: TPackages;
begin
try
Items := nil;
try
if FCategory <> '-1000' then
TGetIt.Get(Items, FCategory, FOrder, Pers, EditSearch.Text, PageSize, FOffset)
else
FCurrentIDE.LoadInstalled(Items, EditSearch.Text);
finally
TThread.Queue(nil,
procedure
begin
if not More then
ClearItems;
if Assigned(Items) then
try
for var Item in Items.Items do
begin
if ExistsItem(Item.Id) then
begin
Item.Free;
Continue;
end;
var Frame := TFramePackageItem.Create(FlowLayoutItems);
Frame.Fill(Item, IsInstalled(Item.Id));
Frame.Parent := FlowLayoutItems;
Frame.OnAction := FOnItemAction;
end;
FlowLayoutItems.RecalcSize;
if not More then
VertScrollBoxContent.ViewportPosition := TPointF.Create(0, 0);
if FlowLayoutItems.ControlsCount <= 0 then
begin
LabelInfo.Text := 'No results';
LayoutInfo.Visible := True;
end
else
LayoutInfo.Visible := False;
NeedMore((Length(Items.Items) >= PageSize) and (FCategory <> '-1000'));
finally
Items.Items := [];
Items.Free
end
else
begin
LabelInfo.Text := 'Error';
LayoutInfo.Visible := True;
NeedMore(More);
end;
LoadingEnd;
end);
end;
except
TThread.Queue(nil,
procedure
begin
LabelInfo.Text := 'Error';
LayoutInfo.Visible := True;
NeedMore(More);
end);
end;
end, FPool);
end;
procedure TFormMain.MenuItemD103Click(Sender: TObject);
var
Item: TMenuItem absolute Sender;
begin
SetCurrentIDE(Item.TagString);
LoadPackages(False);
end;
procedure TFormMain.MenuItemOrderClick(Sender: TObject);
var
Item: TMenuItem absolute Sender;
begin
SetOrder(Item.Tag);
LoadPackages(False);
end;
procedure TFormMain.MenuItemPersClick(Sender: TObject);
var
Item: TMenuItem absolute Sender;
begin
SetPers(Item.Tag.ToString);
LoadPackages(False);
end;
procedure TFormMain.MenuItemShowCommandClick(Sender: TObject);
begin
//
end;
procedure TFormMain.FloatAnimationShdFinish(Sender: TObject);
begin
if FloatAnimationShd.Inverse then
LayoutLoading.Visible := False;
end;
procedure TFormMain.FlowLayoutItemsResized(Sender: TObject);
begin
var Cnt := Trunc((FlowLayoutItems.Width) / (CardMinW + 20));
var CardW := Max(CardMinW, (FlowLayoutItems.Width) / Cnt);
if CardW = Infinity then
CardW := CardMinW;
var H: Single := 0;
for var Control in FlowLayoutItems.Controls do
begin
Control.Width := CardW - 20;
H := Max(H, Control.Position.Y + Control.Height);
end;
FlowLayoutItems.Height := H;
end;
procedure TFormMain.AddToInstall(const ItemId: string);
begin
if FCurrentIDE.IsCustom then
begin
ShowMessage('Installation or deinstallation is not possible with a custom server');
Exit;
end;
if FGetItCmd.Execute(FCurrentIDE, TGetItCommand.Create.Install([ItemId]).Config(UseOnline).AcceptEULAs) then
AddInstalled(ItemId);
end;
procedure TFormMain.RemoveInstalled(const ItemId: string);
begin
for var i := Low(FCurrentIDE.Elements) to High(FCurrentIDE.Elements) do
if FCurrentIDE.Elements[i] = ItemId then
begin
Delete(FCurrentIDE.Elements, i, 1);
SetItemInstallState(ItemId, False);
Exit;
end;
end;
procedure TFormMain.AddInstalled(const ItemId: string);
begin
if IsInstalled(ItemId) then
Exit;
SetLength(FCurrentIDE.Elements, Length(FCurrentIDE.Elements) + 1);
FCurrentIDE.Elements[High(FCurrentIDE.Elements)] := ItemId;
SetItemInstallState(ItemId, True);
end;
procedure TFormMain.AddToUninstall(const ItemId: string);
begin
if FCurrentIDE.IsCustom then
begin
ShowMessage('Installation or deinstallation is not possible with a custom server');
Exit;
end;
if FGetItCmd.Execute(FCurrentIDE, TGetItCommand.Create.Uninstall([ItemId])) then
RemoveInstalled(ItemId);
end;
procedure TFormMain.ShowCommandLine(const ItemId: string);
begin
ShowMessage(FCurrentIDE.GetPathGetItCmd + ' ' + TGetItCommand.Create.Install([ItemId]).Config(UseOnline).AcceptEULAs.Build);
end;
procedure TFormMain.DownloadItem(const ItemId: string);
begin
var Item: TGetItPackage;
if GetItemById(ItemId, Item) then
OpenUrl(Item.LibUrl);
end;
procedure TFormMain.FOnItemAction(Sender: TObject; const ItemId: string; Action: TItemAction);
begin
case Action of
TItemAction.Install:
AddToInstall(ItemId);
TItemAction.Download:
DownloadItem(ItemId);
TItemAction.Uninstall:
AddToUninstall(ItemId);
TItemAction.OpenUrl:
OpenUrl(ItemId);
TItemAction.CommandLine:
ShowCommandLine(ItemId);
end;
end;
procedure TFormMain.SetCurrentIDE(const Version: string);
begin
if Length(FIDEList) = 0 then
begin
FCurrentIDE.Version := '';
FCurrentIDE.RootDir := '';
FCurrentIDE.Personalities := 'Default (Olympus)';
FCurrentIDE.ServiceUrl := 'https://getit-olympus.embarcadero.com';
FCurrentIDE.Elements := [];
end
else
begin
var Found: Boolean := False;
for var IDE in FIDEList do
begin
if (not IDE.Version.IsEmpty) and (IDE.Version = Version) then
begin
FCurrentIDE := IDE;
Found := True;
Break;
end;
end;
if not Found then
FCurrentIDE := FIDEList[High(FIDEList)];
end;
ButtonServer.Text := FCurrentIDE.Personalities;
TGetIt.Url := FCurrentIDE.ServiceUrl;
TGetIt.Version := FCurrentIDE.Version;
end;
procedure TFormMain.SetPers(const Value: string);
begin
FPers := Value;
for var i := 0 to PopupMenuPersList.ItemsCount - 1 do
if PopupMenuPersList.Items[i].Tag.ToString = Value then
begin
ButtonPers.Text := PopupMenuPersList.Items[i].Text;
Break;
end;
end;
procedure TFormMain.SetOrder(const Value: Integer);
begin
FGlobalOrder := Value;
if RadioButtonOrderName.IsChecked <> (RadioButtonOrderName.Tag = Value) then
RadioButtonOrderName.IsChecked := RadioButtonOrderName.Tag = Value;
if RadioButtonOrderDate.IsChecked <> (RadioButtonOrderDate.Tag = Value) then
RadioButtonOrderDate.IsChecked := RadioButtonOrderDate.Tag = Value;
end;
procedure TFormMain.LoadCustomServers;
begin
try
if TFile.Exists(TPath.Combine(ExtractFilePath(ParamStr(0)), 'servers.ini')) then
begin
var Ini := TIniFile.Create(TPath.Combine(ExtractFilePath(ParamStr(0)), 'servers.ini'));
try
var Sections := TStringList.Create;
try
Ini.ReadSections(Sections);
for var Section in Sections do
begin
var Url := Ini.ReadString(Section, 'url', '');
if Url.IsEmpty then
Continue;
var Version := Ini.ReadString(Section, 'version', '');
if Version.IsEmpty then
Continue;
var IDE: TIDEEntity;
IDE.ServiceUrl := Url;
IDE.Version := Version;
IDE.Personalities := Section;
IDE.IsCustom := True;
FIDEList := [IDE] + FIDEList;
end;
finally
Sections.Free;
end;
finally
Ini.Free;
end;
end;
except
on E: Exception do
ShowMessage('Error of reading servers.ini:' + #13#10 + E.Message);
end;
end;
procedure TFormMain.FormCreate(Sender: TObject);
begin
try
SetWindowColorModeAsSystem;
except
// never mind
end;
FPool := TThreadPool.Create;
FGetItCmd := TGetItCmd.Create;
ClearItems;
PopupMenuServerList.Clear;
FIDEList := TIDEList.List;
LoadCustomServers;
var IsHaveCustom := False;
for var IDE in FIDEList do
if IDE.IsCustom then
begin
var Item := TMenuItem.Create(PopupMenuServerList);
Item.Text := IDE.Personalities + ' (' + IDE.Version + ')';
Item.TagString := IDE.Version;
Item.OnClick := MenuItemD103Click;
Item.ImageIndex := 0;
PopupMenuServerList.AddObject(Item);
IsHaveCustom := True;
end;
if IsHaveCustom then
begin
var Item := TMenuItem.Create(PopupMenuServerList);
Item.Text := '-';
PopupMenuServerList.AddObject(Item);
end;
for var IDE in FIDEList do
if not IDE.IsCustom then
begin
var Item := TMenuItem.Create(PopupMenuServerList);
Item.Text := IDE.Personalities + ' (' + IDE.Version + ')';
Item.TagString := IDE.Version;
Item.OnClick := MenuItemD103Click;
Item.ImageIndex := 0;
PopupMenuServerList.AddObject(Item);
end;
EditSearch.DisableDisappear := True;
SetOrder(0);
SetPers('1');
SetCurrentIDE('');
FOffset := 0;
LabelInfo.Text := 'Loading ...';
VertScrollBoxCats.AniCalculations.Animation := True;
VertScrollBoxContent.AniCalculations.Animation := True;
RadioButtonNew.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('new');
RadioButtonNew.TagString := '98';
RadioButtonPromoted.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('promoted');
RadioButtonPromoted.TagString := '998';
RadioButtonAll.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('all');
RadioButtonAll.TagString := '';
RadioButtonInstalled.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('installed');
RadioButtonInstalled.TagString := '-1000';
RadioButtonLibs.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('lib');
RadioButtonLibs.TagString := '1';
RadioButtonComponents.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('comps');
RadioButtonComponents.TagString := '2';
RadioButtonTrial.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('trial');
RadioButtonTrial.TagString := '33';
RadioButtonTools.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('tools');
RadioButtonTools.TagString := '46';
RadioButtonStyles.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('styles');
RadioButtonStyles.TagString := '38';
RadioButtonPatchesFixes.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('patches');
RadioButtonPatchesFixes.TagString := '999';
RadioButtonIDPlugins.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('plugins');
RadioButtonIDPlugins.TagString := '37';
RadioButtonSamples.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('samples');
RadioButtonSamples.TagString := '16';
RadioButtonSampleProjects.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('samples');
RadioButtonSampleProjects.TagString := '99; 40';
RadioButtonIT.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('industry');
RadioButtonIT.TagString := '36';
RadioButtonIoT.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('iot');
RadioButtonIoT.TagString := '4';
RadioButtonPlatforms.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('platforms');
RadioButtonPlatforms.TagString := '15';
RadioButtonTeeChart.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('teechart');
RadioButtonTeeChart.TagString := '21';
RadioButtonDUnit.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('dunit');
RadioButtonDUnit.TagString := '22';
RadioButtonInterbase.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('interbase');
RadioButtonInterbase.TagString := '23; 42';
RadioButtonHelp.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('help');
RadioButtonHelp.TagString := '17';
RadioButtonFonts.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('fonts');
RadioButtonFonts.TagString := '14';
RadioButtonPython.StylesData['icon.Data.Data'] := LineStoragePath.GetByName('python');
RadioButtonPython.TagString := '47';
RadioButtonNew.IsChecked := True;
LayoutMore.Visible := False;
FInited := True;
RadioButtonNewChange(RadioButtonNew);
end;
procedure TFormMain.FormDestroy(Sender: TObject);
begin
FPool.Free;
FGetItCmd.Free;
end;
procedure TFormMain.LayoutHeadResized(Sender: TObject);
begin
EditSearch.Width := Min(460, LayoutHead.Width) - 20;
EditSearch.Position.X := LayoutHead.Width / 2 - EditSearch.Width / 2;
if EditSearch.Width > (LayoutActions.Position.X - EditSearch.Position.X - 20) then
begin
EditSearch.Width := Min(460, LayoutActions.Position.X) - 20;
EditSearch.Position.X := LayoutActions.Position.X / 2 - EditSearch.Width / 2;
end;
end;
procedure TFormMain.RadioButtonAllChange(Sender: TObject);
var
Button: TRadioButton absolute Sender;
begin
if Button.IsChecked then
begin
PathCurrentCat.Data.Data := Button.StylesData['icon.Data.Data'].AsString;
LabelCurrentCatTitle.Text := Button.Text;
LabelCurrentCatDesc.Text := Button.Hint;
FLastSearch := '';
EditSearch.Text := '';
FIsNew := False;
FCategory := Button.TagString;
LoadPackages(False);
end;
end;
procedure TFormMain.RadioButtonNewChange(Sender: TObject);
var
Button: TRadioButton absolute Sender;
begin
if Button.IsChecked then
begin
PathCurrentCat.Data.Data := Button.StylesData['icon.Data.Data'].AsString;
LabelCurrentCatTitle.Text := Button.Text;
LabelCurrentCatDesc.Text := Button.Hint;
FCategory := '-1';
FIsNew := True;
FLastSearch := '';
EditSearch.Text := '';
LoadPackages(False);
end;
end;
procedure TFormMain.RadioButtonOrderNameChange(Sender: TObject);
begin
if RadioButtonOrderName.IsChecked then
begin
if FGlobalOrder = 0 then
Exit;
SetOrder(0);
end
else if RadioButtonOrderDate.IsChecked then
begin
if FGlobalOrder = 2 then
Exit;
SetOrder(2)
end
else
begin
if FGlobalOrder = 0 then
Exit;
SetOrder(0);
end;
LoadPackages(False);
end;
procedure TFormMain.TimerSearchTimer(Sender: TObject);
begin
TimerSearch.Enabled := False;
if FLastSearch <> EditSearch.Text then
begin
FLastSearch := EditSearch.Text;
LoadPackages(False);
end;
end;
initialization
{$IFDEF DEBUG}
ReportMemoryLeaksOnShutdown := True;
{$ENDIF}
end.