Ignore:
Timestamp:
Jul 13, 2016, 4:42:12 PM (8 years ago)
Author:
chronos
Message:
  • Added: Job progress view for longer processing of all import sources.
  • Modified: Use application icon also for system tray icon.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r33 r39  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    99  ComCtrls, StdCtrls, ExtCtrls, ActnList, UAcronym, UPersistentForm, URegistry,
    10   ULastOpenedList, UListViewSort, UCoolTranslator, Registry,
     10  ULastOpenedList, UListViewSort, UJobProgressView, UCoolTranslator, Registry,
    1111  SpecializedList, LazUTF8;
    1212
     
    3535    CoolTranslator1: TCoolTranslator;
    3636    ImageList1: TImageList;
     37    JobProgressView1: TJobProgressView;
    3738    LastOpenedList1: TLastOpenedList;
    3839    ListViewAcronyms: TListView;
     
    8081    ToolButton7: TToolButton;
    8182    ToolButton8: TToolButton;
     83    ToolButton9: TToolButton;
    8284    TrayIcon1: TTrayIcon;
    8385    procedure AExitExecute(Sender: TObject);
     
    116118    RegistryContext: TRegistryContext;
    117119    ProjectClosed: Boolean;
     120    ImportTotalItemCount: Integer;
     121    procedure ProcessImportsJob(Job: TJob);
    118122    procedure SetAlwaysOnTop(AValue: Boolean);
    119123    procedure FilterList(List: TListObject);
     
    267271
    268272procedure TFormMain.AProcessImportsExecute(Sender: TObject);
     273begin
     274  ImportTotalItemCount := 0;
     275  JobProgressView1.AddJob('Process import sources', ProcessImportsJob);
     276  JobProgressView1.Start;
     277  ShowMessage(Format(SAddedCount, [ImportTotalItemCount]));
     278  UpdateAcronymsList;
     279  UpdateInterface;
     280end;
     281
     282procedure TFormMain.ProcessImportsJob(Job: TJob);
    269283var
    270284  I: Integer;
    271   TotalItemCount: Integer;
    272 begin
    273   TotalItemCount := 0;
     285begin
    274286  for I := 0 to AcronymDb.ImportSources.Count - 1 do
    275287  with TImportSource(AcronymDb.ImportSources[I]) do
    276288  if Enabled then begin
    277289    Process;
    278     TotalItemCount := TotalItemCount + ItemCount;
    279   end;
    280   ShowMessage(Format(SAddedCount, [TotalItemCount]));
    281   UpdateAcronymsList;
    282   UpdateInterface;
     290    ImportTotalItemCount := ImportTotalItemCount + ItemCount;
     291    Job.Progress.Max := AcronymDb.ImportSources.Count;
     292    Job.Progress.Value := I;
     293    if Job.Terminate then Break;
     294  end;
    283295end;
    284296
Note: See TracChangeset for help on using the changeset viewer.