Changeset 22


Ignore:
Timestamp:
May 4, 2016, 11:43:42 PM (8 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
Files:
6 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/AcronymDecoder.lpi

    r21 r22  
    7171      </local>
    7272    </RunParams>
    73     <RequiredPackages Count="5">
     73    <RequiredPackages Count="4">
    7474      <Item1>
    7575        <PackageName Value="CoolTranslator"/>
     
    8585      </Item3>
    8686      <Item4>
    87         <PackageName Value="synapse"/>
    88         <DefaultFilename Value="Packages\synapse\synapse.lpk" Prefer="True"/>
     87        <PackageName Value="LCL"/>
    8988      </Item4>
    90       <Item5>
    91         <PackageName Value="LCL"/>
    92       </Item5>
    9389    </RequiredPackages>
    94     <Units Count="12">
     90    <Units Count="14">
    9591      <Unit0>
    9692        <Filename Value="AcronymDecoder.lpr"/>
     
    150146        <IsPartOfProject Value="True"/>
    151147        <ComponentName Value="FormImportSource"/>
     148        <HasResources Value="True"/>
    152149        <ResourceBaseClass Value="Form"/>
    153150      </Unit9>
     
    156153        <IsPartOfProject Value="True"/>
    157154        <ComponentName Value="FormImportSources"/>
     155        <HasResources Value="True"/>
    158156        <ResourceBaseClass Value="Form"/>
    159157      </Unit10>
     
    165163        <ResourceBaseClass Value="Form"/>
    166164      </Unit11>
     165      <Unit12>
     166        <Filename Value="Forms\UFormImportFormat.pas"/>
     167        <IsPartOfProject Value="True"/>
     168        <ComponentName Value="FormImportFormat"/>
     169        <ResourceBaseClass Value="Form"/>
     170      </Unit12>
     171      <Unit13>
     172        <Filename Value="Forms\UFormImportFormats.pas"/>
     173        <IsPartOfProject Value="True"/>
     174        <ComponentName Value="FormImportFormats"/>
     175        <HasResources Value="True"/>
     176        <ResourceBaseClass Value="Form"/>
     177      </Unit13>
    167178    </Units>
    168179  </ProjectOptions>
  • trunk/AcronymDecoder.lpr

    r21 r22  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UAcronym, synapse, Common, SysUtils, TemplateGenerics, UFormImport,
     10  Forms, UAcronym, Common, SysUtils, TemplateGenerics, UFormImport,
    1111  CoolTranslator, UFormCategorySelect, UFormMain, UFormAcronym, UFormSettings,
    1212  UFormCategories, UFormAcronyms, UFormImportSource, UFormImportSources,
    13 UFormAbout
     13  UFormAbout, UFormImportFormat, UFormImportFormats
    1414  { you can add units after this };
    1515
     
    4242  Application.CreateForm(TFormImportSources, FormImportSources);
    4343  Application.CreateForm(TFormAbout, FormAbout);
     44  Application.CreateForm(TFormImportFormat, FormImportFormat);
     45  Application.CreateForm(TFormImportFormats, FormImportFormats);
    4446  Application.Run;
    4547end.
  • trunk/Example acronyms.adp

    r15 r22  
    839839    </Acronym>
    840840  </Acronyms>
     841  <ImportFormats>
     842    <ImportFormat>
     843      <Id>1</Id>
     844      <Name>Mediawiki acronyms</Name>
     845      <AcronymStartString>&lt;li&gt;&lt;b&gt;</AcronymStartString>
     846      <AcronymEndString>&lt;/b&gt;</AcronymEndString>
     847      <MeaningStartString>–</MeaningStartString>
     848      <MeaningEndString>&lt;/li&gt;</MeaningEndString>
     849      <DescriptionStartString/>
     850      <DescriptionEndString/>
     851    </ImportFormat>
     852    <ImportFormat>
     853      <Id>2</Id>
     854      <Name>MediaWiki Lingo</Name>
     855      <AcronymStartString>mw-lingo-tooltip-abbr"&gt;</AcronymStartString>
     856      <AcronymEndString>&lt;/span&gt;</AcronymEndString>
     857      <MeaningStartString>mw-lingo-tooltip-definition "&gt;</MeaningStartString>
     858      <MeaningEndString>&lt;/span&gt;</MeaningEndString>
     859      <DescriptionStartString/>
     860      <DescriptionEndString/>
     861    </ImportFormat>
     862  </ImportFormats>
     863  <ImportSources>
     864    <ImportSource>
     865      <Name>Wikipedia - List of business and finance abbreviations</Name>
     866      <URL>https://en.wikipedia.org/wiki/List_of_business_and_finance_abbreviations</URL>
     867      <ImportFormat>1</ImportFormat>
     868    </ImportSource>
     869    <ImportSource>
     870      <Name>wiki.zdechov.net terminology</Name>
     871      <URL>http://wiki.zdechov.net/wiki/Terminologie</URL>
     872      <ImportFormat>2</ImportFormat>
     873    </ImportSource>
     874  </ImportSources>
    841875</AcronymDecoderProject>
  • 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
  • trunk/Languages/AcronymDecoder.cs.po

    r21 r22  
    1212"X-Generator: Poedit 1.8.7.1\n"
    1313
     14#: tform1.buttonclose.caption
     15#, fuzzy
     16msgctxt "tform1.buttonclose.caption"
     17msgid "Close"
     18msgstr "Zavřít"
     19
     20#: tform1.caption
     21msgid "Form1"
     22msgstr ""
     23
     24#: tform1.label1.caption
     25#, fuzzy
     26msgctxt "tform1.label1.caption"
     27msgid "Acronym Decoder"
     28msgstr "Acronym Decoder"
     29
     30#: tform1.label2.caption
     31msgid "Tool for quick search and find meaning for various acronyms and abbreviations"
     32msgstr ""
     33
     34#: tform1.labelcontent.caption
     35#, fuzzy
     36msgctxt "tform1.labelcontent.caption"
     37msgid "   "
     38msgstr "   "
     39
    1440#: tformabout.buttonclose.caption
    1541msgctxt "tformabout.buttonclose.caption"
     
    2147msgstr "Domovská stránka"
    2248
     49#: tformabout.caption
     50msgctxt "tformabout.caption"
     51msgid "About"
     52msgstr ""
     53
    2354#: tformabout.labelappname.caption
    2455msgctxt "tformabout.labelappname.caption"
     
    3263
    3364#: tformabout.labeldescription.caption
     65#, fuzzy
     66#| msgid "Simple tool for quick search and find meaning for various acronyms and abbreviations."
    3467msgctxt "tformabout.labeldescription.caption"
    35 msgid "Simple tool for quick search and find meaning for various acronyms and abbreviations."
     68msgid "Simple tool for quick search of meaning for various acronyms and abbreviations."
    3669msgstr "Jednoduchý nástroj pro hledání významu různých zkratek a zkrácení."
    3770
     
    159192
    160193#: tformimport.buttonimport.caption
     194msgctxt "tformimport.buttonimport.caption"
    161195msgid "Process"
    162196msgstr "Zpracovat"
     
    176210
    177211#: tformimport.label1.caption
     212msgctxt "tformimport.label1.caption"
    178213msgid "Data format:"
    179214msgstr "Formát dat:"
     215
     216#: tformimportformat.buttoncancel.caption
     217#, fuzzy
     218msgctxt "tformimportformat.buttoncancel.caption"
     219msgid "Cancel"
     220msgstr "Zrušit"
     221
     222#: tformimportformat.buttonok.caption
     223#, fuzzy
     224msgctxt "tformimportformat.buttonok.caption"
     225msgid "Ok"
     226msgstr "Ok"
     227
     228#: tformimportformat.caption
     229msgid "Import format"
     230msgstr ""
     231
     232#: tformimportformat.label1.caption
     233#, fuzzy
     234msgctxt "tformimportformat.label1.caption"
     235msgid "Name:"
     236msgstr "Název:"
     237
     238#: tformimportformat.label2.caption
     239msgid "Acronym start:"
     240msgstr ""
     241
     242#: tformimportformat.label3.caption
     243msgid "Acronym end:"
     244msgstr ""
     245
     246#: tformimportformat.label4.caption
     247msgid "Meaning start:"
     248msgstr ""
     249
     250#: tformimportformat.label5.caption
     251msgid "Meaning end:"
     252msgstr ""
     253
     254#: tformimportformat.label6.caption
     255msgid "Description start:"
     256msgstr ""
     257
     258#: tformimportformat.label7.caption
     259msgid "Description end:"
     260msgstr ""
     261
     262#: tformimportformats.aadd.caption
     263#, fuzzy
     264msgctxt "tformimportformats.aadd.caption"
     265msgid "Add"
     266msgstr "Přidat"
     267
     268#: tformimportformats.amodify.caption
     269#, fuzzy
     270msgctxt "tformimportformats.amodify.caption"
     271msgid "Modify"
     272msgstr "Upravit"
     273
     274#: tformimportformats.aremove.caption
     275#, fuzzy
     276msgctxt "tformimportformats.aremove.caption"
     277msgid "Remove"
     278msgstr "Odebrat"
     279
     280#: tformimportformats.caption
     281#, fuzzy
     282msgctxt "tformimportformats.caption"
     283msgid "Import sources"
     284msgstr "Zdroje importu"
     285
     286#: tformimportformats.listview1.columns[0].caption
     287#, fuzzy
     288msgctxt "tformimportformats.listview1.columns[0].caption"
     289msgid "Name"
     290msgstr "Název"
    180291
    181292#: tformimportsource.buttoncancel.caption
     
    203314msgstr "Zdrojové URL:"
    204315
     316#: tformimportsource.label3.caption
     317#, fuzzy
     318msgctxt "tformimportsource.label3.caption"
     319msgid "Data format:"
     320msgstr "Formát dat:"
     321
    205322#: tformimportsources.aadd.caption
    206323msgctxt "tformimportsources.aadd.caption"
     
    213330msgstr "Upravit"
    214331
     332#: tformimportsources.aprocess.caption
     333#, fuzzy
     334msgctxt "tformimportsources.aprocess.caption"
     335msgid "Process"
     336msgstr "Zpracovat"
     337
    215338#: tformimportsources.aremove.caption
    216339msgctxt "tformimportsources.aremove.caption"
     
    262385msgstr "Importovat"
    263386
     387#: tformmain.aprocessimports.caption
     388msgid "Process imports"
     389msgstr ""
     390
    264391#: tformmain.asettings.caption
    265392msgctxt "tformmain.asettings.caption"
     
    271398msgstr "Ukázat"
    272399
     400#: tformmain.ashowabout.caption
     401msgctxt "tformmain.ashowabout.caption"
     402msgid "About"
     403msgstr ""
     404
    273405#: tformmain.ashowacronyms.caption
    274406msgctxt "tformmain.ashowacronyms.caption"
     
    281413msgstr "Kategorie"
    282414
     415#: tformmain.ashowimportformats.caption
     416msgid "Import formats"
     417msgstr ""
     418
    283419#: tformmain.ashowimportsources.caption
    284420msgctxt "tformmain.ashowimportsources.caption"
     
    366502
    367503#: uformabout.sreleasedate
    368 msgid "Release date:"
     504#, fuzzy
     505#| msgid "Release date:"
     506msgid "Release date"
    369507msgstr "Datum uvolnění:"
    370508
     
    398536msgstr "Chcete odebrat vybranou zkratku?"
    399537
    400 #: uformacronyms.sremoveallacronyms
    401 msgctxt "uformacronyms.sremoveallacronyms"
    402 msgid "Remove all acronyms"
    403 msgstr "Odebrat všechny zkratky"
    404 
    405 #: uformacronyms.sremoveallacronymsquery
    406 msgctxt "uformacronyms.sremoveallacronymsquery"
    407 msgid "Do you want to remove all acronyms?"
    408 msgstr "Chcete odebrat všechny zkratky?"
    409 
    410538#: uformcategories.scategory
    411539msgctxt "uformcategories.scategory"
     
    435563msgstr "Importováno %d nových zkratek."
    436564
    437 #: uformimportsources.simportsource
    438 msgctxt "uformimportsources.simportsource"
    439 msgid "Import source"
    440 msgstr "Zdroje importu"
     565#: uformimportformats.simportformatalreadyexists
     566msgid "Import format %s already exists!"
     567msgstr ""
     568
     569#: uformimportformats.sremoveimportformat
     570msgid "Remove import formats"
     571msgstr ""
     572
     573#: uformimportformats.sremoveimportformatquery
     574msgid "Do you really want to remove selected import formats?"
     575msgstr ""
    441576
    442577#: uformimportsources.simportsourcealreadyexists
     578msgctxt "uformimportsources.simportsourcealreadyexists"
    443579msgid "Import source %s already exists!"
    444580msgstr "Zdroj importu %s již existuje!"
    445581
    446 #: uformimportsources.simportsourcequery
    447 msgid "Enter name of import source"
    448 msgstr "Zadejte jméno zdroje importu"
    449 
    450582#: uformimportsources.sremoveimportsource
     583msgctxt "uformimportsources.sremoveimportsource"
    451584msgid "Remove import sources"
    452585msgstr "Odstranit zdroje importu"
    453586
    454587#: uformimportsources.sremoveimportsourcequery
     588msgctxt "uformimportsources.sremoveimportsourcequery"
    455589msgid "Do you really want to remove selected import sources?"
    456590msgstr "Opravdu chcete odebrat vybrané zdroje importu?"
     
    467601msgid "modified"
    468602msgstr "upraveno"
     603
  • trunk/Languages/AcronymDecoder.po

    r21 r22  
    3636
    3737#: tformabout.caption
     38msgctxt "tformabout.caption"
    3839msgid "About"
    3940msgstr ""
     
    5152#: tformabout.labeldescription.caption
    5253msgctxt "TFORMABOUT.LABELDESCRIPTION.CAPTION"
    53 msgid "Simple tool for quick search and find meaning for various acronyms and abbreviations."
     54msgid "Simple tool for quick search of meaning for various acronyms and abbreviations."
    5455msgstr ""
    5556
     
    177178
    178179#: tformimport.buttonimport.caption
     180msgctxt "tformimport.buttonimport.caption"
    179181msgid "Process"
    180182msgstr ""
     
    194196
    195197#: tformimport.label1.caption
     198msgctxt "tformimport.label1.caption"
    196199msgid "Data format:"
     200msgstr ""
     201
     202#: tformimportformat.buttoncancel.caption
     203msgctxt "TFORMIMPORTFORMAT.BUTTONCANCEL.CAPTION"
     204msgid "Cancel"
     205msgstr ""
     206
     207#: tformimportformat.buttonok.caption
     208msgctxt "TFORMIMPORTFORMAT.BUTTONOK.CAPTION"
     209msgid "Ok"
     210msgstr ""
     211
     212#: tformimportformat.caption
     213msgid "Import format"
     214msgstr ""
     215
     216#: tformimportformat.label1.caption
     217msgctxt "TFORMIMPORTFORMAT.LABEL1.CAPTION"
     218msgid "Name:"
     219msgstr ""
     220
     221#: tformimportformat.label2.caption
     222msgid "Acronym start:"
     223msgstr ""
     224
     225#: tformimportformat.label3.caption
     226msgid "Acronym end:"
     227msgstr ""
     228
     229#: tformimportformat.label4.caption
     230msgid "Meaning start:"
     231msgstr ""
     232
     233#: tformimportformat.label5.caption
     234msgid "Meaning end:"
     235msgstr ""
     236
     237#: tformimportformat.label6.caption
     238msgid "Description start:"
     239msgstr ""
     240
     241#: tformimportformat.label7.caption
     242msgid "Description end:"
     243msgstr ""
     244
     245#: tformimportformats.aadd.caption
     246msgctxt "TFORMIMPORTFORMATS.AADD.CAPTION"
     247msgid "Add"
     248msgstr ""
     249
     250#: tformimportformats.amodify.caption
     251msgctxt "TFORMIMPORTFORMATS.AMODIFY.CAPTION"
     252msgid "Modify"
     253msgstr ""
     254
     255#: tformimportformats.aremove.caption
     256msgctxt "TFORMIMPORTFORMATS.AREMOVE.CAPTION"
     257msgid "Remove"
     258msgstr ""
     259
     260#: tformimportformats.caption
     261msgctxt "TFORMIMPORTFORMATS.CAPTION"
     262msgid "Import sources"
     263msgstr ""
     264
     265#: tformimportformats.listview1.columns[0].caption
     266msgctxt "TFORMIMPORTFORMATS.LISTVIEW1.COLUMNS[0].CAPTION"
     267msgid "Name"
    197268msgstr ""
    198269
     
    221292msgstr ""
    222293
     294#: tformimportsource.label3.caption
     295msgctxt "TFORMIMPORTSOURCE.LABEL3.CAPTION"
     296msgid "Data format:"
     297msgstr ""
     298
    223299#: tformimportsources.aadd.caption
    224300msgctxt "TFORMIMPORTSOURCES.AADD.CAPTION"
     
    231307msgstr ""
    232308
     309#: tformimportsources.aprocess.caption
     310msgctxt "TFORMIMPORTSOURCES.APROCESS.CAPTION"
     311msgid "Process"
     312msgstr ""
     313
    233314#: tformimportsources.aremove.caption
    234315msgctxt "TFORMIMPORTSOURCES.AREMOVE.CAPTION"
     
    280361msgstr ""
    281362
     363#: tformmain.aprocessimports.caption
     364msgid "Process imports"
     365msgstr ""
     366
    282367#: tformmain.asettings.caption
    283368msgctxt "tformmain.asettings.caption"
     
    290375
    291376#: tformmain.ashowabout.caption
     377msgctxt "tformmain.ashowabout.caption"
    292378msgid "About"
    293379msgstr ""
     
    303389msgstr ""
    304390
     391#: tformmain.ashowimportformats.caption
     392msgid "Import formats"
     393msgstr ""
     394
    305395#: tformmain.ashowimportsources.caption
    306396msgctxt "TFORMMAIN.ASHOWIMPORTSOURCES.CAPTION"
     
    388478
    389479#: uformabout.sreleasedate
    390 msgid "Release date:"
     480msgid "Release date"
    391481msgstr ""
    392482
     
    420510msgstr ""
    421511
    422 #: uformacronyms.sremoveallacronyms
    423 msgctxt "uformacronyms.sremoveallacronyms"
    424 msgid "Remove all acronyms"
    425 msgstr ""
    426 
    427 #: uformacronyms.sremoveallacronymsquery
    428 msgctxt "uformacronyms.sremoveallacronymsquery"
    429 msgid "Do you want to remove all acronyms?"
    430 msgstr ""
    431 
    432512#: uformcategories.scategory
    433513msgctxt "uformcategories.scategory"
     
    457537msgstr ""
    458538
    459 #: uformimportsources.simportsource
    460 msgctxt "uformimportsources.simportsource"
    461 msgid "Import source"
     539#: uformimportformats.simportformatalreadyexists
     540msgid "Import format %s already exists!"
     541msgstr ""
     542
     543#: uformimportformats.sremoveimportformat
     544msgid "Remove import formats"
     545msgstr ""
     546
     547#: uformimportformats.sremoveimportformatquery
     548msgid "Do you really want to remove selected import formats?"
    462549msgstr ""
    463550
    464551#: uformimportsources.simportsourcealreadyexists
     552msgctxt "uformimportsources.simportsourcealreadyexists"
    465553msgid "Import source %s already exists!"
    466554msgstr ""
    467555
    468 #: uformimportsources.simportsourcequery
    469 msgid "Enter name of import source"
    470 msgstr ""
    471 
    472556#: uformimportsources.sremoveimportsource
     557msgctxt "uformimportsources.sremoveimportsource"
    473558msgid "Remove import sources"
    474559msgstr ""
    475560
    476561#: uformimportsources.sremoveimportsourcequery
     562msgctxt "uformimportsources.sremoveimportsourcequery"
    477563msgid "Do you really want to remove selected import sources?"
    478564msgstr ""
  • trunk/Packages/synapse/synapse.lpk

    r1 r22  
    1 <?xml version="1.0"?>
     1<?xml version="1.0" encoding="UTF-8"?>
    22<CONFIG>
    3   <Package Version="3">
     3  <Package Version="4">
    44    <PathDelim Value="\"/>
    55    <Name Value="synapse"/>
     6    <Type Value="RunAndDesignTime"/>
     7    <AddToProjectUsesSection Value="True"/>
    68    <CompilerOptions>
    7       <Version Value="9"/>
     9      <Version Value="11"/>
    810      <PathDelim Value="\"/>
    911      <SearchPaths>
     12        <OtherUnitFiles Value="."/>
    1013        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    1114      </SearchPaths>
     
    1518        </SyntaxOptions>
    1619      </Parsing>
    17       <Other>
    18         <CompilerPath Value="$(CompPath)"/>
    19       </Other>
    2020    </CompilerOptions>
    2121    <Files Count="31">
     
    145145      </Item31>
    146146    </Files>
    147     <Type Value="RunAndDesignTime"/>
    148147    <RequiredPkgs Count="1">
    149148      <Item1>
  • trunk/Packages/synapse/synaser.pas

    r5 r22  
    22802280  try
    22812281    TmpPorts := '';
    2282     if FindFirst('/dev/ttyS*', $FFFFFFFF, sr) = 0 then
     2282    if FindFirst('/dev/ttyS*', $7FFFFFFF, sr) = 0 then
    22832283    begin
    22842284      repeat
  • trunk/UAcronym.pas

    r20 r22  
    77uses
    88  Classes, SysUtils, Contnrs, XMLConf, XMLRead, XMLWrite, DOM, UXMLUtils,
    9   SpecializedList;
     9  SpecializedList, fphttpclient;
    1010
    1111type
     
    1414  TAcronymDb = class;
    1515  TImportSources = class;
     16  TImportFormats = class;
    1617
    1718  TAcronymSource = class
     
    122123    Meaning: TImportPattern;
    123124    Description: TImportPattern;
     125    Formats: TImportFormats;
     126    procedure Assign(Source: TImportFormat);
    124127    procedure SaveToNode(Node: TDOMNode);
    125128    procedure LoadFromNode(Node: TDOMNode);
     
    132135    procedure SaveToNode(Node: TDOMNode);
    133136    procedure LoadFromNode(Node: TDOMNode);
     137    function SearchByName(Name: string): TImportFormat;
    134138    function SearchById(Id: Integer): TImportFormat;
    135139  end;
     
    143147    LastTime: TDateTime;
    144148    Sources: TImportSources;
     149    procedure Process;
    145150    procedure Assign(Source: TImportSource);
    146151    procedure SaveToNode(Node: TDOMNode);
     
    194199end;
    195200
     201function DownloadHTTP(URL: string; Stream: TStream): Boolean;
     202var
     203  HTTPClient: TFPHTTPClient;
     204begin
     205  HTTPClient := TFPHttpClient.Create(nil);
     206  HTTPClient.Get(URL, Stream);
     207  HTTPClient.Free;
     208  Result := True;
     209end;
     210
     211function StripHTML(S: string): string;
     212var
     213  TagBegin, TagEnd, TagLength: Integer;
     214begin
     215  TagBegin := Pos( '<', S);      // search position of first <
     216
     217  while (TagBegin > 0) do begin  // while there is a < in S
     218    TagEnd := Pos('>', S);              // find the matching >
     219    TagLength := TagEnd - TagBegin + 1;
     220    Delete(S, TagBegin, TagLength);     // delete the tag
     221    TagBegin:= Pos( '<', S);            // search for next <
     222  end;
     223
     224  Result := S;                   // give the result
     225end;
     226
    196227{ TImportFormat }
     228
     229procedure TImportFormat.Assign(Source: TImportFormat);
     230begin
     231  Name := Source.Name;
     232  Acronym.StartString := Source.Acronym.StartString;
     233  Acronym.EndString := Source.Acronym.EndString;
     234  Meaning.StartString := Source.Meaning.StartString;
     235  Meaning.EndString := Source.Meaning.EndString;
     236  Description.StartString := Source.Description.StartString;
     237  Description.EndString := Source.Description.EndString;
     238end;
    197239
    198240procedure TImportFormat.SaveToNode(Node: TDOMNode);
     
    263305{ TImportFormats }
    264306
     307function TImportFormats.SearchByName(Name: string): TImportFormat;
     308var
     309  I: Integer;
     310begin
     311  I := 0;
     312  while (I < Count) and (TImportFormat(Items[I]).Name <> Name) do Inc(I);
     313  if I < Count then Result := TImportFormat(Items[I])
     314    else Result := nil;
     315end;
     316
    265317procedure TImportFormats.UpdateIds;
    266318var
     
    323375
    324376{ TImportSource }
     377
     378procedure TImportSource.Process;
     379var
     380  Stream: TMemoryStream;
     381  S: string;
     382  NewAcronym: TAcronymEntry;
     383  P: Integer;
     384begin
     385  Stream := TMemoryStream.Create;
     386  NewAcronym := TAcronymEntry.Create;
     387  try
     388    if DownloadHTTP(URL, Stream) then begin
     389      Stream.Position := 0;
     390      SetLength(S, Stream.Size);
     391      Stream.Read(S[1], Length(S));
     392      repeat
     393        P := Pos(Format.Acronym.StartString, S);
     394        if P > 0 then begin
     395          // Acronym
     396          Delete(S, 1, P + Length(Format.Acronym.StartString) - 1);
     397          P := Pos(Format.Acronym.EndString, S);
     398          NewAcronym.Name := Trim(StripHTML(Copy(S, 1, P - 1)));
     399          Delete(S, 1, P + Length(Format.Acronym.EndString) - 1);
     400
     401          // Meaning
     402          P := Pos(Format.Meaning.StartString, S);
     403          Delete(S, 1, P + Length(Format.Meaning.StartString) - 1);
     404          P := Pos(Format.Meaning.EndString, S);
     405          NewAcronym.Meaning := Trim(StripHTML(Copy(S, 1, P - 1)));
     406          Delete(S, 1, P + Length(Format.Meaning.EndString) - 1);
     407          Sources.AcronymDb.AddAcronym(NewAcronym.Name, NewAcronym.Meaning);
     408        end else Break;
     409      until False;
     410    end;
     411  finally
     412    NewAcronym.Free;
     413    Stream.Free;
     414  end;
     415end;
    325416
    326417procedure TImportSource.Assign(Source: TImportSource);
Note: See TracChangeset for help on using the changeset viewer.