mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 01:57:57 +02:00
PoChecker: Improve the GUI and its anchors.
git-svn-id: trunk@34454 -
This commit is contained in:
parent
521400fd7f
commit
ebed12f697
@ -1,29 +1,37 @@
|
||||
object PoCheckerForm: TPoCheckerForm
|
||||
Left = 409
|
||||
Height = 295
|
||||
Top = 133
|
||||
Width = 463
|
||||
Left = 349
|
||||
Height = 311
|
||||
Top = 189
|
||||
Width = 581
|
||||
Caption = 'GUI Po-file checking tool'
|
||||
ClientHeight = 295
|
||||
ClientWidth = 463
|
||||
ClientHeight = 311
|
||||
ClientWidth = 581
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '0.9.31'
|
||||
Visible = True
|
||||
object TestListBox: TCheckListBox
|
||||
Left = 168
|
||||
Height = 163
|
||||
Top = 44
|
||||
Width = 288
|
||||
AnchorSideLeft.Control = SelectTestLabel
|
||||
AnchorSideTop.Control = SelectTestLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 201
|
||||
Height = 169
|
||||
Top = 33
|
||||
Width = 373
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 6
|
||||
Enabled = False
|
||||
ItemHeight = 0
|
||||
OnItemClick = TestListBoxItemClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 168
|
||||
Height = 15
|
||||
Top = 24
|
||||
Width = 105
|
||||
object SelectTestLabel: TLabel
|
||||
AnchorSideLeft.Control = OpenBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 201
|
||||
Height = 19
|
||||
Top = 8
|
||||
Width = 144
|
||||
BorderSpacing.Left = 9
|
||||
Caption = 'Select test types'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
@ -31,9 +39,9 @@ object PoCheckerForm: TPoCheckerForm
|
||||
end
|
||||
object OpenBtn: TBitBtn
|
||||
Left = 8
|
||||
Height = 79
|
||||
Top = 44
|
||||
Width = 144
|
||||
Height = 63
|
||||
Top = 33
|
||||
Width = 184
|
||||
Caption = '&Open a po-file'
|
||||
Glyph.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
@ -75,10 +83,17 @@ object PoCheckerForm: TPoCheckerForm
|
||||
TabOrder = 1
|
||||
end
|
||||
object RunBtn: TBitBtn
|
||||
AnchorSideLeft.Control = OpenBtn
|
||||
AnchorSideTop.Control = OpenBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = OpenBtn
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 79
|
||||
Top = 128
|
||||
Width = 144
|
||||
Height = 63
|
||||
Top = 102
|
||||
Width = 184
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
Caption = '&Run Selected Tests'
|
||||
Enabled = False
|
||||
Kind = bkOK
|
||||
@ -87,43 +102,56 @@ object PoCheckerForm: TPoCheckerForm
|
||||
end
|
||||
object StatusPanel: TPanel
|
||||
Left = 0
|
||||
Height = 48
|
||||
Top = 247
|
||||
Width = 463
|
||||
Height = 49
|
||||
Top = 262
|
||||
Width = 581
|
||||
Align = alBottom
|
||||
BevelOuter = bvLowered
|
||||
ClientHeight = 48
|
||||
ClientWidth = 463
|
||||
ClientHeight = 49
|
||||
ClientWidth = 581
|
||||
TabOrder = 3
|
||||
object Label2: TLabel
|
||||
object CurTestHeaderLabel: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Height = 19
|
||||
Top = 8
|
||||
Width = 74
|
||||
Width = 96
|
||||
Caption = 'Current Test:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
object CurPoHeaderLabel: TLabel
|
||||
AnchorSideLeft.Control = CurTestHeaderLabel
|
||||
AnchorSideTop.Control = CurTestHeaderLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 24
|
||||
Width = 87
|
||||
Height = 19
|
||||
Top = 27
|
||||
Width = 111
|
||||
Caption = 'Current po-file:'
|
||||
ParentColor = False
|
||||
end
|
||||
object CurTestLabel: TLabel
|
||||
Left = 104
|
||||
Height = 15
|
||||
AnchorSideLeft.Control = CurTestHeaderLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CurTestHeaderLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 110
|
||||
Height = 19
|
||||
Top = 8
|
||||
Width = 73
|
||||
Width = 95
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'CurTestLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object CurPoLabel: TLabel
|
||||
Left = 104
|
||||
Height = 15
|
||||
Top = 24
|
||||
Width = 65
|
||||
AnchorSideLeft.Control = CurPoHeaderLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CurPoHeaderLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 125
|
||||
Height = 19
|
||||
Top = 27
|
||||
Width = 82
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'CurPoLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -131,15 +159,30 @@ object PoCheckerForm: TPoCheckerForm
|
||||
object NoErrLabel: TLabel
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 216
|
||||
Top = 232
|
||||
Width = 171
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'No errors found'
|
||||
Font.Color = clRed
|
||||
Font.Color = clGreen
|
||||
Font.Height = -19
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object SelectAllCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = TestListBox
|
||||
AnchorSideTop.Control = TestListBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 201
|
||||
Height = 23
|
||||
Top = 208
|
||||
Width = 97
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Select All'
|
||||
Enabled = False
|
||||
OnClick = SelectAllCheckBoxClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
Filter = 'po-files (*.po)|*.po|all files|*'
|
||||
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
||||
|
@ -33,8 +33,9 @@ type
|
||||
{ TPoCheckerForm }
|
||||
|
||||
TPoCheckerForm = class(TForm)
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
SelectAllCheckBox: TCheckBox;
|
||||
CurTestHeaderLabel: TLabel;
|
||||
CurPoHeaderLabel: TLabel;
|
||||
CurTestLabel: TLabel;
|
||||
CurPoLabel: TLabel;
|
||||
NoErrLabel: TLabel;
|
||||
@ -42,14 +43,14 @@ type
|
||||
RunBtn: TBitBtn;
|
||||
OpenBtn: TBitBtn;
|
||||
Button3: TButton;
|
||||
Label1: TLabel;
|
||||
SelectTestLabel: TLabel;
|
||||
OpenDialog: TOpenDialog;
|
||||
TestListBox: TCheckListBox;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure OpenBtnClick(Sender: TObject);
|
||||
procedure RunBtnClick(Sender: TObject);
|
||||
procedure TestListBoxItemClick(Sender: TObject; Index: integer);
|
||||
procedure SelectAllCheckBoxClick(Sender: TObject);
|
||||
private
|
||||
PoFamily: TPoFamily;
|
||||
FChoosenMasterName: String;
|
||||
@ -70,10 +71,10 @@ resourcestring
|
||||
rsPoChecker = 'PO File Checker';
|
||||
sSelectAllTests = 'Select all tests';
|
||||
sUnSelectAllTests = 'Unselect all tests';
|
||||
sCannotFindMaster = 'Cannot find master po file:'^m'%s'^m'for selected file'^m'%s';
|
||||
sNotAProperFileName = 'Selected filename'^m'%s'^m'does not seem to be a proper name for a po-file';
|
||||
sErrorOnCreate = 'Error creating an instance of TPoFamily:'^m'%s';
|
||||
sErrorOnCleanup = 'An unrecoverable error occurred'^m'%s'^m'Please close the program';
|
||||
sCannotFindMaster = 'Cannot find master po file:' + LineEnding + '%s' + LineEnding + 'for selected file' + LineEnding + '%s';
|
||||
sNotAProperFileName = 'Selected filename' + LineEnding + '%s' + LineEnding + 'does not seem to be a proper name for a po-file';
|
||||
sErrorOnCreate = 'Error creating an instance of TPoFamily:' + LineEnding + '%s';
|
||||
sErrorOnCleanup = 'An unrecoverable error occurred' + LineEnding + '%s' + LineEnding + 'Please close the program';
|
||||
|
||||
sTotalErrors = 'Total errors found: %d';
|
||||
//sNoErrorsFound = 'No errors found.';
|
||||
@ -116,11 +117,12 @@ begin
|
||||
begin
|
||||
RunBtn.Enabled := True;
|
||||
TestListBox.Enabled := True;
|
||||
SelectAllCheckBox.Enabled := True;
|
||||
end
|
||||
else
|
||||
begin
|
||||
RunBtn.Enabled := False;
|
||||
else begin
|
||||
RunBtn.Enabled := False;
|
||||
TestListBox.Enabled := False;
|
||||
SelectAllCheckBox.Enabled := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -129,20 +131,20 @@ begin
|
||||
RunSelectedTests;
|
||||
end;
|
||||
|
||||
procedure TPoCheckerForm.TestListBoxItemClick(Sender: TObject; Index: integer);
|
||||
procedure TPoCheckerForm.SelectAllCheckBoxClick(Sender: TObject);
|
||||
var
|
||||
Check: Boolean;
|
||||
cb: TCheckBox;
|
||||
i: Integer;
|
||||
begin
|
||||
if (Index = TestListBox.Count - 1) then
|
||||
begin//Run All Test checkbox
|
||||
Check := TestListBox.Checked[Index];
|
||||
for i := 0 to TestListBox.Count - 2 do TestListBox.Checked[i] := Check;
|
||||
if Check then
|
||||
TestListBox.Items[Index] := sUnSelectAllTests
|
||||
else
|
||||
TestListBox.Items[Index] := sSelectAllTests;
|
||||
end;
|
||||
cb := Sender as TCheckBox;
|
||||
// Caption text : select all / unselect all
|
||||
if cb.Checked then
|
||||
cb.Caption := sUnSelectAllTests
|
||||
else
|
||||
cb.Caption := sSelectAllTests;
|
||||
// Set / reset all CheckListBox items.
|
||||
for i := 0 to TestListBox.Count - 1 do
|
||||
TestListBox.Checked[i] := cb.Checked;
|
||||
end;
|
||||
|
||||
procedure TPoCheckerForm.OnTestStart(const ATestName, APoFileName: String);
|
||||
@ -166,10 +168,8 @@ var
|
||||
Opt: TPoTestOption;
|
||||
begin
|
||||
for Opt := Low(PoTestOptionNames) to High(PoTestOptionNames) do
|
||||
begin
|
||||
TestListBox.Items.Add(PoTestOptionNames[Opt]);
|
||||
end;
|
||||
TestListBox.Items.Add(sSelectAllTests);
|
||||
SelectAllCheckBox.Caption := sSelectAllTests;
|
||||
end;
|
||||
|
||||
function TPoCheckerForm.GetOptionsFromListBox: TPoTestOptions;
|
||||
@ -183,7 +183,8 @@ begin
|
||||
Index := Ord(Opt);
|
||||
if (Index < TestListBox.Count) then
|
||||
begin
|
||||
if TestListBox.Checked[Index] then Result := Result + [Opt];
|
||||
if TestListBox.Checked[Index] then
|
||||
Result := Result + [Opt];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -230,7 +231,8 @@ begin
|
||||
OK := (FChoosenMasterName <> '');
|
||||
if OK then
|
||||
begin
|
||||
if Assigned(PoFamily) then PoFamily.Free;
|
||||
if Assigned(PoFamily) then
|
||||
PoFamily.Free;
|
||||
try
|
||||
PoFamily := TPoFamily.Create(FChoosenMasterName, FChoosenChildName);
|
||||
PoFamily.OnTestStart := @OnTestStart;
|
||||
@ -276,8 +278,9 @@ begin
|
||||
SL := TStringList.Create;
|
||||
try
|
||||
StatusPanel.Enabled := True;
|
||||
if (not (ptoFindAllChilds in Options)) and Assigned(PoFamily.Child) and
|
||||
(PoFamily.ChildName <> FChoosenChildName) then PoFamily.ChildName := FChoosenChildName;
|
||||
if (not (ptoFindAllChilds in Options)) and Assigned(PoFamily.Child)
|
||||
and (PoFamily.ChildName <> FChoosenChildName) then
|
||||
PoFamily.ChildName := FChoosenChildName;
|
||||
PoFamily.RunTests(Options, ErrorCount, SL);
|
||||
if (ErrorCount > 0) then
|
||||
begin
|
||||
@ -292,10 +295,8 @@ begin
|
||||
ResultDlg.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin//no errors
|
||||
else //no errors
|
||||
NoErrLabel.Visible := True;
|
||||
end;
|
||||
finally
|
||||
if Assigned(SL) then
|
||||
SL.Free;
|
||||
|
@ -8,7 +8,6 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, FileUtil, StringHashList,
|
||||
{LConvEncoding}
|
||||
//{$IFDEF UNIX}{$IFNDEF DisableCWString}, cwstring{$ENDIF}{$ENDIF},
|
||||
SimplePoFiles;
|
||||
|
||||
@ -23,10 +22,14 @@ const
|
||||
optRunAllTests: TPoTestOptions = [];
|
||||
optRunAllTestsOnAllChilds: TPoTestOptions = [];
|
||||
|
||||
PoTestOptionNames: array[TPoTestOption] of String = ('Check number of items', 'Check for incompatible format arguments',
|
||||
'Check missing identifiers','Check for mismatches in untranslated strings',
|
||||
'Check for duplicate untranslated values',
|
||||
'Find all translated po-files');
|
||||
PoTestOptionNames: array[TPoTestOption] of String = (
|
||||
'Check number of items',
|
||||
'Check for incompatible format arguments',
|
||||
'Check missing identifiers',
|
||||
'Check for mismatches in untranslated strings',
|
||||
'Check for duplicate untranslated values',
|
||||
'Find all translated po-files'
|
||||
);
|
||||
|
||||
Type
|
||||
{ TPoFamily }
|
||||
@ -81,7 +84,6 @@ function ExtractMasterNameFromChildName(const AChildName: String): String;
|
||||
function FindAllTranslatedPoFiles(const Filename: string): TStringList;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
@ -663,16 +665,12 @@ begin
|
||||
ErrorCount := CurrErrCnt + ErrorCount;
|
||||
end;
|
||||
|
||||
|
||||
if (ptoCheckMismatchedOriginals in Options) then
|
||||
begin
|
||||
CheckMismatchedOriginals(CurrErrCnt, ErrorLog);
|
||||
ErrorCount := CurrErrCnt + ErrorCount;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
if (pto in Options) then
|
||||
begin
|
||||
|
@ -1,7 +1,7 @@
|
||||
object ResultDlgForm: TResultDlgForm
|
||||
Left = 284
|
||||
Left = 275
|
||||
Height = 635
|
||||
Top = 108
|
||||
Top = 100
|
||||
Width = 742
|
||||
ActiveControl = CopyBtn
|
||||
Caption = 'Results'
|
||||
@ -27,11 +27,12 @@ object ResultDlgForm: TResultDlgForm
|
||||
object CloseBtn: TBitBtn
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 657
|
||||
Left = 652
|
||||
Height = 30
|
||||
Top = 10
|
||||
Width = 75
|
||||
Width = 80
|
||||
Anchors = [akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 10
|
||||
DefaultCaption = True
|
||||
Kind = bkClose
|
||||
@ -40,22 +41,24 @@ object ResultDlgForm: TResultDlgForm
|
||||
end
|
||||
object SaveBtn: TBitBtn
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
Left = 572
|
||||
Left = 536
|
||||
Height = 30
|
||||
Top = 10
|
||||
Width = 75
|
||||
Width = 106
|
||||
Anchors = [akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 10
|
||||
Caption = '&Save to file'
|
||||
TabOrder = 1
|
||||
end
|
||||
object CopyBtn: TBitBtn
|
||||
AnchorSideRight.Control = SaveBtn
|
||||
Left = 487
|
||||
Left = 452
|
||||
Height = 30
|
||||
Top = 10
|
||||
Width = 75
|
||||
Width = 74
|
||||
Anchors = [akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 10
|
||||
Caption = 'CopyBtn'
|
||||
OnClick = CopyBtnClick
|
||||
|
@ -27,11 +27,9 @@ type
|
||||
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
PoHL: TSynPoSyn;
|
||||
procedure SaveToFile;
|
||||
public
|
||||
{ public declarations }
|
||||
property Log: TStringList read FLog write FLog;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user