Changeset 5 for trunk/UFormMain.pas


Ignore:
Timestamp:
May 1, 2014, 11:31:03 PM (10 years ago)
Author:
chronos
Message:
  • Added: Compare form to show differences between two linux versions.
  • Added: Faster binary search through TConfigMenu tree.
  • Added: Some actions icons.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r4 r5  
    1414
    1515  TFormMain = class(TForm)
     16    ACompare: TAction;
    1617    AShowList: TAction;
    1718    AShowLog: TAction;
     
    2829    MenuItem5: TMenuItem;
    2930    MenuItem6: TMenuItem;
     31    MenuItem7: TMenuItem;
    3032    StatusBar1: TStatusBar;
    3133    ToolBar1: TToolBar;
     
    3335    ToolButton2: TToolButton;
    3436    TreeView1: TTreeView;
     37    procedure ACompareExecute(Sender: TObject);
    3538    procedure AOpenDirExecute(Sender: TObject);
    3639    procedure AShowListExecute(Sender: TObject);
     
    5457
    5558uses
    56   UFormList, UFormLog;
     59  UFormList, UFormLog, UFormCompare;
    5760
    5861{$R *.lfm}
     
    9093  Config.TopNode.LoadTreeNode(TreeView1.TopItem, Options);
    9194  TreeView1.TopItem.Expanded := True;
     95  StatusBar1.Panels[0].Text := 'Count: ' + IntToStr(Config.TopNode.GetCount);
    9296end;
    9397
     
    99103    Config.LoadFromDir(OutDir, 'x86');
    100104    Reload;
     105  end;
     106end;
     107
     108procedure TFormMain.ACompareExecute(Sender: TObject);
     109var
     110  List1, List2: TStringList;
     111  Missing1, Missing2: TStringList;
     112  Config2: TConfigMenu;
     113begin
     114  try
     115    List1 := TStringList.Create;
     116    List2 := TStringList.Create;
     117    Missing1 := TStringList.Create;
     118    Missing2 := TStringList.Create;
     119    Config2 := TConfigMenu.Create;
     120    Config.TopNode.SaveToList(List1);
     121    Config2.LoadFromDir('/home/chronos/Stažené/linux-3.12.18', 'x86');
     122    Config2.TopNode.SaveToList(List2);
     123    Config.CompareStringLists(List1, List2, Missing1, Missing2);
     124    FormCompare.Memo1.Lines.Assign(Missing1);
     125    FormCompare.Memo2.Lines.Assign(Missing2);
     126    FormCompare.Show;
     127  finally
     128    Config2.Free;
     129    Missing1.Free;
     130    Missing2.Free;
     131    List1.Free;
     132    List2.Free;
    101133  end;
    102134end;
Note: See TracChangeset for help on using the changeset viewer.