Changeset 73
- Timestamp:
- Aug 2, 2016, 11:21:21 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormImportSources.lfm
r72 r73 10 10 OnShow = FormShow 11 11 Position = poScreenCenter 12 LCLVersion = '1.7' 13 object ListView1: TListView 14 Left = 8 15 Height = 376 16 Top = 8 17 Width = 798 18 Anchors = [akTop, akLeft, akRight, akBottom] 19 Checkboxes = True 20 Columns = < 21 item 22 Caption = 'Name' 23 Width = 150 24 end 25 item 26 Caption = 'URL' 27 Width = 250 28 end 29 item 30 Caption = 'Categories' 31 Width = 200 32 end 33 item 34 Caption = 'Count' 35 Width = 70 36 end 37 item 38 Caption = 'Date' 39 Width = 108 40 end> 41 MultiSelect = True 42 OwnerData = True 43 PopupMenu = PopupMenuImportSource 44 ReadOnly = True 45 RowSelect = True 46 TabOrder = 0 47 ViewStyle = vsReport 48 OnData = ListView1Data 49 OnDblClick = ListView1DblClick 50 OnSelectItem = ListView1SelectItem 51 end 12 LCLVersion = '1.6.0.4' 52 13 object ToolBar1: TToolBar 53 14 Left = 0 … … 60 21 ParentShowHint = False 61 22 ShowHint = True 62 TabOrder = 123 TabOrder = 0 63 24 object ToolButton1: TToolButton 64 25 Left = 1 … … 81 42 Action = AProcess 82 43 end 44 end 45 object ListView1: TListView 46 Left = 8 47 Height = 340 48 Top = 44 49 Width = 798 50 Anchors = [akTop, akLeft, akRight, akBottom] 51 Checkboxes = True 52 Columns = < 53 item 54 Caption = 'Name' 55 Width = 150 56 end 57 item 58 Caption = 'URL' 59 Width = 250 60 end 61 item 62 Caption = 'Categories' 63 Width = 200 64 end 65 item 66 Caption = 'Count' 67 Width = 70 68 end 69 item 70 Caption = 'Date' 71 Width = 100 72 end> 73 MultiSelect = True 74 OwnerData = True 75 PopupMenu = PopupMenuImportSource 76 ReadOnly = True 77 RowSelect = True 78 TabOrder = 1 79 ViewStyle = vsReport 80 OnChange = ListView1Change 81 OnClick = ListView1Click 82 OnData = ListView1Data 83 OnDblClick = ListView1DblClick 84 OnResize = ListView1Resize 85 OnSelectItem = ListView1SelectItem 86 end 87 object ListViewFilter1: TListViewFilter 88 Left = 8 89 Height = 29 90 Top = 11 91 Width = 798 92 OnChange = ListViewFilter1Change 93 Anchors = [akTop, akLeft, akRight] 83 94 end 84 95 object ActionList1: TActionList … … 108 119 ImageIndex = 5 109 120 OnExecute = AProcessExecute 110 end111 object AEnable: TAction112 Caption = 'Enable'113 OnExecute = AEnableExecute114 end115 object ADisable: TAction116 Caption = 'Disable'117 OnExecute = ADisableExecute118 121 end 119 122 end … … 278 281 } 279 282 end 280 object MenuItem6: TMenuItem281 Action = AEnable282 end283 object MenuItem5: TMenuItem284 Action = ADisable285 end286 283 end 287 284 object JobProgressView1: TJobProgressView … … 292 289 top = 119 293 290 end 291 object ListViewSort1: TListViewSort 292 ListView = ListView1 293 OnCompareItem = ListViewSort1CompareItem 294 OnFilter = ListViewSort1Filter 295 Column = 0 296 Order = soNone 297 left = 547 298 top = 172 299 end 294 300 end -
trunk/Forms/UFormImportSources.lrt
r72 r73 1 1 TFORMIMPORTSOURCES.CAPTION=Import sources 2 TFORMIMPORTSOURCES.TOOLBAR1.CAPTION=ToolBar1 2 3 TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[0].CAPTION=Name 3 4 TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[1].CAPTION=URL … … 5 6 TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[3].CAPTION=Count 6 7 TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[4].CAPTION=Date 7 TFORMIMPORTSOURCES.TOOLBAR1.CAPTION=ToolBar18 8 TFORMIMPORTSOURCES.AADD.CAPTION=Add 9 9 TFORMIMPORTSOURCES.AREMOVE.CAPTION=Remove 10 10 TFORMIMPORTSOURCES.AMODIFY.CAPTION=Modify 11 11 TFORMIMPORTSOURCES.APROCESS.CAPTION=Process 12 TFORMIMPORTSOURCES.AENABLE.CAPTION=Enable13 TFORMIMPORTSOURCES.ADISABLE.CAPTION=Disable -
trunk/Forms/UFormImportSources.pas
r72 r73 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ActnList, Menus, UAcronym, UJobProgressView; 9 ActnList, Menus, UAcronym, UJobProgressView, UListViewSort, SpecializedList, 10 LazUTF8; 10 11 11 12 type … … 23 24 JobProgressView1: TJobProgressView; 24 25 ListView1: TListView; 26 ListViewFilter1: TListViewFilter; 27 ListViewSort1: TListViewSort; 25 28 MenuItem1: TMenuItem; 26 29 MenuItem2: TMenuItem; … … 43 46 procedure FormCreate(Sender: TObject); 44 47 procedure FormShow(Sender: TObject); 48 procedure ListView1Change(Sender: TObject; Item: TListItem; 49 Change: TItemChange); 50 procedure ListView1Click(Sender: TObject); 45 51 procedure ListView1Data(Sender: TObject; Item: TListItem); 46 52 procedure ListView1DblClick(Sender: TObject); 53 procedure ListView1Resize(Sender: TObject); 47 54 procedure ListView1SelectItem(Sender: TObject; Item: TListItem; 48 55 Selected: Boolean); 56 procedure ListViewFilter1Change(Sender: TObject); 57 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 58 procedure ListViewSort1Filter(ListViewSort: TListViewSort); 49 59 private 50 60 procedure ProcessImportJob(Job: TJob); 51 { private declarations }61 procedure FilterList(List: TListObject); 52 62 public 53 63 ImportSources: TImportSources; … … 77 87 procedure TFormImportSources.ListView1Data(Sender: TObject; Item: TListItem); 78 88 begin 79 if Item.Index < ImportSources.Count then80 with TImportSource( ImportSources[Item.Index]) do begin89 if Item.Index < ListViewSort1.List.Count then 90 with TImportSource(ListViewSort1.List[Item.Index]) do begin 81 91 Item.Caption := Name; 82 Item.Data := ImportSources[Item.Index];92 Item.Data := ListViewSort1.List[Item.Index]; 83 93 Item.SubItems.Add(URL); 84 94 Item.SubItems.Add(Categories.GetString); … … 96 106 end; 97 107 108 procedure TFormImportSources.ListView1Resize(Sender: TObject); 109 begin 110 ListViewFilter1.UpdateFromListView(ListView1); 111 end; 112 98 113 procedure TFormImportSources.ListView1SelectItem(Sender: TObject; 99 114 Item: TListItem; Selected: Boolean); … … 102 117 end; 103 118 119 procedure TFormImportSources.ListViewFilter1Change(Sender: TObject); 120 begin 121 UpdateList; 122 end; 123 124 function TFormImportSources.ListViewSort1CompareItem(Item1, Item2: TObject 125 ): Integer; 126 begin 127 Result := 0; 128 if Assigned(Item1) and Assigned(Item2) and (ListViewSort1.Order <> soNone) then begin 129 with ListViewSort1 do 130 case Column of 131 0: Result := CompareString(TImportSource(Item1).Name, TImportSource(Item2).Name); 132 1: Result := CompareString(TImportSource(Item1).URL, TImportSource(Item2).URL); 133 2: Result := CompareString(TImportSource(Item1).Categories.GetString, TImportSource(Item2).Categories.GetString); 134 3: Result := CompareInteger(TImportSource(Item1).ItemCount, TImportSource(Item2).ItemCount); 135 4: Result := CompareTime(TImportSource(Item1).LastImportTime, TImportSource(Item2).LastImportTime); 136 end; 137 if ListViewSort1.Order = soDown then Result := -Result; 138 end else Result := 0; 139 end; 140 141 procedure TFormImportSources.ListViewSort1Filter(ListViewSort: TListViewSort); 142 begin 143 ImportSources.AssignToList(ListViewSort1.List); 144 FilterList(ListViewSort1.List); 145 end; 146 104 147 procedure TFormImportSources.UpdateList; 105 148 begin 106 ListView1.Items.Count := ImportSources.Count; 107 ListView1.Refresh; 149 ListViewSort1.Refresh; 108 150 UpdateInterface; 109 151 end; … … 118 160 begin 119 161 UpdateList; 162 end; 163 164 procedure TFormImportSources.ListView1Change(Sender: TObject; Item: TListItem; 165 Change: TItemChange); 166 begin 167 if Assigned(Item) and (Change = ctState) then begin 168 TImportSource(Item.Data).Enabled := Item.Checked; 169 end; 170 end; 171 172 procedure TFormImportSources.ListView1Click(Sender: TObject); 173 begin 174 120 175 end; 121 176 … … 200 255 end; 201 256 257 procedure TFormImportSources.FilterList(List: TListObject); 258 var 259 I: Integer; 260 FoundCount: Integer; 261 EnteredCount: Integer; 262 begin 263 EnteredCount := ListViewFilter1.TextEnteredCount; 264 for I := List.Count - 1 downto 0 do begin 265 if List.Items[I] is TImportSource then begin 266 with TImportSource(List.Items[I]) do begin 267 with ListViewFilter1 do 268 if Visible and (EnteredCount > 0) then begin 269 FoundCount := 0; 270 if Pos(UTF8LowerCase(StringGrid.Cells[0, 0]), 271 UTF8LowerCase(TImportSource(List.Items[I]).Name)) > 0 then Inc(FoundCount); 272 if Pos(UTF8LowerCase(StringGrid.Cells[1, 0]), 273 UTF8LowerCase(TImportSource(List.Items[I]).URL)) > 0 then Inc(FoundCount); 274 if Pos(UTF8LowerCase(StringGrid.Cells[2, 0]), 275 UTF8LowerCase(TImportSource(List.Items[I]).Categories.GetString)) > 0 then Inc(FoundCount); 276 if Pos(UTF8LowerCase(StringGrid.Cells[2, 0]), 277 UTF8LowerCase(IntToStr(TImportSource(List.Items[I]).ItemCount))) > 0 then Inc(FoundCount); 278 if Pos(UTF8LowerCase(StringGrid.Cells[2, 0]), 279 UTF8LowerCase(DateTimeToStr(TImportSource(List.Items[I]).LastImportTime))) > 0 then Inc(FoundCount); 280 if FoundCount <> EnteredCount then List.Delete(I); 281 end; 282 end; 283 end else 284 if TImportSource(List.Items[I]) is TImportSource then begin 285 List.Delete(I); 286 end; 287 end; 288 end; 289 202 290 procedure TFormImportSources.ARemoveExecute(Sender: TObject); 203 291 var -
trunk/Forms/UFormMain.lfm
r64 r73 1418 1418 OnChange = LastOpenedList1Change 1419 1419 left = 264 1420 top = 2 671420 top = 240 1421 1421 end 1422 1422 object CoolTranslator1: TCoolTranslator … … 1990 1990 ShowDelay = 0 1991 1991 AutoClose = False 1992 left = 3701993 top = 1431992 left = 264 1993 top = 296 1994 1994 end 1995 1995 end -
trunk/Forms/UFormMain.pas
r71 r73 388 388 with TAcronymMeaning(ListViewSort1.List[Item.Index]) do begin 389 389 Item.Caption := Acronym.Name; 390 Item.Data := TAcronymMeaning(ListViewSort1.List[Item.Index]); 390 391 Item.SubItems.Add(Name); 391 Item.Data := TAcronymMeaning(ListViewSort1.List[Item.Index]);392 392 Item.SubItems.Add(Categories.GetString); 393 393 end; -
trunk/Languages/AcronymDecoder.cs.po
r72 r73 407 407 msgstr "Přidat" 408 408 409 #: tformimportsources.adisable.caption410 msgid "Disable"411 msgstr "Zakázat"412 413 #: tformimportsources.aenable.caption414 msgid "Enable"415 msgstr "Povolit"416 417 409 #: tformimportsources.amodify.caption 418 410 msgctxt "tformimportsources.amodify.caption" … … 832 824 msgid "Process import sources" 833 825 msgstr "Zpracovat zdroje importu" 826 -
trunk/Languages/AcronymDecoder.po
r72 r73 397 397 msgstr "" 398 398 399 #: tformimportsources.adisable.caption400 msgid "Disable"401 msgstr ""402 403 #: tformimportsources.aenable.caption404 msgid "Enable"405 msgstr ""406 407 399 #: tformimportsources.amodify.caption 408 400 msgctxt "TFORMIMPORTSOURCES.AMODIFY.CAPTION" -
trunk/UAcronym.pas
r69 r73 178 178 URL: string; 179 179 Format: TImportFormat; 180 LastTime: TDateTime;181 180 Sources: TImportSources; 182 181 ItemCount: Integer; … … 204 203 procedure SaveToNode(Node: TDOMNode); 205 204 procedure LoadFromNode(Node: TDOMNode); 205 procedure AssignToList(List: TListObject); 206 206 end; 207 207 … … 547 547 end; 548 548 549 procedure TImportSources.AssignToList(List: TListObject); 550 var 551 I: Integer; 552 begin 553 List.Clear; 554 for I := 0 to Count - 1 do 555 List.Add(TImportSource(Items[I])) 556 end; 557 549 558 procedure TImportSource.Process; 550 559 begin … … 771 780 URL := Source.URL; 772 781 Format := Source.Format; 773 LastTime := Source.LastTime;774 782 ItemCount := Source.ItemCount; 775 783 Categories.Assign(Source.Categories);
Note:
See TracChangeset
for help on using the changeset viewer.