Some todo.
[brdnet.git] / gui / Forms1.pas
blob4f94c813217c60b04e8d24a8f435f1c8cbfa1c74
1 unit Forms1;
3 {$mode objfpc}{$H+}
5 interface
7 uses
8 SysUtils, Classes, fpg_base, fpg_main,
9 fpg_form, fpg_button, fpg_tab, fpg_edit,
10 fpg_label, fpg_checkbox,fpg_gauge, fpg_panel,fpg_dialogs;
11 type
13 TFormTestFS = class(TfpgForm)
14 private
15 {@VFD_HEAD_BEGIN: FormTestFS}
16 GroupBox1: TfpgGroupBox;
17 EditFID: TfpgEdit;
18 ButtonDelete: TfpgButton;
19 ButtonLookup: TfpgButton;
20 EditSRC: TfpgEdit;
21 Label1: TfpgLabel;
22 Label2: TfpgLabel;
23 GroupBox2: TfpgGroupBox;
24 LabelTotal: TfpgLabel;
25 LabelRate: TfpgLabel;
26 LabelMiss: TfpgLabel;
27 GaugeProgress: TfpgGauge;
28 Label3: TfpgLabel;
29 Label4: TfpgLabel;
30 Label5: TfpgLabel;
31 LabelError: TfpgLabel;
32 ButtonStart: TfpgButton;
33 ButtonAbort: TfpgButton;
34 CheckAttach: TfpgCheckBox;
35 {@VFD_HEAD_END: FormTestFS}
36 public
37 procedure AfterCreate; override;
38 end;
40 TFormRoot = class(TfpgForm)
41 private
42 {@VFD_HEAD_BEGIN: FormRoot}
43 Label2: TfpgLabel;
44 ConnStatus: TfpgLabel;
45 PageControl1: TfpgPageControl;
46 TabSheetInfo: TfpgTabSheet;
47 Label1: TfpgLabel;
48 TabSheetDebug: TfpgTabSheet;
49 ButtonTestFS: TfpgButton;
50 TabSheetConn: TfpgTabSheet;
51 {@VFD_HEAD_END: FormRoot}
52 FormTestFS: tFormTestFS;
53 procedure ClickDebugDownload(Sender: TObject);
54 procedure evClose(Sender: TObject;var CloseAction: TCloseAction);
55 public
56 procedure AfterCreate; override;
57 end;
59 {@VFD_NEWFORM_DECL}
61 implementation
63 {@VFD_NEWFORM_IMPL}
65 procedure TFormTestFS.AfterCreate;
66 begin
67 {%region 'Auto-generated GUI code' -fold}
68 {@VFD_BODY_BEGIN: FormTestFS}
69 Name := 'FormTestFS';
70 SetPosition(762, 190, 350, 329);
71 WindowTitle := 'BrodNet - TestFS';
72 Hint := '';
73 IconName := '';
75 GroupBox1 := TfpgGroupBox.Create(self);
76 with GroupBox1 do
77 begin
78 Name := 'GroupBox1';
79 SetPosition(0, 2, 350, 160);
80 Anchors := [anLeft,anRight,anTop];
81 Alignment := taCenter;
82 FontDesc := '#Label1';
83 Hint := '';
84 Text := 'FileServer Test Parameters';
85 end;
87 EditFID := TfpgEdit.Create(GroupBox1);
88 with EditFID do
89 begin
90 Name := 'EditFID';
91 SetPosition(10, 32, 330, 24);
92 ExtraHint := '';
93 FontDesc := 'FreeMono-10:bold:antialias=true';
94 Hint := '';
95 ParentShowHint := False;
96 ShowHint := True;
97 TabOrder := 1;
98 Text := '9cb70c44932a00dbe74ca392b3694329fa894768';
99 end;
101 ButtonDelete := TfpgButton.Create(GroupBox1);
102 with ButtonDelete do
103 begin
104 Name := 'ButtonDelete';
105 SetPosition(100, 59, 52, 23);
106 Text := 'Delete';
107 FontDesc := '#Label1';
108 Hint := 'Delete local file, so it can be downloaded again.';
109 ImageName := '';
110 ParentShowHint := False;
111 ShowHint := True;
112 TabOrder := 2;
113 end;
115 ButtonLookup := TfpgButton.Create(GroupBox1);
116 with ButtonLookup do
117 begin
118 Name := 'ButtonLookup';
119 SetPosition(12, 59, 80, 23);
120 Text := 'Lookup';
121 Enabled := False;
122 FontDesc := '#Label1';
123 Hint := 'Lookup source in DHT';
124 ImageName := '';
125 ParentShowHint := False;
126 ShowHint := True;
127 TabOrder := 3;
128 end;
130 EditSRC := TfpgEdit.Create(GroupBox1);
131 with EditSRC do
132 begin
133 Name := 'EditSRC';
134 SetPosition(12, 100, 284, 24);
135 ExtraHint := '';
136 FontDesc := '#Edit1';
137 Hint := 'From whom to download. In NetAddr format.';
138 ParentShowHint := False;
139 ShowHint := True;
140 TabOrder := 4;
141 Text := '//ip4/127.162.32.220/7778';
142 end;
144 Label1 := TfpgLabel.Create(GroupBox1);
145 with Label1 do
146 begin
147 Name := 'Label1';
148 SetPosition(12, 15, 120, 15);
149 FontDesc := '#Label1';
150 Hint := '';
151 Text := 'FileID:';
152 end;
154 Label2 := TfpgLabel.Create(GroupBox1);
155 with Label2 do
156 begin
157 Name := 'Label2';
158 SetPosition(12, 83, 80, 15);
159 FontDesc := '#Label1';
160 Hint := '';
161 Text := 'Source:';
162 end;
164 GroupBox2 := TfpgGroupBox.Create(self);
165 with GroupBox2 do
166 begin
167 Name := 'GroupBox2';
168 SetPosition(0, 170, 350, 133);
169 Anchors := [anLeft,anRight,anTop,anBottom];
170 Alignment := taCenter;
171 FontDesc := '#Label1';
172 Hint := '';
173 Text := 'Progress and Results';
174 end;
176 LabelTotal := TfpgLabel.Create(GroupBox2);
177 with LabelTotal do
178 begin
179 Name := 'LabelTotal';
180 SetPosition(80, 20, 80, 15);
181 FontDesc := '#Label1';
182 Hint := 'Size of the file';
183 ParentShowHint := False;
184 ShowHint := True;
185 Text := '--';
186 end;
188 LabelRate := TfpgLabel.Create(GroupBox2);
189 with LabelRate do
190 begin
191 Name := 'LabelRate';
192 SetPosition(80, 60, 80, 15);
193 FontDesc := '#Label1';
194 Hint := 'Blocks that need to be redownloaded.';
195 ParentShowHint := False;
196 ShowHint := True;
197 Text := '--';
198 end;
200 LabelMiss := TfpgLabel.Create(GroupBox2);
201 with LabelMiss do
202 begin
203 Name := 'LabelMiss';
204 SetPosition(80, 40, 80, 15);
205 FontDesc := '#Label1';
206 Hint := 'Speed of the transfer';
207 ParentShowHint := False;
208 ShowHint := True;
209 Text := '--';
210 end;
212 GaugeProgress := TfpgGauge.Create(GroupBox2);
213 with GaugeProgress do
214 begin
215 Name := 'GaugeProgress';
216 SetPosition(16, 100, 320, 25);
217 Color := TfpgColor($BFBFBEC4);
218 FirstColor := TfpgColor($BF000000);
219 Hint := '%Total Bytes';
220 ParentShowHint := False;
221 Progress := 0;
222 SecondColor := TfpgColor($BF434FFF);
223 ShowHint := True;
224 end;
226 Label3 := TfpgLabel.Create(GroupBox2);
227 with Label3 do
228 begin
229 Name := 'Label3';
230 SetPosition(12, 40, 60, 15);
231 FontDesc := '#Label1';
232 Hint := '';
233 Text := 'Rate:';
234 end;
236 Label4 := TfpgLabel.Create(GroupBox2);
237 with Label4 do
238 begin
239 Name := 'Label4';
240 SetPosition(12, 60, 60, 15);
241 FontDesc := '#Label1';
242 Hint := '';
243 Text := 'Missed:';
244 end;
246 Label5 := TfpgLabel.Create(GroupBox2);
247 with Label5 do
248 begin
249 Name := 'Label5';
250 SetPosition(12, 20, 60, 15);
251 FontDesc := '#Label1';
252 Hint := '';
253 Text := 'Total:';
254 end;
256 LabelError := TfpgLabel.Create(GroupBox2);
257 with LabelError do
258 begin
259 Name := 'LabelError';
260 SetPosition(180, 20, 80, 50);
261 FontDesc := '#Label1';
262 Hint := '';
263 Text := 'ok';
264 end;
266 ButtonStart := TfpgButton.Create(GroupBox1);
267 with ButtonStart do
268 begin
269 Name := 'ButtonStart';
270 SetPosition(12, 130, 80, 23);
271 Text := 'Start';
272 FontDesc := '#Label1';
273 Hint := '';
274 ImageName := '';
275 TabOrder := 7;
276 end;
278 ButtonAbort := TfpgButton.Create(GroupBox1);
279 with ButtonAbort do
280 begin
281 Name := 'ButtonAbort';
282 SetPosition(100, 130, 80, 23);
283 Text := 'Abort';
284 Enabled := False;
285 FontDesc := '#Label1';
286 Hint := '';
287 ImageName := '';
288 TabOrder := 8;
289 end;
291 CheckAttach := TfpgCheckBox.Create(GroupBox1);
292 with CheckAttach do
293 begin
294 Name := 'CheckAttach';
295 SetPosition(163, 60, 76, 19);
296 BoxLayout := tbRightBox;
297 Enabled := False;
298 FontDesc := '#Label1';
299 Hint := '';
300 TabOrder := 10;
301 Text := 'Attached:';
302 end;
304 {@VFD_BODY_END: FormTestFS}
305 {%endregion}
306 end;
309 procedure TFormRoot.AfterCreate;
310 begin
311 {%region 'Auto-generated GUI code' -fold}
312 {@VFD_BODY_BEGIN: FormRoot}
313 Name := 'FormRoot';
314 SetPosition(334, 209, 329, 292);
315 WindowTitle := 'BrodNet - root';
316 Hint := '';
317 IconName := '';
318 OnClose:=@evClose;
320 Label2 := TfpgLabel.Create(self);
321 with Label2 do
322 begin
323 Name := 'Label2';
324 SetPosition(8, 271, 88, 20);
325 Anchors := [anLeft,anBottom];
326 FontDesc := '#Label1';
327 Hint := '';
328 Text := 'Connection: ';
329 end;
331 ConnStatus := TfpgLabel.Create(self);
332 with ConnStatus do
333 begin
334 Name := 'ConnStatus';
335 SetPosition(104, 272, 80, 15);
336 Anchors := [anLeft,anBottom];
337 FontDesc := '#Label1';
338 Hint := '';
339 Text := '---';
340 end;
342 PageControl1 := TfpgPageControl.Create(self);
343 with PageControl1 do
344 begin
345 Name := 'PageControl1';
346 SetPosition(0, 0, 331, 268);
347 Anchors := [anLeft,anRight,anTop,anBottom];
348 Hint := '';
349 TabOrder := 0;
350 end;
352 TabSheetInfo := TfpgTabSheet.Create(PageControl1);
353 with TabSheetInfo do
354 begin
355 Name := 'TabSheetInfo';
356 SetPosition(3, 24, 325, 241);
357 Anchors := [anLeft,anRight,anTop,anBottom];
358 Text := 'Main';
359 end;
361 Label1 := TfpgLabel.Create(TabSheetInfo);
362 with Label1 do
363 begin
364 Name := 'Label1';
365 SetPosition(24, 16, 140, 15);
366 FontDesc := '#Label1';
367 Hint := '';
368 Text := 'Welcome to Brodnet.';
369 end;
371 TabSheetDebug := TfpgTabSheet.Create(PageControl1);
372 with TabSheetDebug do
373 begin
374 Name := 'TabSheetDebug';
375 SetPosition(3, 24, 325, 241);
376 Anchors := [anLeft,anRight,anTop,anBottom];
377 Text := 'Debug/Testing';
378 end;
380 ButtonTestFS := TfpgButton.Create(TabSheetDebug);
381 with ButtonTestFS do
382 begin
383 Name := 'ButtonTestFS';
384 SetPosition(10, 10, 80, 30);
385 Text := 'Download';
386 FontDesc := '#Label1';
387 Hint := '';
388 ImageName := '';
389 TabOrder := 4;
390 OnClick:=@ClickDebugDownload;
391 end;
393 TabSheetConn := TfpgTabSheet.Create(PageControl1);
394 with TabSheetConn do
395 begin
396 Name := 'TabSheetConn';
397 SetPosition(3, 24, 325, 241);
398 Anchors := [anLeft,anRight,anTop,anBottom];
399 Text := 'Daemon';
400 end;
402 {@VFD_BODY_END: FormRoot}
403 {%endregion}
404 FormTestFS := tFormTestFS.Create(fpgApplication);
405 end;
407 procedure tFormRoot.evClose(Sender: TObject;var CloseAction: TCloseAction);
408 begin
409 end;
411 procedure tFormRoot.ClickDebugDownload(Sender: TObject);
412 begin
413 FormTestFS.Show;
414 end;
417 end.