Ignore:
Timestamp:
Jan 18, 2022, 10:45:33 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Updated to build under Lazarus 2.2.0.
  • Modified: Updated Common package to version 0.9.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UJobProgressView.pas

    r308 r313  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs,
    9   Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math,
     9  Dialogs, ComCtrls, StdCtrls, ExtCtrls, fgl, UThreading, Math,
    1010  DateUtils;
    1111
     
    7171  end;
    7272
    73   TJobs = class(TObjectList)
     73  TJobs = class(TFPGObjectList<TJob>)
    7474  end;
    7575
     
    105105    procedure ReloadJobList;
    106106    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    107     procedure FormDestroy(Sender: TObject);
    108107    procedure ListViewJobsData(Sender: TObject; Item: TListItem);
    109108    procedure TimerUpdateTimer(Sender: TObject);
     
    286285end;
    287286
    288 procedure TFormJobProgressView.FormDestroy(Sender:TObject);
    289 begin
    290 end;
    291 
    292287procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem);
    293288begin
    294289  if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then
    295   with TJob(JobProgressView.Jobs[Item.Index]) do begin
     290  with JobProgressView.Jobs[Item.Index] do begin
    296291    Item.Caption := Title;
    297292    if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1
     
    405400    I := 0;
    406401    while I < Jobs.Count do
    407     with TJob(Jobs[I]) do begin
     402    with Jobs[I] do begin
    408403      CurrentJobIndex := I;
    409       CurrentJob := TJob(Jobs[I]);
     404      CurrentJob := Jobs[I];
    410405      JobProgressChange(Self);
    411406      StartTime := Now;
     
    420415        Method(CurrentJob);
    421416      end else begin
     417        Thread := TJobThread.Create(True);
    422418        try
    423           Thread := TJobThread.Create(True);
    424419          with Thread do begin
    425420            FreeOnTerminate := False;
     
    494489  if AValue = FTerminate then Exit;
    495490  for I := 0 to Jobs.Count - 1 do
    496     TJob(Jobs[I]).Terminate := AValue;
     491    Jobs[I].Terminate := AValue;
    497492  FTerminate := AValue;
    498493end;
     
    620615procedure TProgress.Increment;
    621616begin
    622   try
    623     FLock.Acquire;
     617  FLock.Acquire;
     618  try
    624619    Value := Value + 1;
    625620  finally
     
    630625procedure TProgress.Reset;
    631626begin
    632   try
    633     FLock.Acquire;
     627  FLock.Acquire;
     628  try
    634629    FValue := 0;
    635630  finally
     
    678673destructor TJob.Destroy;
    679674begin
    680   Progress.Free;
     675  FreeAndNil(Progress);
    681676  inherited;
    682677end;
Note: See TracChangeset for help on using the changeset viewer.