Changeset 130 for trunk/Packages/Common/UJobProgressView.pas
- Timestamp:
- Jan 18, 2022, 12:08:41 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UJobProgressView.pas
r105 r130 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs, 9 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math,9 Dialogs, ComCtrls, StdCtrls, ExtCtrls, fgl, UThreading, Math, 10 10 DateUtils; 11 11 … … 71 71 end; 72 72 73 TJobs = class(T ObjectList)73 TJobs = class(TFPGObjectList<TJob>) 74 74 end; 75 75 … … 105 105 procedure ReloadJobList; 106 106 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 107 procedure FormDestroy(Sender: TObject);108 107 procedure ListViewJobsData(Sender: TObject; Item: TListItem); 109 108 procedure TimerUpdateTimer(Sender: TObject); … … 286 285 end; 287 286 288 procedure TFormJobProgressView.FormDestroy(Sender:TObject);289 begin290 end;291 292 287 procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem); 293 288 begin 294 289 if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then 295 with TJob(JobProgressView.Jobs[Item.Index])do begin290 with JobProgressView.Jobs[Item.Index] do begin 296 291 Item.Caption := Title; 297 292 if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1 … … 405 400 I := 0; 406 401 while I < Jobs.Count do 407 with TJob(Jobs[I])do begin402 with Jobs[I] do begin 408 403 CurrentJobIndex := I; 409 CurrentJob := TJob(Jobs[I]);404 CurrentJob := Jobs[I]; 410 405 JobProgressChange(Self); 411 406 StartTime := Now; … … 420 415 Method(CurrentJob); 421 416 end else begin 417 Thread := TJobThread.Create(True); 422 418 try 423 Thread := TJobThread.Create(True);424 419 with Thread do begin 425 420 FreeOnTerminate := False; … … 494 489 if AValue = FTerminate then Exit; 495 490 for I := 0 to Jobs.Count - 1 do 496 TJob(Jobs[I]).Terminate := AValue;491 Jobs[I].Terminate := AValue; 497 492 FTerminate := AValue; 498 493 end; … … 620 615 procedure TProgress.Increment; 621 616 begin 622 try623 FLock.Acquire;617 FLock.Acquire; 618 try 624 619 Value := Value + 1; 625 620 finally … … 630 625 procedure TProgress.Reset; 631 626 begin 632 try633 FLock.Acquire;627 FLock.Acquire; 628 try 634 629 FValue := 0; 635 630 finally … … 678 673 destructor TJob.Destroy; 679 674 begin 680 Progress.Free;675 FreeAndNil(Progress); 681 676 inherited; 682 677 end;
Note:
See TracChangeset
for help on using the changeset viewer.