Changeset 22 for trunk/Forms


Ignore:
Timestamp:
May 4, 2016, 11:43:42 PM (9 years ago)
Author:
chronos
Message:
  • Added: Now import formats can be specified using new edit windows.
  • Added: Import source can now be downloaded and processed including download from https URLs.
Location:
trunk/Forms
Files:
6 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormAbout.lfm

    r21 r22  
    11object FormAbout: TFormAbout
    22  Left = 866
    3   Height = 488
    4   Top = 532
    5   Width = 616
     3  Height = 397
     4  Top = 623
     5  Width = 473
    66  Caption = 'About'
    7   ClientHeight = 488
    8   ClientWidth = 616
     7  ClientHeight = 397
     8  ClientWidth = 473
    99  OnCreate = FormCreate
    1010  OnShow = FormShow
     
    1414    Height = 55
    1515    Top = 20
    16     Width = 576
     16    Width = 433
    1717    Align = alTop
    1818    BorderSpacing.Around = 20
     
    2626    Height = 48
    2727    Top = 95
    28     Width = 576
     28    Width = 433
    2929    Align = alTop
    3030    BorderSpacing.Around = 20
     
    3434  end
    3535  object ButtonClose: TButton
    36     Left = 521
     36    Left = 378
    3737    Height = 25
    38     Top = 448
     38    Top = 357
    3939    Width = 75
    4040    Anchors = [akRight, akBottom]
     
    4747    Height = 24
    4848    Top = 163
    49     Width = 576
     49    Width = 433
    5050    Align = alTop
    5151    BorderSpacing.Around = 20
     
    5656    Left = 16
    5757    Height = 25
    58     Top = 448
     58    Top = 357
    5959    Width = 139
    6060    Anchors = [akLeft, akBottom]
  • trunk/Forms/UFormAbout.pas

    r21 r22  
    3838resourcestring
    3939  SVersion = 'Version';
    40   SReleaseDate = 'Release date:';
     40  SReleaseDate = 'Release date';
    4141  SLicense = 'License';
    4242
  • trunk/Forms/UFormAcronyms.lfm

    r19 r22  
    2626      item
    2727        Caption = 'Categories'
    28         Width = 300
     28        Width = 305
    2929      end>
    3030    MultiSelect = True
     
    5353    OnFilter = ListViewSort1Filter
    5454    Column = 0
    55     Order = soDown
     55    Order = soUp
    5656    left = 248
    5757    top = 168
     
    7878    object ASelectAll: TAction
    7979      Caption = 'Select all'
     80      OnExecute = ASelectAllExecute
    8081      ShortCut = 16449
    8182    end
  • trunk/Forms/UFormAcronyms.pas

    r19 r22  
    5858
    5959resourcestring
    60   SRemoveAllAcronyms = 'Remove all acronyms';
    61   SRemoveAllAcronymsQuery = 'Do you want to remove all acronyms?';
    6260  SRemoveAcronym = 'Remove acronym';
    6361  SRemoveAcronymQuery = 'Do you want to remove selected acronym?';
     
    256254  AModify.Enabled := Assigned(FormMain.AcronymDb) and Assigned(ListViewAcronyms.Selected);
    257255  AAdd.Enabled := Assigned(FormMain.AcronymDb);
     256  ASelectAll.Enabled := True;
    258257end;
    259258
  • trunk/Forms/UFormImport.pas

    r16 r22  
    4242  SImportedNewAcronyms = 'Imported %d new acronyms.';
    4343
    44 
    45 function DownloadHTTP(URL: string; Stream: TStream): Boolean;
    46 var
    47   HTTPGetResult: Boolean;
    48   HTTPSender: THTTPSend;
    49 begin
    50   Result := False;
    51   HTTPSender := THTTPSend.Create;
    52   try
    53     HTTPGetResult := HTTPSender.HTTPMethod('GET', URL);
    54     if (HTTPSender.ResultCode >= 100) and (HTTPSender.ResultCode <= 299) then begin
    55       HTTPSender.Document.SaveToStream(Stream);
    56       Result := True;
    57     end;
    58   finally
    59     HTTPSender.Free;
    60   end;
    61 end;
    6244
    6345{ TFormImport }
  • trunk/Forms/UFormImportSource.lfm

    r20 r22  
    1010  object EditName: TEdit
    1111    Left = 160
    12     Height = 28
     12    Height = 34
    1313    Top = 10
    1414    Width = 432
     
    1818  object Label1: TLabel
    1919    Left = 10
    20     Height = 20
     20    Height = 24
    2121    Top = 9
    22     Width = 43
     22    Width = 56
    2323    Caption = 'Name:'
    2424    ParentColor = False
     
    2626  object Label2: TLabel
    2727    Left = 8
    28     Height = 20
     28    Height = 24
    2929    Top = 48
    30     Width = 78
     30    Width = 101
    3131    Caption = 'Source URL:'
    3232    ParentColor = False
     
    3434  object EditURL: TEdit
    3535    Left = 160
    36     Height = 28
     36    Height = 34
    3737    Top = 49
    3838    Width = 432
     
    6060    TabOrder = 3
    6161  end
     62  object Label3: TLabel
     63    Left = 11
     64    Height = 24
     65    Top = 96
     66    Width = 108
     67    Caption = 'Data format:'
     68    ParentColor = False
     69  end
     70  object ComboBox1: TComboBox
     71    Left = 160
     72    Height = 36
     73    Top = 91
     74    Width = 432
     75    Anchors = [akTop, akLeft, akRight]
     76    ItemHeight = 0
     77    Style = csDropDownList
     78    TabOrder = 4
     79  end
    6280end
  • trunk/Forms/UFormImportSource.lrt

    r20 r22  
    44TFORMIMPORTSOURCE.BUTTONOK.CAPTION=Ok
    55TFORMIMPORTSOURCE.BUTTONCANCEL.CAPTION=Cancel
     6TFORMIMPORTSOURCE.LABEL3.CAPTION=Data format:
  • trunk/Forms/UFormImportSource.pas

    r20 r22  
    1616    ButtonOk: TButton;
    1717    ButtonCancel: TButton;
     18    ComboBox1: TComboBox;
    1819    EditName: TEdit;
    1920    EditURL: TEdit;
    2021    Label1: TLabel;
    2122    Label2: TLabel;
     23    Label3: TLabel;
    2224  private
    2325    { private declarations }
     
    3436{$R *.lfm}
    3537
     38uses
     39  UFormMain;
     40
    3641{ TFormImportSource }
    3742
    3843procedure TFormImportSource.Load(ImportSource: TImportSource);
     44var
     45  I: Integer;
    3946begin
    4047  EditName.Text := ImportSource.Name;
    4148  EditURL.Text := ImportSource.URL;
     49  while ComboBox1.Items.Count > FormMain.AcronymDb.ImportFormats.Count do
     50    ComboBox1.Items.Delete(ComboBox1.Items.Count - 1);
     51  while ComboBox1.Items.Count < FormMain.AcronymDb.ImportFormats.Count do
     52    ComboBox1.Items.Add('');
     53  for I := 0 to FormMain.AcronymDb.ImportFormats.Count - 1 do begin
     54    ComboBox1.Items[I] := TImportFormat(FormMain.AcronymDb.ImportFormats[I]).Name;
     55    ComboBox1.Items.Objects[I] := FormMain.AcronymDb.ImportFormats[I];
     56  end;
     57  ComboBox1.ItemIndex := ComboBox1.Items.IndexOfObject(ImportSource.Format);
     58  if (ComboBox1.ItemIndex = -1) and (ComboBox1.Items.Count > 0) then
     59    ComboBox1.ItemIndex := 0;
    4260end;
    4361
     
    4664  ImportSource.Name := EditName.Text;
    4765  ImportSource.URL := EditURL.Text;
     66  ImportSource.Format := TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]);
    4867end;
    4968
  • trunk/Forms/UFormImportSources.lfm

    r20 r22  
    2222      item
    2323        Caption = 'URL'
    24         Width = 300
     24        Width = 407
    2525      end>
    2626    MultiSelect = True
     
    5454      ShortCut = 13
    5555    end
     56    object AProcess: TAction
     57      Caption = 'Process'
     58      OnExecute = AProcessExecute
     59    end
    5660  end
    5761  object PopupMenuImportSource: TPopupMenu
     
    6872      Action = ARemove
    6973    end
     74    object MenuItem4: TMenuItem
     75      Action = AProcess
     76    end
    7077  end
    7178end
  • trunk/Forms/UFormImportSources.lrt

    r20 r22  
    55TFORMIMPORTSOURCES.AREMOVE.CAPTION=Remove
    66TFORMIMPORTSOURCES.AMODIFY.CAPTION=Modify
     7TFORMIMPORTSOURCES.APROCESS.CAPTION=Process
  • trunk/Forms/UFormImportSources.pas

    r20 r22  
    1515  TFormImportSources = class(TForm)
    1616    AAdd: TAction;
     17    AProcess: TAction;
    1718    ActionList1: TActionList;
    1819    AModify: TAction;
     
    2223    MenuItem2: TMenuItem;
    2324    MenuItem3: TMenuItem;
     25    MenuItem4: TMenuItem;
    2426    PopupMenuImportSource: TPopupMenu;
    2527    procedure AAddExecute(Sender: TObject);
    2628    procedure AModifyExecute(Sender: TObject);
     29    procedure AProcessExecute(Sender: TObject);
    2730    procedure ARemoveExecute(Sender: TObject);
    2831    procedure FormShow(Sender: TObject);
     
    5053
    5154resourcestring
    52   SImportSource = 'Import source';
    53   SImportSourceQuery = 'Enter name of import source';
    5455  SRemoveImportSource = 'Remove import sources';
    5556  SRemoveImportSourceQuery = 'Do you really want to remove selected import sources?';
     
    143144end;
    144145
     146procedure TFormImportSources.AProcessExecute(Sender: TObject);
     147begin
     148  if Assigned(ListView1.Selected) then
     149    TImportSource(ListView1.Selected.Data).Process;
     150end;
     151
    145152procedure TFormImportSources.ARemoveExecute(Sender: TObject);
    146153var
  • trunk/Forms/UFormMain.lfm

    r21 r22  
    1313  OnDestroy = FormDestroy
    1414  OnShow = FormShow
    15   LCLVersion = '1.7'
     15  LCLVersion = '1.6.0.4'
    1616  object ListViewAcronyms: TListView
    1717    Left = 8
     
    43714371    Images = ImageList1
    43724372    left = 464
    4373     top = 144
     4373    top = 160
    43744374    object AExit: TAction
    43754375      Caption = 'Exit'
     
    44244424      OnExecute = AShowAboutExecute
    44254425    end
     4426    object AShowImportFormats: TAction
     4427      Caption = 'Import formats'
     4428      OnExecute = AShowImportFormatsExecute
     4429    end
     4430    object AProcessImports: TAction
     4431      Caption = 'Process imports'
     4432      OnExecute = AProcessImportsExecute
     4433    end
    44264434  end
    44274435  object PersistentForm1: TPersistentForm
     
    44734481        Action = AShowImportSources
    44744482      end
     4483      object MenuItem7: TMenuItem
     4484        Action = AShowImportFormats
     4485      end
    44754486    end
    44764487    object MenuItem16: TMenuItem
     
    44784489      object MenuItem17: TMenuItem
    44794490        Action = AImport
     4491      end
     4492      object MenuItem23: TMenuItem
     4493        Action = AProcessImports
    44804494      end
    44814495      object MenuItem18: TMenuItem
     
    45164530    Order = soUp
    45174531    left = 464
    4518     top = 208
     4532    top = 224
    45194533  end
    45204534  object ImageList1: TImageList
  • trunk/Forms/UFormMain.lrt

    r21 r22  
    1717TFORMMAIN.ASHOWIMPORTSOURCES.CAPTION=Import sources
    1818TFORMMAIN.ASHOWABOUT.CAPTION=About
     19TFORMMAIN.ASHOWIMPORTFORMATS.CAPTION=Import formats
     20TFORMMAIN.APROCESSIMPORTS.CAPTION=Process imports
    1921TFORMMAIN.MENUITEM8.CAPTION=File
    2022TFORMMAIN.MENUITEMOPENRECENT.CAPTION=Open recent
  • trunk/Forms/UFormMain.pas

    r21 r22  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    9   ComCtrls, StdCtrls, ExtCtrls, ActnList, UAcronym, UPersistentForm, Contnrs,
     9  ComCtrls, StdCtrls, ExtCtrls, ActnList, UAcronym, UPersistentForm,
    1010  URegistry, ULastOpenedList, UListViewSort, UCoolTranslator, Registry,
    1111  SpecializedList, LazUTF8;
     
    1616
    1717  TFormMain = class(TForm)
     18    AProcessImports: TAction;
     19    AShowImportFormats: TAction;
    1820    AShowAbout: TAction;
    1921    AShowImportSources: TAction;
     
    5254    MenuItem21: TMenuItem;
    5355    MenuItem22: TMenuItem;
     56    MenuItem23: TMenuItem;
    5457    MenuItem4: TMenuItem;
    5558    MenuItem5: TMenuItem;
    5659    MenuItem6: TMenuItem;
     60    MenuItem7: TMenuItem;
    5761    MenuItemOpenRecent: TMenuItem;
    5862    MenuItem2: TMenuItem;
     
    7276    procedure AFileSaveExecute(Sender: TObject);
    7377    procedure AImportExecute(Sender: TObject);
     78    procedure AProcessImportsExecute(Sender: TObject);
    7479    procedure ASettingsExecute(Sender: TObject);
    7580    procedure AShowAboutExecute(Sender: TObject);
     
    7782    procedure AShowCategoriesExecute(Sender: TObject);
    7883    procedure AShowExecute(Sender: TObject);
     84    procedure AShowImportFormatsExecute(Sender: TObject);
    7985    procedure AShowImportSourcesExecute(Sender: TObject);
    8086    procedure CheckBoxExactMathChange(Sender: TObject);
     
    118124
    119125uses
    120   UFormImport, UFormAcronym, UFormSettings, UFormCategories, UFormAcronyms,
    121   UFormImportSource, UFormImportSources, UFormAbout;
     126  UFormImport, UFormSettings, UFormCategories, UFormAcronyms,
     127  UFormImportSources, UFormAbout, UFormImportFormats;
    122128
    123129resourcestring
     
    243249end;
    244250
     251procedure TFormMain.AProcessImportsExecute(Sender: TObject);
     252var
     253  I: Integer;
     254begin
     255  for I := 0 to AcronymDb.ImportSources.Count - 1 do
     256    TImportSource(AcronymDb.ImportSources[I]).Process;
     257  UpdateAcronymsList;
     258  UpdateInterface;
     259end;
     260
    245261procedure TFormMain.ASettingsExecute(Sender: TObject);
    246262begin
     
    271287begin
    272288  Show;
     289end;
     290
     291procedure TFormMain.AShowImportFormatsExecute(Sender: TObject);
     292begin
     293  FormImportFormats.ImportFormats := AcronymDb.ImportFormats;
     294  FormImportFormats.ShowModal;
     295  UpdateInterface;
    273296end;
    274297
Note: See TracChangeset for help on using the changeset viewer.