Ignore:
Timestamp:
Nov 29, 2023, 2:35:44 PM (12 months ago)
Author:
chronos
Message:
  • Modified: HighDpi branch updated to trunk version.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/Common/JobProgressView.pas

    r462 r463  
    1 unit UJobProgressView;
    2 
    3 {$MODE Delphi}
     1unit JobProgressView;
    42
    53interface
     
    75uses
    86  UDpiControls, SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs,
    9   Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math,
     7  Dialogs, ComCtrls, StdCtrls, ExtCtrls, Generics.Collections, Threading, Math,
    108  DateUtils;
    119
     
    7169  end;
    7270
    73   TJobs = class(TObjectList)
     71  TJobs = class(TObjectList<TJob>)
    7472  end;
    7573
     
    105103    procedure ReloadJobList;
    106104    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    107     procedure FormDestroy(Sender: TObject);
    108105    procedure ListViewJobsData(Sender: TObject; Item: TListItem);
    109106    procedure TimerUpdateTimer(Sender: TObject);
     
    157154  end;
    158155
    159   //var
    160   //  FormJobProgressView: TFormJobProgressView;
    161 
    162156procedure Register;
    163157
    164158resourcestring
    165159  SExecuted = 'Executed';
     160
    166161
    167162implementation
     
    187182  try
    188183    try
    189       //raise Exception.Create('Exception in job');
    190184      ProgressView.CurrentJob.Method(Job);
    191185    except
     
    286280end;
    287281
    288 procedure TFormJobProgressView.FormDestroy(Sender:TObject);
    289 begin
    290 end;
    291 
    292282procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem);
    293283begin
    294284  if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then
    295   with TJob(JobProgressView.Jobs[Item.Index]) do begin
     285  with JobProgressView.Jobs[Item.Index] do begin
    296286    Item.Caption := Title;
    297287    if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1
     
    311301  Caption := SPleaseWait;
    312302  try
    313     //Animate1.FileName := ExtractFileDir(UTF8Encode(DpiApplication.ExeName)) +
     303    //Animate1.FileName := ExtractFileDir(UTF8Encode(Application.ExeName)) +
    314304    //  DirectorySeparator + 'horse.avi';
    315305    //Animate1.Active := True;
     
    405395    I := 0;
    406396    while I < Jobs.Count do
    407     with TJob(Jobs[I]) do begin
     397    with Jobs[I] do begin
    408398      CurrentJobIndex := I;
    409       CurrentJob := TJob(Jobs[I]);
     399      CurrentJob := Jobs[I];
    410400      JobProgressChange(Self);
    411401      StartTime := Now;
     
    420410        Method(CurrentJob);
    421411      end else begin
     412        Thread := TJobThread.Create(True);
    422413        try
    423           Thread := TJobThread.Create(True);
    424414          with Thread do begin
    425415            FreeOnTerminate := False;
     
    494484  if AValue = FTerminate then Exit;
    495485  for I := 0 to Jobs.Count - 1 do
    496     TJob(Jobs[I]).Terminate := AValue;
     486    Jobs[I].Terminate := AValue;
    497487  FTerminate := AValue;
    498488end;
     
    620610procedure TProgress.Increment;
    621611begin
    622   try
    623     FLock.Acquire;
     612  FLock.Acquire;
     613  try
    624614    Value := Value + 1;
    625615  finally
     
    630620procedure TProgress.Reset;
    631621begin
    632   try
    633     FLock.Acquire;
     622  FLock.Acquire;
     623  try
    634624    FValue := 0;
    635625  finally
     
    647637begin
    648638  FLock.Free;
    649   inherited Destroy;
     639  inherited;
    650640end;
    651641
     
    678668destructor TJob.Destroy;
    679669begin
    680   Progress.Free;
     670  FreeAndNil(Progress);
    681671  inherited;
    682672end;
Note: See TracChangeset for help on using the changeset viewer.