- Timestamp:
- Jul 12, 2016, 4:28:22 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AcronymDecoder.lpi
r27 r28 181 181 <IsPartOfProject Value="True"/> 182 182 <ComponentName Value="FormImportPattern"/> 183 <HasResources Value="True"/> 183 184 <ResourceBaseClass Value="Form"/> 184 185 </Unit14> -
trunk/Forms/UFormAbout.lfm
r23 r28 1 1 object FormAbout: TFormAbout 2 Left = 8662 Left = 561 3 3 Height = 397 4 Top = 6234 Top = 276 5 5 Width = 473 6 6 Caption = 'About' … … 12 12 object LabelAppName: TLabel 13 13 Left = 20 14 Height = 5 514 Height = 54 15 15 Top = 20 16 16 Width = 433 … … 24 24 object LabelDescription: TLabel 25 25 Left = 20 26 Height = 4 827 Top = 9 526 Height = 40 27 Top = 94 28 28 Width = 433 29 29 Align = alTop … … 45 45 object LabelContent: TLabel 46 46 Left = 20 47 Height = 2 448 Top = 1 6347 Height = 20 48 Top = 154 49 49 Width = 433 50 50 Align = alTop … … 73 73 EmailContact = 'robie@centrum.cz' 74 74 AppName = 'Acronym Decoder' 75 ReleaseDate = 42 49475 ReleaseDate = 42563 76 76 RegistryKey = '\Software\' 77 77 RegistryRoot = rrKeyCurrentUser -
trunk/Forms/UFormImportFormat.lfm
r27 r28 1 1 object FormImportFormat: TFormImportFormat 2 Left = 5142 Left = 461 3 3 Height = 433 4 Top = 3 164 Top = 321 5 5 Width = 664 6 6 Caption = 'Import format' 7 7 ClientHeight = 433 8 8 ClientWidth = 664 9 OnCreate = FormCreate 9 10 OnShow = FormShow 10 11 LCLVersion = '1.6.0.4' … … 99 100 Caption = 'Variable' 100 101 Width = 100 102 end 103 item 104 Caption = 'Repetition' 105 Width = 100 101 106 end> 102 107 OwnerData = True -
trunk/Forms/UFormImportFormat.lrt
r27 r28 9 9 TFORMIMPORTFORMAT.LISTVIEWITEMRULES.COLUMNS[2].CAPTION=Action 10 10 TFORMIMPORTFORMAT.LISTVIEWITEMRULES.COLUMNS[3].CAPTION=Variable 11 TFORMIMPORTFORMAT.LISTVIEWITEMRULES.COLUMNS[4].CAPTION=Repetition 11 12 TFORMIMPORTFORMAT.LABEL2.CAPTION=Item rules: 12 13 TFORMIMPORTFORMAT.AADD.CAPTION=Add -
trunk/Forms/UFormImportFormat.pas
r27 r28 41 41 procedure AMoveUpExecute(Sender: TObject); 42 42 procedure ARemoveExecute(Sender: TObject); 43 procedure FormCreate(Sender: TObject); 43 44 procedure FormShow(Sender: TObject); 44 45 procedure ListViewItemRulesData(Sender: TObject; Item: TListItem); … … 54 55 var 55 56 FormImportFormat: TFormImportFormat; 57 YesNoString: array[Boolean] of string; 56 58 57 59 … … 66 68 SRemoveImportPattern = 'Remove import pattern'; 67 69 SRemoveImportPatternQuery = 'Do you really want to remove selected import patterns?'; 70 SYes = 'Yes'; 71 SNo = 'No'; 68 72 69 73 … … 135 139 end; 136 140 141 procedure TFormImportFormat.FormCreate(Sender: TObject); 142 begin 143 YesNoString[False] := SNo; 144 YesNoString[True] := SYes; 145 end; 146 137 147 procedure TFormImportFormat.FormShow(Sender: TObject); 138 148 begin … … 149 159 Item.SubItems.Add(ImportPatternFlagString[Flag]); 150 160 Item.SubItems.Add(ImportVariableString[Variable]); 161 Item.SubItems.Add(YesNoString[Repetition]); 151 162 Item.Data := ImportFormat.ItemPatterns[Item.Index]; 152 163 end; -
trunk/Forms/UFormImportPattern.lfm
r27 r28 47 47 Top = 384 48 48 Width = 75 49 Anchors = [akRight, akBottom] 49 50 Caption = 'Cancel' 50 51 ModalResult = 2 … … 56 57 Top = 384 57 58 Width = 75 59 Anchors = [akRight, akBottom] 58 60 Caption = 'Ok' 59 61 ModalResult = 1 … … 99 101 TabOrder = 5 100 102 end 103 object CheckBoxRepetition: TCheckBox 104 Left = 24 105 Height = 24 106 Top = 160 107 Width = 93 108 Caption = 'Repetition' 109 TabOrder = 6 110 end 101 111 end -
trunk/Forms/UFormImportPattern.lrt
r27 r28 6 6 TFORMIMPORTPATTERN.LABEL10.CAPTION=Action: 7 7 TFORMIMPORTPATTERN.LABEL11.CAPTION=Variable: 8 TFORMIMPORTPATTERN.CHECKBOXREPETITION.CAPTION=Repetition -
trunk/Forms/UFormImportPattern.pas
r27 r28 16 16 ButtonCancel: TButton; 17 17 ButtonOk: TButton; 18 CheckBoxRepetition: TCheckBox; 18 19 ComboBoxAction: TComboBox; 19 20 ComboBoxVariable: TComboBox; … … 78 79 Pattern.Variable := TImportVariable(ComboBoxVariable.ItemIndex); 79 80 Pattern.Flag := TImportPatternFlag(ComboBoxAction.ItemIndex); 81 Pattern.Repetition := CheckBoxRepetition.Checked; 80 82 end; 81 83 … … 86 88 ComboBoxVariable.ItemIndex := Integer(Pattern.Variable); 87 89 ComboBoxAction.ItemIndex := Integer(Pattern.Flag); 90 CheckBoxRepetition.Checked := Pattern.Repetition; 88 91 end; 89 92 -
trunk/Forms/UFormImportSource.lfm
r22 r28 10 10 object EditName: TEdit 11 11 Left = 160 12 Height = 3412 Height = 28 13 13 Top = 10 14 14 Width = 432 … … 18 18 object Label1: TLabel 19 19 Left = 10 20 Height = 2 420 Height = 20 21 21 Top = 9 22 Width = 5622 Width = 43 23 23 Caption = 'Name:' 24 24 ParentColor = False … … 26 26 object Label2: TLabel 27 27 Left = 8 28 Height = 2 428 Height = 20 29 29 Top = 48 30 Width = 10130 Width = 78 31 31 Caption = 'Source URL:' 32 32 ParentColor = False … … 34 34 object EditURL: TEdit 35 35 Left = 160 36 Height = 3436 Height = 28 37 37 Top = 49 38 38 Width = 432 … … 62 62 object Label3: TLabel 63 63 Left = 11 64 Height = 2 464 Height = 20 65 65 Top = 96 66 Width = 10866 Width = 84 67 67 Caption = 'Data format:' 68 68 ParentColor = False … … 70 70 object ComboBox1: TComboBox 71 71 Left = 160 72 Height = 3672 Height = 28 73 73 Top = 91 74 Width = 43274 Width = 304 75 75 Anchors = [akTop, akLeft, akRight] 76 ItemHeight = 076 ItemHeight = 20 77 77 Style = csDropDownList 78 78 TabOrder = 4 79 79 end 80 object ButtonShowFormat: TButton 81 Left = 472 82 Height = 25 83 Top = 91 84 Width = 120 85 Anchors = [akTop, akRight] 86 Caption = 'Configure' 87 OnClick = ButtonShowFormatClick 88 TabOrder = 5 89 end 80 90 end -
trunk/Forms/UFormImportSource.lrt
r22 r28 5 5 TFORMIMPORTSOURCE.BUTTONCANCEL.CAPTION=Cancel 6 6 TFORMIMPORTSOURCE.LABEL3.CAPTION=Data format: 7 TFORMIMPORTSOURCE.BUTTONSHOWFORMAT.CAPTION=Configure -
trunk/Forms/UFormImportSource.pas
r22 r28 14 14 15 15 TFormImportSource = class(TForm) 16 ButtonShowFormat: TButton; 16 17 ButtonOk: TButton; 17 18 ButtonCancel: TButton; … … 22 23 Label2: TLabel; 23 24 Label3: TLabel; 25 procedure ButtonShowFormatClick(Sender: TObject); 24 26 private 25 27 { private declarations } … … 37 39 38 40 uses 39 UFormMain ;41 UFormMain, UFormImportFormat; 40 42 41 43 { TFormImportSource } 44 45 procedure TFormImportSource.ButtonShowFormatClick(Sender: TObject); 46 var 47 NewImportFormat: TImportFormat; 48 begin 49 if ComboBox1.ItemIndex <> -1 then begin 50 NewImportFormat := TImportFormat.Create; 51 NewImportFormat.Assign(TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex])); 52 FormImportFormat.Load(NewImportFormat); 53 if FormImportFormat.ShowModal = mrOk then begin 54 FormImportFormat.Save(NewImportFormat); 55 TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]).Assign(NewImportFormat); 56 FormMain.AcronymDb.Modified := True; 57 ComboBox1.Items.Strings[ComboBox1.ItemIndex] := NewImportFormat.Name; 58 end; 59 if Assigned(NewImportFormat) then NewImportFormat.Free; 60 end; 61 end; 42 62 43 63 procedure TFormImportSource.Load(ImportSource: TImportSource); -
trunk/Forms/UFormImportSources.pas
r22 r28 146 146 procedure TFormImportSources.AProcessExecute(Sender: TObject); 147 147 begin 148 if Assigned(ListView1.Selected) then 148 if Assigned(ListView1.Selected) then begin 149 149 TImportSource(ListView1.Selected.Data).Process; 150 ShowMessage(Format(SAddedCount, [TImportSource(ListView1.Selected.Data).ItemCount])); 151 end; 150 152 end; 151 153 -
trunk/Forms/UFormMain.pas
r27 r28 119 119 FormMain: TFormMain; 120 120 121 resourcestring 122 SAddedCount = 'Imported %d acronyms'; 123 124 121 125 implementation 122 126 … … 252 256 var 253 257 I: Integer; 254 begin 255 for I := 0 to AcronymDb.ImportSources.Count - 1 do 258 TotalItemCount: Integer; 259 begin 260 TotalItemCount := 0; 261 for I := 0 to AcronymDb.ImportSources.Count - 1 do begin 256 262 TImportSource(AcronymDb.ImportSources[I]).Process; 263 TotalItemCount := TotalItemCount + TImportSource(AcronymDb.ImportSources[I]).ItemCount; 264 end; 265 ShowMessage(Format(SAddedCount, [TotalItemCount])); 257 266 UpdateAcronymsList; 258 267 UpdateInterface; -
trunk/Languages/AcronymDecoder.cs.po
r27 r28 261 261 msgstr "" 262 262 263 #: tformimportformat.listviewitemrules.columns[4].caption 264 msgctxt "tformimportformat.listviewitemrules.columns[4].caption" 265 msgid "Repetition" 266 msgstr "" 267 263 268 #: tformimportformats.aadd.caption 264 269 msgctxt "tformimportformats.aadd.caption" … … 302 307 msgstr "" 303 308 309 #: tformimportpattern.checkboxrepetition.caption 310 msgctxt "tformimportpattern.checkboxrepetition.caption" 311 msgid "Repetition" 312 msgstr "" 313 304 314 #: tformimportpattern.label10.caption 305 315 msgid "Action:" … … 328 338 msgstr "Ok" 329 339 340 #: tformimportsource.buttonshowformat.caption 341 msgid "Configure" 342 msgstr "" 343 330 344 #: tformimportsource.caption 331 345 msgctxt "tformimportsource.caption" … … 587 601 msgstr "Importováno %d nových zkratek." 588 602 603 #: uformimportformat.sno 604 msgid "No" 605 msgstr "" 606 589 607 #: uformimportformat.sremoveimportpattern 590 608 msgid "Remove import pattern" … … 593 611 #: uformimportformat.sremoveimportpatternquery 594 612 msgid "Do you really want to remove selected import patterns?" 613 msgstr "" 614 615 #: uformimportformat.syes 616 msgid "Yes" 595 617 msgstr "" 596 618 … … 622 644 msgstr "Opravdu chcete odebrat vybrané zdroje importu?" 623 645 646 #: uformmain.saddedcount 647 msgid "Imported %d acronyms" 648 msgstr "" 649 624 650 #: uformmain.sappexit 625 651 msgid "Application exit" -
trunk/Languages/AcronymDecoder.po
r27 r28 246 246 msgstr "" 247 247 248 #: tformimportformat.listviewitemrules.columns[4].caption 249 msgctxt "TFORMIMPORTFORMAT.LISTVIEWITEMRULES.COLUMNS[4].CAPTION" 250 msgid "Repetition" 251 msgstr "" 252 248 253 #: tformimportformats.aadd.caption 249 254 msgctxt "TFORMIMPORTFORMATS.AADD.CAPTION" … … 285 290 msgstr "" 286 291 292 #: tformimportpattern.checkboxrepetition.caption 293 msgctxt "tformimportpattern.checkboxrepetition.caption" 294 msgid "Repetition" 295 msgstr "" 296 287 297 #: tformimportpattern.label10.caption 288 298 msgid "Action:" … … 311 321 msgstr "" 312 322 323 #: tformimportsource.buttonshowformat.caption 324 msgid "Configure" 325 msgstr "" 326 313 327 #: tformimportsource.caption 314 328 msgctxt "tformimportsource.caption" … … 570 584 msgstr "" 571 585 586 #: uformimportformat.sno 587 msgid "No" 588 msgstr "" 589 572 590 #: uformimportformat.sremoveimportpattern 573 591 msgid "Remove import pattern" … … 576 594 #: uformimportformat.sremoveimportpatternquery 577 595 msgid "Do you really want to remove selected import patterns?" 596 msgstr "" 597 598 #: uformimportformat.syes 599 msgid "Yes" 578 600 msgstr "" 579 601 … … 605 627 msgstr "" 606 628 629 #: uformmain.saddedcount 630 msgid "Imported %d acronyms" 631 msgstr "" 632 607 633 #: uformmain.sappexit 608 634 msgid "Application exit" -
trunk/UAcronym.pas
r27 r28 7 7 uses 8 8 Classes, SysUtils, Contnrs, XMLConf, XMLRead, XMLWrite, DOM, UXMLUtils, 9 SpecializedList, fphttpclient ;9 SpecializedList, fphttpclient, Dialogs; 10 10 11 11 type … … 119 119 Variable: TImportVariable; 120 120 Flag: TImportPatternFlag; 121 Repetition: Boolean; 121 122 procedure Assign(Source: TImportPattern); 122 123 procedure SaveToNode(Node: TDOMNode); … … 167 168 LastTime: TDateTime; 168 169 Sources: TImportSources; 170 ItemCount: Integer; 169 171 function DownloadHTTP(URL: string; Stream: TStream): Boolean; 170 172 procedure Process; … … 265 267 Variable := Source.Variable; 266 268 Flag := Source.Flag; 269 Repetition := Source.Repetition; 267 270 end; 268 271 … … 273 276 WriteInteger(Node, 'Variable', Integer(Variable)); 274 277 WriteInteger(Node, 'Flag', Integer(Flag)); 278 WriteBoolean(Node, 'Repetition', Repetition); 275 279 end; 276 280 … … 281 285 Variable := TImportVariable(ReadInteger(Node, 'Variable', 0)); 282 286 Flag := TImportPatternFlag(ReadInteger(Node, 'Flag', 0)); 287 Repetition := ReadBoolean(Node, 'Repetition', False); 283 288 end; 284 289 … … 295 300 var 296 301 HTTPClient: TFPHTTPClient; 302 FormData: TStringList; 297 303 begin 298 304 HTTPClient := TFPHttpClient.Create(nil); 299 305 HTTPClient.OnPassword := DoPassword; 306 FormData := TStringList.Create; 307 (* 308 FormData.action=clientlogin 309 &loginreturnurl=http://example.com/& 310 logintoken=29590a3037d325be70b93fb8258ed29257448cfb%2B%5C& 311 username=Bob& 312 password=secret& 313 rememberMe=1 314 HTTPClient.FormPost(URL, FormData, Stream); 315 *) 300 316 HTTPClient.Get(URL, Stream); 317 FormData.Free; 301 318 HTTPClient.Free; 302 319 Result := True; … … 502 519 NewAcronym: TAcronymEntry; 503 520 P: Integer; 521 P1, P2: Integer; 504 522 Q: Integer; 505 523 I: Integer; … … 507 525 LastLength: Integer; 508 526 begin 527 ItemCount := 0; 509 528 Stream := TMemoryStream.Create; 510 529 NewAcronym := TAcronymEntry.Create; … … 547 566 repeat 548 567 LastLength := Length(S); 549 for I := 0 to Format.ItemPatterns.Count - 1 do 550 with TImportPattern(Format.ItemPatterns[I]) do 551 if Flag <> ipfSkip then begin 552 if Length(StartString) > 0 then begin 553 P := Pos(StartString, S); 554 if P > 0 then Delete(S, 1, P + Length(StartString) - 1); 568 I := 0; 569 while I < Format.ItemPatterns.Count do 570 with TImportPattern(Format.ItemPatterns[I]) do begin 571 if Flag <> ipfSkip then begin 572 if Length(StartString) > 0 then begin 573 P := Pos(StartString, S); 574 if P > 0 then Delete(S, 1, P + Length(StartString) - 1); 575 end; 576 577 if ((Length(StartString) > 0) and (P > 0)) or (Length(StartString) = 0) then begin 578 P := Pos(EndString, S); 579 T := StripHTML(Copy(S, 1, P - 1)); 580 T := StringReplace(T, '"', '"', [rfReplaceAll]); 581 T := StringReplace(T, '™', 'TM', [rfReplaceAll]); 582 T := StringReplace(T, '&', '&', [rfReplaceAll]); 583 T := StringReplace(T, ' ', ' ', [rfReplaceAll]); // No break space 584 T := Trim(T); 585 case Variable of 586 ivAcronym: NewAcronym.Name := T; 587 ivMeaning: NewAcronym.Meaning := T; 588 end; 589 Delete(S, 1, P + Length(EndString) - 1); 590 591 if (Flag = ipfNewItem) and (Trim(NewAcronym.Name) <> '') and 592 (Trim(NewAcronym.Meaning) <> '') then begin 593 Sources.AcronymDb.AddAcronym(NewAcronym.Name, NewAcronym.Meaning); 594 Inc(ItemCount); 595 end; 596 597 if Repetition then begin 598 if Length(StartString) > 0 then begin 599 P1 := Pos(StartString, S); 600 if P1 > 0 then begin 601 P2 := Pos(TImportPattern(Format.ItemPatterns[(I + 1) mod Format.ItemPatterns.Count]).StartString, S); 602 if (P2 > 0) and (P1 < P2) then Continue; 603 end; 604 end; 605 end; 606 end; 555 607 end; 556 557 if ((Length(StartString) > 0) and (P > 0)) or (Length(StartString) = 0) then begin 558 P := Pos(EndString, S); 559 T := StripHTML(Copy(S, 1, P - 1)); 560 T := StringReplace(T, '"', '"', [rfReplaceAll]); 561 T := StringReplace(T, '™', 'TM', [rfReplaceAll]); 562 T := StringReplace(T, '&', '&', [rfReplaceAll]); 563 T := Trim(T); 564 case Variable of 565 ivAcronym: NewAcronym.Name := T; 566 ivMeaning: NewAcronym.Meaning := T; 567 end; 568 Delete(S, 1, P + Length(EndString) - 1); 569 570 if (Flag = ipfNewItem) and (Trim(NewAcronym.Name) <> '') and 571 (Trim(NewAcronym.Meaning) <> '') then 572 Sources.AcronymDb.AddAcronym(NewAcronym.Name, NewAcronym.Meaning); 573 end; 608 Inc(I); 574 609 end; 575 610 until Length(S) = LastLength;
Note:
See TracChangeset
for help on using the changeset viewer.