mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 10:49:16 +02:00
pochecker: unselect all, select basic button, issue #26395, from Vaclav Valicek
git-svn-id: trunk@45671 -
This commit is contained in:
parent
0217554726
commit
d9cea06d08
@ -97,11 +97,7 @@
|
|||||||
</Options>
|
</Options>
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
<CompilerMessages>
|
|
||||||
<MsgFileName Value=""/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<CustomOptions Value="-dPoCheckerStandAlone"/>
|
<CustomOptions Value="-dPoCheckerStandAlone"/>
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
|
@ -1,36 +1,37 @@
|
|||||||
object PoCheckerForm: TPoCheckerForm
|
object PoCheckerForm: TPoCheckerForm
|
||||||
Left = 349
|
Left = 318
|
||||||
Height = 311
|
Height = 311
|
||||||
Top = 189
|
Top = 163
|
||||||
Width = 581
|
Width = 581
|
||||||
Caption = 'GUI Po-file checking tool'
|
Caption = 'GUI Po-file checking tool'
|
||||||
ClientHeight = 311
|
ClientHeight = 311
|
||||||
ClientWidth = 581
|
ClientWidth = 581
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '1.3'
|
||||||
Visible = True
|
Visible = True
|
||||||
object TestListBox: TCheckListBox
|
object TestListBox: TCheckListBox
|
||||||
AnchorSideLeft.Control = SelectTestLabel
|
AnchorSideLeft.Control = SelectTestLabel
|
||||||
AnchorSideTop.Control = SelectTestLabel
|
AnchorSideTop.Control = SelectTestLabel
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 201
|
Left = 201
|
||||||
Height = 150
|
Height = 152
|
||||||
Top = 28
|
Top = 26
|
||||||
Width = 373
|
Width = 373
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
TopIndex = -1
|
||||||
end
|
end
|
||||||
object SelectTestLabel: TLabel
|
object SelectTestLabel: TLabel
|
||||||
AnchorSideLeft.Control = OpenBtn
|
AnchorSideLeft.Control = OpenBtn
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
Left = 201
|
Left = 201
|
||||||
Height = 14
|
Height = 12
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 97
|
Width = 84
|
||||||
BorderSpacing.Left = 9
|
BorderSpacing.Left = 9
|
||||||
Caption = 'Select test types'
|
Caption = 'Select test types'
|
||||||
Font.Style = [fsBold]
|
Font.Style = [fsBold]
|
||||||
@ -114,9 +115,9 @@ object PoCheckerForm: TPoCheckerForm
|
|||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
object CurTestHeaderLabel: TLabel
|
object CurTestHeaderLabel: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 14
|
Height = 12
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 66
|
Width = 61
|
||||||
Caption = 'Current Test:'
|
Caption = 'Current Test:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -125,9 +126,9 @@ object PoCheckerForm: TPoCheckerForm
|
|||||||
AnchorSideTop.Control = CurTestHeaderLabel
|
AnchorSideTop.Control = CurTestHeaderLabel
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 14
|
Height = 12
|
||||||
Top = 22
|
Top = 20
|
||||||
Width = 75
|
Width = 72
|
||||||
Caption = 'Current po-file:'
|
Caption = 'Current po-file:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -136,10 +137,10 @@ object PoCheckerForm: TPoCheckerForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = CurTestHeaderLabel
|
AnchorSideTop.Control = CurTestHeaderLabel
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 80
|
Left = 75
|
||||||
Height = 14
|
Height = 12
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 64
|
Width = 61
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'CurTestLabel'
|
Caption = 'CurTestLabel'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -149,10 +150,10 @@ object PoCheckerForm: TPoCheckerForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = CurPoHeaderLabel
|
AnchorSideTop.Control = CurPoHeaderLabel
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 89
|
Left = 86
|
||||||
Height = 14
|
Height = 12
|
||||||
Top = 22
|
Top = 20
|
||||||
Width = 55
|
Width = 53
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'CurPoLabel'
|
Caption = 'CurPoLabel'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -160,9 +161,9 @@ object PoCheckerForm: TPoCheckerForm
|
|||||||
end
|
end
|
||||||
object NoErrLabel: TLabel
|
object NoErrLabel: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 24
|
Height = 22
|
||||||
Top = 232
|
Top = 234
|
||||||
Width = 152
|
Width = 145
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'No errors found'
|
Caption = 'No errors found'
|
||||||
Font.Color = clGreen
|
Font.Color = clGreen
|
||||||
@ -171,32 +172,60 @@ object PoCheckerForm: TPoCheckerForm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
end
|
end
|
||||||
object SelectAllCheckBox: TCheckBox
|
object FindAllPOsCheckBox: TCheckBox
|
||||||
|
AnchorSideLeft.Control = TestListBox
|
||||||
|
AnchorSideTop.Control = SelectBasicBtn
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 201
|
||||||
|
Height = 24
|
||||||
|
Top = 215
|
||||||
|
Width = 149
|
||||||
|
BorderSpacing.Top = 6
|
||||||
|
Caption = 'Find all translated PO files'
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
object SelectBasicBtn: TButton
|
||||||
AnchorSideLeft.Control = TestListBox
|
AnchorSideLeft.Control = TestListBox
|
||||||
AnchorSideTop.Control = TestListBox
|
AnchorSideTop.Control = TestListBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 201
|
Left = 201
|
||||||
Height = 17
|
Height = 25
|
||||||
Top = 184
|
Top = 184
|
||||||
Width = 61
|
Width = 115
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
Caption = 'Select All'
|
Caption = 'Select Basic Tests'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnClick = SelectAllCheckBoxClick
|
OnClick = SelectBasicBtnClick
|
||||||
TabOrder = 4
|
|
||||||
end
|
|
||||||
object FindAllPOsCheckBox: TCheckBox
|
|
||||||
AnchorSideLeft.Control = SelectAllCheckBox
|
|
||||||
AnchorSideTop.Control = SelectAllCheckBox
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 201
|
|
||||||
Height = 17
|
|
||||||
Top = 207
|
|
||||||
Width = 142
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
Caption = 'Find all translated PO files'
|
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
|
object SelectAllBtn: TButton
|
||||||
|
AnchorSideLeft.Control = SelectBasicBtn
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = SelectBasicBtn
|
||||||
|
Left = 320
|
||||||
|
Height = 25
|
||||||
|
Top = 184
|
||||||
|
Width = 115
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
Caption = 'Select All Tests'
|
||||||
|
Enabled = False
|
||||||
|
OnClick = SelectAllBtnClick
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
|
object UnselectAllBtn: TButton
|
||||||
|
AnchorSideLeft.Control = SelectAllBtn
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = SelectAllBtn
|
||||||
|
Left = 439
|
||||||
|
Height = 25
|
||||||
|
Top = 184
|
||||||
|
Width = 115
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
Caption = 'Unselect All Tests'
|
||||||
|
Enabled = False
|
||||||
|
OnClick = UnselectAllBtnClick
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
object OpenDialog: TOpenDialog
|
object OpenDialog: TOpenDialog
|
||||||
Filter = 'po-files (*.po)|*.po|all files|*'
|
Filter = 'po-files (*.po)|*.po|all files|*'
|
||||||
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
||||||
|
@ -38,8 +38,10 @@ type
|
|||||||
{ TPoCheckerForm }
|
{ TPoCheckerForm }
|
||||||
|
|
||||||
TPoCheckerForm = class(TForm)
|
TPoCheckerForm = class(TForm)
|
||||||
|
UnselectAllBtn: TButton;
|
||||||
|
SelectAllBtn: TButton;
|
||||||
|
SelectBasicBtn: TButton;
|
||||||
FindAllPOsCheckBox: TCheckBox;
|
FindAllPOsCheckBox: TCheckBox;
|
||||||
SelectAllCheckBox: TCheckBox;
|
|
||||||
CurTestHeaderLabel: TLabel;
|
CurTestHeaderLabel: TLabel;
|
||||||
CurPoHeaderLabel: TLabel;
|
CurPoHeaderLabel: TLabel;
|
||||||
CurTestLabel: TLabel;
|
CurTestLabel: TLabel;
|
||||||
@ -56,22 +58,24 @@ type
|
|||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure OpenBtnClick(Sender: TObject);
|
procedure OpenBtnClick(Sender: TObject);
|
||||||
procedure RunBtnClick(Sender: TObject);
|
procedure RunBtnClick(Sender: TObject);
|
||||||
procedure SelectAllCheckBoxClick(Sender: TObject);
|
procedure SelectAllBtnClick(Sender: TObject);
|
||||||
|
procedure SelectBasicBtnClick(Sender: TObject);
|
||||||
|
procedure UnselectAllBtnClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
PoFamily: TPoFamily;
|
PoFamily: TPoFamily;
|
||||||
FChosenMasterName: String;
|
FChosenMasterName: string;
|
||||||
FChosenChildName: String;
|
FChosenChildName: string;
|
||||||
procedure OnTestStart(const ATestName, APoFileName: String);
|
procedure OnTestStart(const ATestName, APoFileName: string);
|
||||||
procedure OnTestEnd(const ATestName: String; const ErrorCount: Integer);
|
procedure OnTestEnd(const ATestName: string; const ErrorCount: integer);
|
||||||
procedure FillTestListBox;
|
procedure FillTestListBox;
|
||||||
function GetOptionsFromListBox: TPoTestOptions;
|
function GetOptionsFromListBox: TPoTestOptions;
|
||||||
procedure ShowError(const Msg: String);
|
procedure ShowError(const Msg: string);
|
||||||
function TrySelectFile: Boolean;
|
function TrySelectFile: boolean;
|
||||||
procedure RunSelectedTests;
|
procedure RunSelectedTests;
|
||||||
procedure ClearAndDisableStatusPanel;
|
procedure ClearAndDisableStatusPanel;
|
||||||
public
|
public
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
PoCheckerForm: TPoCheckerForm;
|
PoCheckerForm: TPoCheckerForm;
|
||||||
@ -106,8 +110,12 @@ begin
|
|||||||
if Lang <> '' then
|
if Lang <> '' then
|
||||||
begin
|
begin
|
||||||
Lang := copy(Lang, 1, 2);
|
Lang := copy(Lang, 1, 2);
|
||||||
Translations.TranslateUnitResourceStrings('PoCheckerConsts', '..'+DirectorySeparator+'languages'+DirectorySeparator+'pocheckerconsts.'+Lang+'.po');
|
Translations.TranslateUnitResourceStrings('PoCheckerConsts',
|
||||||
Translations.TranslateUnitResourceStrings('LCLStrConsts', '..'+DirectorySeparator+'languages'+DirectorySeparator+'lclstrconsts.'+Lang+'.po');
|
'..' + DirectorySeparator + 'languages' + DirectorySeparator +
|
||||||
|
'pocheckerconsts.' + Lang + '.po');
|
||||||
|
Translations.TranslateUnitResourceStrings('LCLStrConsts',
|
||||||
|
'..' + DirectorySeparator + 'languages' + DirectorySeparator +
|
||||||
|
'lclstrconsts.' + Lang + '.po');
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@ -124,80 +132,108 @@ begin
|
|||||||
CurPoHeaderLabel.Caption := sCurrentPoFile;
|
CurPoHeaderLabel.Caption := sCurrentPoFile;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPoCheckerForm.FormDestroy(Sender: TObject);
|
procedure TPoCheckerForm.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Assigned(PoFamily) then PoFamily.Free;
|
if Assigned(PoFamily) then
|
||||||
|
PoFamily.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPoCheckerForm.OpenBtnClick(Sender: TObject);
|
procedure TPoCheckerForm.OpenBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if TrySelectFile then
|
if TrySelectFile then
|
||||||
begin
|
begin
|
||||||
RunBtn.Enabled := True;
|
RunBtn.Enabled := True;
|
||||||
TestListBox.Enabled := True;
|
TestListBox.Enabled := True;
|
||||||
SelectAllCheckBox.Enabled := True;
|
SelectAllBtn.Enabled := True;
|
||||||
|
SelectBasicBtn.Enabled := True;
|
||||||
|
UnselectAllBtn.Enabled := True;
|
||||||
end
|
end
|
||||||
else begin
|
else
|
||||||
|
begin
|
||||||
RunBtn.Enabled := False;
|
RunBtn.Enabled := False;
|
||||||
TestListBox.Enabled := False;
|
TestListBox.Enabled := False;
|
||||||
SelectAllCheckBox.Enabled := False;
|
SelectAllBtn.Enabled := False;
|
||||||
|
SelectBasicBtn.Enabled := False;
|
||||||
|
UnselectAllBtn.Enabled := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPoCheckerForm.RunBtnClick(Sender: TObject);
|
procedure TPoCheckerForm.RunBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
RunSelectedTests;
|
RunSelectedTests;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPoCheckerForm.SelectAllCheckBoxClick(Sender: TObject);
|
procedure TPoCheckerForm.SelectAllBtnClick(Sender: TObject);
|
||||||
var
|
|
||||||
cb: TCheckBox;
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
cb := Sender as TCheckBox;
|
TestListBox.CheckAll(cbChecked, False, False);
|
||||||
// Set / reset "basic" CheckListBox items.
|
|
||||||
for i := 0 to TestListBox.Count - 3 do
|
|
||||||
TestListBox.Checked[i] := cb.Checked;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPoCheckerForm.OnTestStart(const ATestName, APoFileName: String);
|
|
||||||
|
procedure TPoCheckerForm.SelectBasicBtnClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
// Set / reset "basic" CheckListBox items.
|
||||||
|
for i := 0 to TestListBox.Count - 3 do
|
||||||
|
TestListBox.Checked[i] := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPoCheckerForm.UnselectAllBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
TestListBox.CheckAll(cbUnchecked, False, False);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TPoCheckerForm.OnTestStart(const ATestName, APoFileName: string);
|
||||||
begin
|
begin
|
||||||
//debugln('OnTestStart: ATestName = "',AtestName,'" APoFileName = "',APoFileName);
|
//debugln('OnTestStart: ATestName = "',AtestName,'" APoFileName = "',APoFileName);
|
||||||
CurTestLabel.Caption := ATestName;
|
CurTestLabel.Caption := ATestName;
|
||||||
CurPoLabel.Caption := APoFileName;
|
CurPoLabel.Caption := APoFileName;
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPoCheckerForm.OnTestEnd(const ATestName: String; const ErrorCount: Integer);
|
|
||||||
|
procedure TPoCheckerForm.OnTestEnd(const ATestName: string;
|
||||||
|
const ErrorCount: integer);
|
||||||
begin
|
begin
|
||||||
//CurTestLabel.Caption := '';
|
//CurTestLabel.Caption := '';
|
||||||
//CurPoLabel.Caption := '';
|
//CurPoLabel.Caption := '';
|
||||||
debugln('OnTestEnd [',ATestName,']: ErrorCount = ',DbgS(ErrorCount));
|
debugln('OnTestEnd [', ATestName, ']: ErrorCount = ', DbgS(ErrorCount));
|
||||||
//Application.ProcessMessages;
|
//Application.ProcessMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPoCheckerForm.FillTestListBox;
|
procedure TPoCheckerForm.FillTestListBox;
|
||||||
var
|
var
|
||||||
Opt: TPoTestOption;
|
Opt: TPoTestOption;
|
||||||
begin
|
begin
|
||||||
for Opt := Low(PoTestOptionNames) to Pred(High(PoTestOptionNames)) do
|
for Opt := Low(PoTestOptionNames) to Pred(High(PoTestOptionNames)) do
|
||||||
case Opt of
|
case Opt of
|
||||||
ptoCheckNrOfItems: TestListBox.Items.Add(sCheckNumberOfItems);
|
ptoCheckNrOfItems:
|
||||||
ptoCheckFormatArgs: TestListBox.Items.Add(sCheckForIncompatibleFormatArguments);
|
TestListBox.Items.Add(sCheckNumberOfItems);
|
||||||
ptoCheckMissingIdentifiers: TestListBox.Items.Add(sCheckMissingIdentifiers);
|
ptoCheckFormatArgs:
|
||||||
ptoCheckMismatchedOriginals: TestListBox.Items.Add(sCheckForMismatchesInUntranslatedStrings);
|
TestListBox.Items.Add(sCheckForIncompatibleFormatArguments);
|
||||||
ptoCheckDuplicateOriginals: TestListBox.Items.Add(sCheckForDuplicateUntranslatedValues);
|
ptoCheckMissingIdentifiers:
|
||||||
ptoCheckStatistics: TestListBox.Items.Add(sCheckStatistics);
|
TestListBox.Items.Add(sCheckMissingIdentifiers);
|
||||||
|
ptoCheckMismatchedOriginals:
|
||||||
|
TestListBox.Items.Add(sCheckForMismatchesInUntranslatedStrings);
|
||||||
|
ptoCheckDuplicateOriginals:
|
||||||
|
TestListBox.Items.Add(sCheckForDuplicateUntranslatedValues);
|
||||||
|
ptoCheckStatistics:
|
||||||
|
TestListBox.Items.Add(sCheckStatistics);
|
||||||
else
|
else
|
||||||
TestListBox.Items.Add(PoTestOptionNames[Opt]);
|
TestListBox.Items.Add(PoTestOptionNames[Opt]);
|
||||||
end;
|
end;
|
||||||
SelectAllCheckBox.Caption := sSelectBasicTests;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TPoCheckerForm.GetOptionsFromListBox: TPoTestOptions;
|
function TPoCheckerForm.GetOptionsFromListBox: TPoTestOptions;
|
||||||
var
|
var
|
||||||
Opt: TPoTestOption;
|
Opt: TPoTestOption;
|
||||||
Index: Integer;
|
Index: integer;
|
||||||
begin
|
begin
|
||||||
Result := [];
|
Result := [];
|
||||||
for Opt := Low(TpoTestOption) to Pred(High(TPoTestOption)) do
|
for Opt := Low(TpoTestOption) to Pred(High(TPoTestOption)) do
|
||||||
@ -213,16 +249,18 @@ begin
|
|||||||
Result := Result + [High(TPoTestOption)];
|
Result := Result + [High(TPoTestOption)];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPoCheckerForm.ShowError(const Msg: String);
|
|
||||||
|
procedure TPoCheckerForm.ShowError(const Msg: string);
|
||||||
begin
|
begin
|
||||||
MessageDlg('Po-checker', Msg, mtError, [mbOk], 0);
|
MessageDlg('Po-checker', Msg, mtError, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPoCheckerForm.TrySelectFile: Boolean;
|
|
||||||
|
function TPoCheckerForm.TrySelectFile: boolean;
|
||||||
var
|
var
|
||||||
Fn: String;
|
Fn: string;
|
||||||
ShortFn: String;
|
ShortFn: string;
|
||||||
OK: Boolean;
|
OK: boolean;
|
||||||
begin
|
begin
|
||||||
NoErrLabel.Visible := False;
|
NoErrLabel.Visible := False;
|
||||||
OK := False;
|
OK := False;
|
||||||
@ -243,11 +281,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
FChosenMasterName := '';
|
FChosenMasterName := '';
|
||||||
FChosenChildName := '';
|
FChosenChildName := '';
|
||||||
ShowError(Format(sNotAProperFileName,[ShortFn]));
|
ShowError(Format(sNotAProperFileName, [ShortFn]));
|
||||||
end
|
end
|
||||||
else if not FileExistsUtf8(FChosenMasterName) then
|
else
|
||||||
|
if not FileExistsUtf8(FChosenMasterName) then
|
||||||
begin
|
begin
|
||||||
ShowError(Format(sCannotFindMaster,[ExtractFileName(FChosenMasterName), ShortFn]));
|
ShowError(Format(sCannotFindMaster,
|
||||||
|
[ExtractFileName(FChosenMasterName), ShortFn]));
|
||||||
FChosenMasterName := '';
|
FChosenMasterName := '';
|
||||||
FChosenChildName := '';
|
FChosenChildName := '';
|
||||||
end;
|
end;
|
||||||
@ -265,7 +305,7 @@ begin
|
|||||||
on E: Exception do
|
on E: Exception do
|
||||||
begin
|
begin
|
||||||
OK := False;
|
OK := False;
|
||||||
ShowError(Format(sErrorOnCreate,[E.Message]));
|
ShowError(Format(sErrorOnCreate, [E.Message]));
|
||||||
if Assigned(PoFamily) then
|
if Assigned(PoFamily) then
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
@ -273,7 +313,7 @@ begin
|
|||||||
except
|
except
|
||||||
on E: Exception do
|
on E: Exception do
|
||||||
begin
|
begin
|
||||||
ShowError(Format(sErrorOnCleanUp,[E.Message]));
|
ShowError(Format(sErrorOnCleanUp, [E.Message]));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -284,10 +324,11 @@ begin
|
|||||||
Result := OK;
|
Result := OK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPoCheckerForm.RunSelectedTests;
|
procedure TPoCheckerForm.RunSelectedTests;
|
||||||
var
|
var
|
||||||
Options: TPoTestOptions;
|
Options: TPoTestOptions;
|
||||||
ErrorCount, WarningCount: Integer;
|
ErrorCount, WarningCount: integer;
|
||||||
SL: TStrings;
|
SL: TStrings;
|
||||||
ResultDlg: TResultDlgForm;
|
ResultDlg: TResultDlgForm;
|
||||||
begin
|
begin
|
||||||
@ -302,17 +343,18 @@ begin
|
|||||||
SL := TStringList.Create;
|
SL := TStringList.Create;
|
||||||
try
|
try
|
||||||
StatusPanel.Enabled := True;
|
StatusPanel.Enabled := True;
|
||||||
if (not (ptoFindAllChildren in Options)) and Assigned(PoFamily.Child)
|
if (not (ptoFindAllChildren in Options)) and Assigned(PoFamily.Child) and
|
||||||
and (PoFamily.ChildName <> FChosenChildName) then
|
(PoFamily.ChildName <> FChosenChildName) then
|
||||||
PoFamily.ChildName := FChosenChildName;
|
PoFamily.ChildName := FChosenChildName;
|
||||||
PoFamily.RunTests(Options, ErrorCount, WarningCount, SL);
|
PoFamily.RunTests(Options, ErrorCount, WarningCount, SL);
|
||||||
debugln('RunSelectedTests: ',Format(sTotalErrors,[ErrorCount]));
|
debugln('RunSelectedTests: ', Format(sTotalErrors, [ErrorCount]));
|
||||||
debugln(' ',Format(sTotalWarnings,[WarningCount]));
|
debugln(' ', Format(sTotalWarnings, [WarningCount]));
|
||||||
if (ErrorCount > 0) or (WarningCount > 0) or (ptoCheckStatistics in Options) then
|
if (ErrorCount > 0) or (WarningCount > 0) or
|
||||||
|
(ptoCheckStatistics in Options) then
|
||||||
begin
|
begin
|
||||||
SL.Add(Format(sTotalErrors,[ErrorCount]));
|
SL.Add(Format(sTotalErrors, [ErrorCount]));
|
||||||
SL.Add(Format(sTotalWarnings,[WarningCount]));
|
SL.Add(Format(sTotalWarnings, [WarningCount]));
|
||||||
ResultDlg := TResultDlgForm.Create(Nil);
|
ResultDlg := TResultDlgForm.Create(nil);
|
||||||
try
|
try
|
||||||
ResultDlg.Log.Assign(SL);
|
ResultDlg.Log.Assign(SL);
|
||||||
FreeAndNil(SL); //No need to keep 2 copies of this data
|
FreeAndNil(SL); //No need to keep 2 copies of this data
|
||||||
@ -329,6 +371,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPoCheckerForm.ClearAndDisableStatusPanel;
|
procedure TPoCheckerForm.ClearAndDisableStatusPanel;
|
||||||
begin
|
begin
|
||||||
CurTestLabel.Caption := '';
|
CurTestLabel.Caption := '';
|
||||||
@ -337,27 +380,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function SameItem(Item1, Item2: TPoFileItem): Boolean;
|
function SameItem(Item1, Item2: TPoFileItem): boolean;
|
||||||
begin
|
begin
|
||||||
Result := (Item1.Identifier = Item2.Identifier) and
|
Result := (Item1.Identifier = Item2.Identifier) and
|
||||||
(Item1.Original = Item2.Original) and
|
(Item1.Original = Item2.Original) and (Item1.Context = Item2.Context) and
|
||||||
(Item1.Context = Item2.Context) and
|
(Item1.Flags = Item2.Flags) and (Item1.PreviousID = Item2.PreviousID) and
|
||||||
(Item1.Flags = Item2.Flags) and
|
(Item1.Translation = Item2.Translation);
|
||||||
(Item1.PreviousID = Item2.PreviousID) and
|
|
||||||
(Item1.Translation = Item2.Translation);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure IDEMenuClicked(Sender: TObject);
|
procedure IDEMenuClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ShowPoCheckerForm;
|
ShowPoCheckerForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
{$IFNDEF POCHECKERSTANDALONE}
|
{$IFNDEF POCHECKERSTANDALONE}
|
||||||
RegisterIDEMenuCommand(itmSecondaryTools, 'mnuPoChecker', rsPoChecker, nil, @IDEMenuClicked);
|
RegisterIDEMenuCommand(itmSecondaryTools, 'mnuPoChecker',
|
||||||
|
rsPoChecker, nil, @IDEMenuClicked);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -635,6 +635,7 @@ begin
|
|||||||
ErrorLog.Add('');
|
ErrorLog.Add('');
|
||||||
ErrorLog.Add('');
|
ErrorLog.Add('');
|
||||||
end;
|
end;
|
||||||
|
WarningCount := NrTotal;
|
||||||
DoTestEnd(PoTestOptionNames[ptoCheckFormatArgs], WarningCount);
|
DoTestEnd(PoTestOptionNames[ptoCheckFormatArgs], WarningCount);
|
||||||
//debugln('TPoFamily.CheckIncompatibleFormatArgs: ',Dbgs(ErrorCount),' Errors');
|
//debugln('TPoFamily.CheckIncompatibleFormatArgs: ',Dbgs(ErrorCount),' Errors');
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user