Ignore:
Timestamp:
Mar 18, 2022, 1:37:03 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Update Common package.
File:
1 edited

Legend:

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

    r122 r131  
    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);
     
    175174  STotalEstimatedTime = 'Total estimated time: %s';
    176175  SFinished = 'Finished';
    177   SOperations = 'Operations:';
    178176
    179177procedure Register;
     
    287285end;
    288286
    289 procedure TFormJobProgressView.FormDestroy(Sender:TObject);
    290 begin
    291 end;
    292 
    293287procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem);
    294288begin
    295289  if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then
    296   with TJob(JobProgressView.Jobs[Item.Index]) do begin
     290  with JobProgressView.Jobs[Item.Index] do begin
    297291    Item.Caption := Title;
    298292    if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1
     
    406400    I := 0;
    407401    while I < Jobs.Count do
    408     with TJob(Jobs[I]) do begin
     402    with Jobs[I] do begin
    409403      CurrentJobIndex := I;
    410       CurrentJob := TJob(Jobs[I]);
     404      CurrentJob := Jobs[I];
    411405      JobProgressChange(Self);
    412406      StartTime := Now;
     
    421415        Method(CurrentJob);
    422416      end else begin
     417        Thread := TJobThread.Create(True);
    423418        try
    424           Thread := TJobThread.Create(True);
    425419          with Thread do begin
    426420            FreeOnTerminate := False;
     
    495489  if AValue = FTerminate then Exit;
    496490  for I := 0 to Jobs.Count - 1 do
    497     TJob(Jobs[I]).Terminate := AValue;
     491    Jobs[I].Terminate := AValue;
    498492  FTerminate := AValue;
    499493end;
     
    621615procedure TProgress.Increment;
    622616begin
    623   try
    624     FLock.Acquire;
     617  FLock.Acquire;
     618  try
    625619    Value := Value + 1;
    626620  finally
     
    631625procedure TProgress.Reset;
    632626begin
    633   try
    634     FLock.Acquire;
     627  FLock.Acquire;
     628  try
    635629    FValue := 0;
    636630  finally
     
    679673destructor TJob.Destroy;
    680674begin
    681   Progress.Free;
     675  FreeAndNil(Progress);
    682676  inherited;
    683677end;
Note: See TracChangeset for help on using the changeset viewer.