Changeset 131 for trunk/Packages/Common/UJobProgressView.pas
- Timestamp:
- Mar 18, 2022, 1:37:03 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UJobProgressView.pas
r122 r131 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); … … 175 174 STotalEstimatedTime = 'Total estimated time: %s'; 176 175 SFinished = 'Finished'; 177 SOperations = 'Operations:';178 176 179 177 procedure Register; … … 287 285 end; 288 286 289 procedure TFormJobProgressView.FormDestroy(Sender:TObject);290 begin291 end;292 293 287 procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem); 294 288 begin 295 289 if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then 296 with TJob(JobProgressView.Jobs[Item.Index])do begin290 with JobProgressView.Jobs[Item.Index] do begin 297 291 Item.Caption := Title; 298 292 if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1 … … 406 400 I := 0; 407 401 while I < Jobs.Count do 408 with TJob(Jobs[I])do begin402 with Jobs[I] do begin 409 403 CurrentJobIndex := I; 410 CurrentJob := TJob(Jobs[I]);404 CurrentJob := Jobs[I]; 411 405 JobProgressChange(Self); 412 406 StartTime := Now; … … 421 415 Method(CurrentJob); 422 416 end else begin 417 Thread := TJobThread.Create(True); 423 418 try 424 Thread := TJobThread.Create(True);425 419 with Thread do begin 426 420 FreeOnTerminate := False; … … 495 489 if AValue = FTerminate then Exit; 496 490 for I := 0 to Jobs.Count - 1 do 497 TJob(Jobs[I]).Terminate := AValue;491 Jobs[I].Terminate := AValue; 498 492 FTerminate := AValue; 499 493 end; … … 621 615 procedure TProgress.Increment; 622 616 begin 623 try624 FLock.Acquire;617 FLock.Acquire; 618 try 625 619 Value := Value + 1; 626 620 finally … … 631 625 procedure TProgress.Reset; 632 626 begin 633 try634 FLock.Acquire;627 FLock.Acquire; 628 try 635 629 FValue := 0; 636 630 finally … … 679 673 destructor TJob.Destroy; 680 674 begin 681 Progress.Free;675 FreeAndNil(Progress); 682 676 inherited; 683 677 end;
Note:
See TracChangeset
for help on using the changeset viewer.