From 7366f82d26c7629144dc7160da932884295fa859 Mon Sep 17 00:00:00 2001 From: Jonathan Barnard Date: Thu, 1 Jan 2009 16:23:51 +0000 Subject: [PATCH] UnitMain: Remove Log wrapper. --- UnitMain.pas | 57 +++++++++++++-------------------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/UnitMain.pas b/UnitMain.pas index 8802af9..a142c2e 100644 --- a/UnitMain.pas +++ b/UnitMain.pas @@ -82,13 +82,11 @@ type function Isblocked(Path:string): longint ; public { public declarations } - procedure LogWithDebug(Level:integer;Channel:string;LogText:string); procedure ListFileDir({0} Path: string; {1} FileList: TStrings; {2} GroupList: TStrings; {3} DirListClean: TStrings; {4} DirListPath: TStrings; {5} isFileList: Boolean ); procedure RunWineCheck( ProgramNameOverRide: string; ProgramFlagsOverRide: string ); end; - var Form1: TForm1; start_S1:string; { Script to write to the file. } @@ -111,11 +109,6 @@ implementation { TForm1 } - - - - - function TForm1.Isblocked(Path:string): longint ; var CL:string; @@ -147,11 +140,6 @@ Result := 0 ; end; -procedure TForm1.LogWithDebug(Level:integer;Channel:string;LogText:string); -begin - Log(Level, Channel, LogText); -end; - procedure TForm1.ListFileDir({0} Path: string; {1} FileList: TStrings; {2} GroupList: TStrings; {3} DirListClean: TStrings; {4} DirListPath: TStrings; {5} isFileList: Boolean ); var SR: TSearchRec; @@ -233,7 +221,7 @@ IgnoreChannelList := TStringlist.Create; ConfigPath := (GetEnvironmentVariable('HOME') + '/.config/WineLauncher'); AProcess := TProcess.Create(nil); -{Check all the files and folders this program needs to acses.} +{Check all the files and folders this program needs to access.} if CheckPaths() <> true then Application.Destroy; if NoError = true then @@ -249,11 +237,9 @@ begin CheckWineVersion(); end; - end; - procedure TForm1.RunWineCheck( ProgramNameOverRide: string; ProgramFlagsOverRide: string ); Var RunYes:Boolean; @@ -296,7 +282,7 @@ if RunYes = true then else begin { Error Can not find wine } - LogWithDebug(0, ChannelLocal, 'Can not find wine'); + Log(0, ChannelLocal, 'Can not find wine'); RunYes := false; end; end; @@ -312,14 +298,14 @@ if RunYes = true then {"ComboBox_TerminalName.ItemIndex" is the seleted item, we add one to keep combobox in line with stringgrid.} temp00 := ComboBox_TerminalName.ItemIndex; RunIn := ( UnitSettings.Form4.StringGrid_TerminalSettings.Cells[1,temp00] + ' ' + UnitSettings.Form4.StringGrid_TerminalSettings.Cells[2,temp00] ); - LogWithDebug(0, ChannelLocal, ('Using Terminal' + Wrap( RunIn )) ); + Log(0, ChannelLocal, ('Using Terminal' + Wrap( RunIn )) ); end; end else begin {FIX ME, after the Program is closed the child process is still listed.} RunIn := UnitSettings.Form4.ComboBox_ShellPath.text; - LogWithDebug(0, ChannelLocal, ('Using' + Wrap( RunIn )) ); + Log(0, ChannelLocal, ('Using' + Wrap( RunIn )) ); end; end; @@ -328,7 +314,6 @@ if RunYes = true then { PreFix } if RunYes = true then begin -{ TODO : HARD CODE. does not need doing right away its a gnu program } WinePreFixRaw := (PreFixList[1].Strings[ComboBox_PreFix.ItemIndex]); WinePreFix := ('env WINEPREFIX="' + WinePreFixRaw + '"'); {$IFDEF LogVar} @@ -344,24 +329,22 @@ if RunYes = true then if FileExists( ComboBox_SoundWrapper.Text ) = true then begin SoundWrapper := ComboBox_SoundWrapper.Text + ' ' ; - LogWithDebug(0, ChannelLocal, ( 'File' + Wrap( ComboBox_SoundWrapper.Text ) + 'exists')); + Log(0, ChannelLocal, ( 'File' + Wrap( ComboBox_SoundWrapper.Text ) + 'exists')); end else begin RunYes := false ; - LogWithDebug(1, ChannelLocal, ( 'File' + Wrap( ComboBox_SoundWrapper.Text ) + 'does not exists')); + Log(1, ChannelLocal, ( 'File' + Wrap( ComboBox_SoundWrapper.Text ) + 'does not exists')); end; end else begin - LogWithDebug(0, ChannelLocal, ('No sound wrapper will be used')); + Log(0, ChannelLocal, ('No sound wrapper will be used')); end; end; if ProgramNameOverRide = '' then begin - -{ Programlist Version 1 } if RunYes = true then begin if EditBox_ProgramPath.Text <> '' then @@ -383,7 +366,7 @@ if RunYes = true then else begin RunYes := False; - LogWithDebug(1, ChannelLocal, ('Please select a program.')); + Log(1, ChannelLocal, ('Please select a program.')); end; end; @@ -429,20 +412,6 @@ if RunYes = true then end; -{FpUnlink: remove a file, Unix specific} -if RunYes = true then - begin - if FpUnlink( ConfigPath + '/1') <> 0 then {0 = no error} - begin - //LogWithDebug(1, ChannelLocal, ( 'File' + Wrap( ConfigPath + '/1' ) + 'can not be removed.')); - //RunYes := False ; - end - else - begin - //LogWithDebug(3, ChannelLocal, ('File' + Wrap( ConfigPath + '/1' ) + 'has being removed.')); - end; - end; - {Create Script file} if RunYes = true then begin @@ -463,7 +432,7 @@ if RunYes = true then {Execute script one} if RunYes = true then begin - LogWithDebug(0, ChannelLocal, ('Script One has being executed.')); + Log(0, ChannelLocal, ('Script One has being executed.')); AProcess.CommandLine := RunIn + ' ' + ConfigPath +'/1'; { TODO : After the TempProgram is closed the child process is still listed. } @@ -472,7 +441,7 @@ if RunYes = true then end else begin - LogWithDebug(1, ChannelLocal, ('Somethings Wrong, check your log')); + Log(1, ChannelLocal, ('Somethings Wrong, check your log')); end; end; end; @@ -489,12 +458,12 @@ LC:string; { local channel } begin LC := Btn_Settings.name; - LogWithDebug(5, LC,('-----------------')); - LogWithDebug(5, LC,( Btn_Settings.name + ' clicked:')); + Log(5, LC,('-----------------')); + Log(5, LC,( Btn_Settings.name + ' clicked:')); UnitSettings.Form4.Show ; - LogWithDebug(0, LC,( 'You should see' + Wrap('UnitSettings.Form4') + 'now.')); + Log(0, LC,( 'You should see' + Wrap('UnitSettings.Form4') + 'now.')); end; procedure TForm1.Button_RegeditClick(Sender: TObject); -- 2.11.4.GIT