Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/NewBoard.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3.2.1 by yoffy, Mon Apr 19 22:46:49 2004 UTC revision 1.3.2.2 by yoffy, Thu Sep 9 16:20:33 2004 UTC
# Line 18  type Line 18  type
18                  Label1: TLabel;                  Label1: TLabel;
19                  MessageMemo: TMemo;                  MessageMemo: TMemo;
20                  UpdateButton: TButton;                  UpdateButton: TButton;
21      CloseButton: TButton;          CloseButton: TButton;
22                  Indy: TIdHTTP;                  Indy: TIdHTTP;
23                  IdAntiFreeze: TIdAntiFreeze;                  IdAntiFreeze: TIdAntiFreeze;
24                  StopButton: TButton;                  StopButton: TButton;
25                  Label2: TLabel;                  Label2: TLabel;
26      BoardURLComboBox: TComboBox;          BoardURLComboBox: TComboBox;
27      Label13: TLabel;          Label13: TLabel;
28            EditIgnoreListsButton: TButton;
29                  procedure UpdateButtonClick(Sender: TObject);                  procedure UpdateButtonClick(Sender: TObject);
30                  procedure StopButtonClick(Sender: TObject);                  procedure StopButtonClick(Sender: TObject);
31                  procedure CloseButtonClick(Sender: TObject);                  procedure CloseButtonClick(Sender: TObject);
32                  procedure FormCreate(Sender: TObject);                  procedure FormCreate(Sender: TObject);
33            procedure EditIgnoreListsButtonClick(Sender: TObject);
34        procedure FormClose(Sender: TObject; var Action: TCloseAction);
35          private          private
36                  { Private 宣言 }                  { Private 宣言 }
37                    IgnoreLists : TStringList;
38                  FAbort: Boolean;                  FAbort: Boolean;
39                  function BoardDownload: TNewBoardItem;                  function BoardDownload: TNewBoardItem;
40                  procedure UpdateURL(s: string);                  procedure UpdateURL(s: string);
41                    procedure SetIgnoreCategory(b: boolean);
42                    procedure EditIgnoreList(Sender: TObject);
43                    procedure UpdateIgnoreList(Sender: TObject);
44          public          public
45                  { Public 宣言 }                  { Public 宣言 }
46          end;          end;
# Line 41  type Line 48  type
48  var  var
49          NewBoardDialog: TNewBoardDialog;          NewBoardDialog: TNewBoardDialog;
50    
51    
52  implementation  implementation
53    
54  uses Giko, IdHeaderList;  uses Giko, IdHeaderList;
# Line 170  end; Line 178  end;
178  procedure TNewBoardDialog.UpdateURL(s: string);  procedure TNewBoardDialog.UpdateURL(s: string);
179  var  var
180          i: Integer;          i: Integer;
181    //      j: Integer;
182          idx: Integer;          idx: Integer;
183          idx1: Integer;          idx1: Integer;
184          idx2: Integer;          idx2: Integer;
# Line 179  var Line 188  var
188          cate: string;          cate: string;
189          Board: TBoard;          Board: TBoard;
190          Change: Boolean;          Change: Boolean;
191            Ignore: Boolean;
192          ini: TMemIniFile;          ini: TMemIniFile;
193      oldURLs : TStringList;          oldURLs : TStringList;
194      newURLs : TStringList;          newURLs : TStringList;
195  begin  begin
196          Change := False;          Change := False;
197          MessageMemo.Lines.Add('新板、板URL変更チェックを開始します');          MessageMemo.Lines.Add('新板、板URL変更チェックを開始します');
# Line 193  begin Line 203  begin
203          s := CustomStringReplace(s, '</A', '</a', true);          s := CustomStringReplace(s, '</A', '</a', true);
204          cate := '';          cate := '';
205    
206      oldURLs := TStringList.Create;          oldURLs := TStringList.Create;
207      newURLs := TStringList.Create;          newURLs := TStringList.Create;
208    
209          try          try
210    
# Line 221  begin Line 231  begin
231                                          tmp := Copy(s, idx1, (idx - idx1) + 4);                                          tmp := Copy(s, idx1, (idx - idx1) + 4);
232                                          tmp := CustomStringReplace(tmp, '<b>', '');                                          tmp := CustomStringReplace(tmp, '<b>', '');
233                                          tmp := CustomStringReplace(tmp, '</b>', '');                                          tmp := CustomStringReplace(tmp, '</b>', '');
234                                            Ignore := false;
235                                            for i := 0 to IgnoreLists.Count - 1 do begin
236                                                    if tmp = Trim(IgnoreLists[i]) then begin
237                                                            cate := '';
238                                                            s := Copy(s, idx + 5, Length(s));
239                                                            Ignore := True;
240                                                            break;
241                                                    end;
242                                            end;
243                                            if Ignore then
244                                                    Continue;
245                                            {
246                                          if (tmp = 'おすすめ') or                                          if (tmp = 'おすすめ') or
247                                                   (tmp = '特別企画') or                                                   (tmp = '特別企画') or
248                                                   (tmp = 'まちBBS') or                                                   (tmp = 'まちBBS') or
# Line 234  begin Line 255  begin
255                                                  s := Copy(s, idx + 5, Length(s));                                                  s := Copy(s, idx + 5, Length(s));
256                                                  Continue;                                                  Continue;
257                                          end;                                          end;
258                                            }
259                                          s := Copy(s, idx + 5, Length(s));                                          s := Copy(s, idx + 5, Length(s));
260                                          cate := tmp;                                          cate := tmp;
261                                  end else begin                                  end else begin
# Line 283  begin Line 305  begin
305              if Change then begin              if Change then begin
306              GikoForm.FavoritesURLReplace(oldURLs, newURLs);              GikoForm.FavoritesURLReplace(oldURLs, newURLs);
307              GikoForm.RoundListURLReplace(oldURLs, newURLs);              GikoForm.RoundListURLReplace(oldURLs, newURLs);
308    //            GikoForm.TabFileURLReplace(oldURLs, newURLs);
309                          MessageMemo.Lines.Add('新板、板URL変更チェックが完了しました');                          MessageMemo.Lines.Add('新板、板URL変更チェックが完了しました');
310                          MessageMemo.Lines.Add('「閉じる」ボタンを押してください');                          MessageMemo.Lines.Add('「閉じる」ボタンを押してください');
311                  end else                  end else
# Line 290  begin Line 313  begin
313      finally      finally
314          oldURLs.Free;          oldURLs.Free;
315          newURLs.Free;          newURLs.Free;
316      end;          end;
317  end;  end;
318    
319  procedure TNewBoardDialog.FormCreate(Sender: TObject);  procedure TNewBoardDialog.FormCreate(Sender: TObject);
320  begin  begin
321          StopButton.Enabled := False;          StopButton.Enabled := False;
322      BoardURLComboBox.Clear;          BoardURLComboBox.Clear;
323      BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);          BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);
324      try          try
325          BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;                  BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;
326      except          except
327          BoardURLComboBox.ItemIndex := 0;                  BoardURLComboBox.ItemIndex := 0;
328      end;          end;
329            SetIgnoreCategory(false);
330    end;
331    //板更新の除外カテゴリリストの登録
332    {['おすすめ', '特別企画', 'まちBBS', 'チャット', 'お絵かき', '運営案内', 'ツール類', '他のサイト']}
333    procedure TNewBoardDialog.SetIgnoreCategory(b: boolean);
334    begin
335            IgnoreLists := TStringList.Create;
336            if not( FileExists(GikoSys.Setting.GetIgnoreFileName) ) or ( b )then begin
337                    IgnoreLists.Add('おすすめ');
338                    IgnoreLists.Add('特別企画');
339                    IgnoreLists.Add('まちBBS');
340                    IgnoreLists.Add('チャット');
341                    IgnoreLists.Add('お絵かき');
342                    IgnoreLists.Add('運営案内');
343                    IgnoreLists.Add('ツール類');
344                    IgnoreLists.Add('他のサイト');
345            end else begin
346                    try
347                            IgnoreLists.LoadFromFile(GikoSys.Setting.GetIgnoreFileName);
348                    except
349                            IgnoreLists.Free;
350                            SetIgnoreCategory(true);
351                    end;
352            end;
353    end;
354    
355    procedure TNewBoardDialog.EditIgnoreListsButtonClick(Sender: TObject);
356    begin
357            EditIgnoreList(Sender);
358            EditIgnoreListsButton.OnClick := UpdateIgnoreList;
359    end;
360    procedure TNewBoardDialog.EditIgnoreList(Sender: TObject);
361    var
362            i: Integer;
363    begin
364            EditIgnoreListsButton.Caption := '除外カテゴリー更新';
365            Label2.Caption := '各1行にカテゴリ名を記入してください。(改行はCtrl+Enter)';
366            UpdateButton.Enabled := false;
367            //MessageMemo.ReadOnly := false;
368            MessageMemo.Clear;
369            for i := 0 to IgnoreLists.Count - 1 do
370                    MessageMemo.Lines.Add(IgnoreLists[i]);
371    end;
372    procedure TNewBoardDialog.UpdateIgnoreList(Sender: TObject);
373    var
374            i: Integer;
375    begin
376            Label2.Caption := '※現在、開いているタブやヒストリなどは板更新時にクリアされます';
377        UpdateButton.Enabled := true;
378            EditIgnoreListsButton.Caption := '除外カテゴリー編集';
379            IgnoreLists.Clear;
380            for i := 0 to MessageMemo.Lines.Count - 1 do
381                    IgnoreLists.Add(MessageMemo.Lines[i]);
382            IgnoreLists.SaveToFile(GikoSys.Setting.GetIgnoreFileName);
383            IgnoreLists.Free;
384            SetIgnoreCategory(false);
385            //MessageMemo.ReadOnly := true;
386            MessageMemo.Clear;
387            EditIgnoreListsButton.OnClick := EditIgnoreListsButtonClick;
388    end;
389    
390    procedure TNewBoardDialog.FormClose(Sender: TObject;
391      var Action: TCloseAction);
392    begin
393            IgnoreLists.Free;
394  end;  end;
395    
396  end.  end.

Legend:
Removed from v.1.3.2.1  
changed lines
  Added in v.1.3.2.2

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26