Ignore:
Timestamp:
Jan 17, 2025, 9:05:54 PM (4 days ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
  • Modified: Remove U prefix from unit names.
  • Modified: Use Gneeric.Collections instead of fgl.
  • Modified: Do not use global form variables.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormImportSources.pas

    r218 r219  
    1 unit UFormImportSources;
    2 
    3 {$mode delphi}
     1unit FormImportSources;
    42
    53interface
     
    75uses
    86  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   ActnList, Menus, UAcronym, UJobProgressView, UListViewSort, LazUTF8, fgl;
     7  ActnList, Menus, Acronym, JobProgressView, ListViewSort, LazUTF8,
     8  Generics.Collections;
    109
    1110type
     
    4443    procedure AProcessExecute(Sender: TObject);
    4544    procedure ARemoveExecute(Sender: TObject);
    46     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    4745    procedure FormCreate(Sender: TObject);
    4846    procedure FormShow(Sender: TObject);
    4947    procedure ListView1Change(Sender: TObject; Item: TListItem;
    5048      Change: TItemChange);
    51     procedure ListView1Click(Sender: TObject);
    5249    procedure ListView1Data(Sender: TObject; Item: TListItem);
    5350    procedure ListView1DblClick(Sender: TObject);
     
    6259  private
    6360    procedure ProcessImportJob(Job: TJob);
    64     procedure FilterList(List: TFPGObjectList<TObject>);
     61    procedure FilterList(List: TObjectList<TObject>);
    6562  public
    6663    ImportSources: TImportSources;
     
    6966  end;
    7067
    71 var
    72   FormImportSources: TFormImportSources;
    7368
    7469implementation
     
    7772
    7873uses
    79   UCore, UFormMain, UFormImportSource;
     74  Core, FormMain, FormImportSource;
    8075
    8176resourcestring
     
    172167procedure TFormImportSources.FormShow(Sender: TObject);
    173168begin
    174   Core.PersistentForm1.Load(Self);
    175169  UpdateList;
    176   Core.ScaleDPI1.ScaleControl(ToolBar1, Core.ScaleDPI1.DesignDPI);
     170  Core.Core.ScaleDPI1.ScaleControl(ToolBar1, Core.Core.ScaleDPI1.DesignDPI);
    177171end;
    178172
     
    182176  if Assigned(Item) and (Change = ctState) then begin
    183177    TImportSource(Item.Data).Enabled := Item.Checked;
    184     Core.AcronymDb.Modified := True;
    185   end;
    186 end;
    187 
    188 procedure TFormImportSources.ListView1Click(Sender: TObject);
    189 begin
    190 
     178    Core.Core.AcronymDb.Modified := True;
     179  end;
    191180end;
    192181
     
    194183var
    195184  NewImportSource: TImportSource;
     185  FormImportSource: TFormImportSource;
    196186  I: Integer;
    197187begin
     
    212202
    213203        NewImportSource := nil;
    214         Core.AcronymDb.Modified := True;
     204        Core.Core.AcronymDb.Modified := True;
    215205        UpdateList;
    216206      end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name]));
     
    229219  if ListView1.Items[I].Selected then begin
    230220    TImportSource(ListView1.Items[I].Data).Enabled := False;
    231     Core.AcronymDb.Modified := True;
     221    Core.Core.AcronymDb.Modified := True;
    232222  end;
    233223  UpdateList;
     
    241231  if ListView1.Items[I].Selected then begin
    242232    TImportSource(ListView1.Items[I].Data).Enabled := True;
    243     Core.AcronymDb.Modified := True;
     233    Core.Core.AcronymDb.Modified := True;
    244234  end;
    245235  UpdateList;
     
    249239var
    250240  NewImportSource: TImportSource;
     241  FormImportSource: TFormImportSource;
    251242begin
    252243  if Assigned(ListView1.Selected) then begin
     
    261252          if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin;
    262253            TImportSource(ListView1.Selected.Data).Assign(NewImportSource);
    263             Core.AcronymDb.Modified := True;
     254            Core.Core.AcronymDb.Modified := True;
    264255          end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name]));
    265256        end else begin
    266257          TImportSource(ListView1.Selected.Data).Assign(NewImportSource);
    267           Core.AcronymDb.Modified := True;
     258          Core.Core.AcronymDb.Modified := True;
    268259        end;
    269260
     
    283274begin
    284275  if Assigned(ListView1.Selected) then begin
    285     Core.AcronymDb.AddedCount := 0;
     276    Core.Core.AcronymDb.AddedCount := 0;
    286277    JobProgressView1.AddJob(SProcessSelectedSource, ProcessImportJob);
    287278    JobProgressView1.Start;
    288279    ShowMessage(Format(SAddedCount, [TImportSource(ListView1.Selected.Data).ItemCount,
    289       Core.AcronymDb.AddedCount]));
     280      Core.Core.AcronymDb.AddedCount]));
    290281  end;
    291282end;
     
    296287end;
    297288
    298 procedure TFormImportSources.FilterList(List: TFPGObjectList<TObject>);
     289procedure TFormImportSources.FilterList(List: TObjectList<TObject>);
    299290var
    300291  I: Integer;
     
    344335end;
    345336
    346 procedure TFormImportSources.FormClose(Sender: TObject;
    347   var CloseAction: TCloseAction);
    348 begin
    349   Core.PersistentForm1.Save(Self);
    350 end;
    351 
    352337procedure TFormImportSources.FormCreate(Sender: TObject);
    353338var
    354339  I: Integer;
    355340begin
    356   Core.Translator.TranslateComponentRecursive(Self);
    357   Core.ThemeManager.UseTheme(Self);
    358341  for I := 0 to ToolBar1.ButtonCount - 1 do
    359342    ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption;
Note: See TracChangeset for help on using the changeset viewer.