@@ -19,12 +19,14 @@ interface
19
19
simba.settings,
20
20
simba.httpclient,
21
21
simba.component_treeview,
22
- simba.component_buttonpanel;
22
+ simba.component_buttonpanel,
23
+ simba.component_button;
23
24
24
25
type
25
26
TDownloaderFormNode = class (TTreeNode)
26
27
public
27
28
Commit: String;
29
+ Branch: String;
28
30
DownloadURL: String;
29
31
end ;
30
32
@@ -71,6 +73,7 @@ TSimbaDownloadSimbaForm = class(TForm)
71
73
procedure Label6MouseEnter (Sender: TObject);
72
74
procedure Label6MouseLeave (Sender: TObject);
73
75
private
76
+ FDefaultBranch: String;
74
77
FData: array of record
75
78
Date: String;
76
79
Branch: String;
@@ -83,6 +86,7 @@ TSimbaDownloadSimbaForm = class(TForm)
83
86
84
87
procedure DoGetNodeColor (Node: TTreeNode; var TheColor: TColor);
85
88
procedure DoTreeDoubleClick (Sender: TObject);
89
+ procedure DoCheckClick (Sender: TObject);
86
90
87
91
procedure DoPopulate ;
88
92
procedure DoPopulated (Sender: TObject);
@@ -198,10 +202,20 @@ procedure TSimbaDownloadSimbaForm.FormCreate(Sender: TObject);
198
202
ButtonPanel: TSimbaButtonPanel;
199
203
Control: TControl;
200
204
begin
201
- Color := SimbaTheme.ColorBackground;
205
+ Color := SimbaTheme.ColorFrame;
206
+ Font.Color := SimbaTheme.ColorFont;
202
207
Width := Scale96ToScreen(750 );
203
208
Height := Scale96ToScreen(450 );
204
209
210
+ with TSimbaLabeledCheckButton.Create(Self) do
211
+ begin
212
+ Parent := Self;
213
+ Align := alTop;
214
+ Caption := ' Show all branches' ;
215
+ BorderSpacing.Around := 5 ;
216
+ CheckButton.OnClick := @DoCheckClick;
217
+ end ;
218
+
205
219
FTreeView := TSimbaTreeView.Create(Self, TDownloaderFormNode);
206
220
FTreeView.Parent := Mainpage;
207
221
FTreeView.Align := alClient;
@@ -269,6 +283,23 @@ procedure TSimbaDownloadSimbaForm.DoTreeDoubleClick(Sender: TObject);
269
283
TDownloader.Create(Node, FStatusLabel);
270
284
end ;
271
285
286
+ procedure TSimbaDownloadSimbaForm.DoCheckClick (Sender: TObject);
287
+
288
+ procedure HideOrShowOtherBranches (Node: TTreeNode);
289
+ begin
290
+ if TSimbaCheckButton(Sender).Down then
291
+ Node.Visible := True
292
+ else
293
+ Node.Visible := TDownloaderFormNode(Node).Branch = FDefaultBranch;
294
+ end ;
295
+
296
+ begin
297
+ if (FDefaultBranch = ' ' ) then
298
+ Exit;
299
+
300
+ FTreeView.ForEachTopLevel(@HideOrShowOtherBranches);
301
+ end ;
302
+
272
303
procedure TSimbaDownloadSimbaForm.DoPopulate ;
273
304
var
274
305
Count: Integer = 0 ;
@@ -297,6 +328,8 @@ procedure TSimbaDownloadSimbaForm.DoPopulate;
297
328
298
329
if (Length(Lines) > 0 ) then
299
330
begin
331
+ FDefaultBranch := Lines[0 ].Between(' <!--' , ' -->' );
332
+
300
333
SetLength(FData, Length(Lines));
301
334
for I := 6 to High(Lines) do
302
335
begin
@@ -320,7 +353,7 @@ procedure TSimbaDownloadSimbaForm.DoPopulated(Sender: TObject);
320
353
var
321
354
I: Integer;
322
355
Download: String;
323
- Node: TTreeNode ;
356
+ Node: TDownloaderFormNode ;
324
357
begin
325
358
if (Length(FData) = 0 ) then
326
359
begin
@@ -332,9 +365,14 @@ procedure TSimbaDownloadSimbaForm.DoPopulated(Sender: TObject);
332
365
FTreeView.Clear();
333
366
for I := 0 to High(FData) do
334
367
begin
335
- Node := FTreeView.AddNode(FData[I].Date + ' | ' + FData[I].Branch + ' | ' + FData[I].Commit);
368
+ Node := TDownloaderFormNode(FTreeView.AddNode(FData[I].Date + ' | ' + FData[I].Branch + ' | ' + FData[I].Commit));
369
+ Node.Commit := FData[I].Commit;
370
+ Node.Branch := FData[I].Branch;
336
371
for Download in FData[i].Downloads do
337
372
AddDownloadNode(Node, Download, FData[I].Commit);
373
+
374
+ // by default other branches are not visible
375
+ Node.Visible := (FDefaultBranch = ' ' ) or (Node.Branch = FDefaultBranch);
338
376
end ;
339
377
FTreeView.EndUpdate();
340
378
if (FTreeView.Items.Count > 0 ) then
0 commit comments