Il 30/09/2014 12:53, Bart ha scritto:
On 9/30/14, Giuliano Colla <giuliano.co...@fastwebnet.it> wrote:

The hint text needs modification though IMHO, not jus a plain "%d
Errors".
I can think of:
  2.

     "%d Errors in Selected tests"
This one sounds good to me.

It was my favorite too.
Ok then. Here you are. (patch attached)

Giuliano

--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?

Index: pocheckerconsts.pas
===================================================================
--- pocheckerconsts.pas	(revision 46356)
+++ pocheckerconsts.pas	(working copy)
@@ -42,7 +42,8 @@
   sFuzzy = 'Fuzzy';
   sStatHint = '%3d Translated (%3.1f%%)' + LineEnding +
               '%3d UnTranslated (%3.1f%%)' + LineEnding +
-              '%3d Fuzzy (%3.1f%%)';
+              '%3d Fuzzy (%3.1f%%)' + LineEnding +
+              '%d Error(s) in Selected Tests';
   sOpenFile = 'Open file %s in Ide Editor?';
   SOpenFail = 'Unable to open file %s';
 
Index: pofamilies.pp
===================================================================
--- pofamilies.pp	(revision 46356)
+++ pofamilies.pp	(working copy)
@@ -68,7 +68,7 @@
     procedure CheckMissingIdentifiers(out ErrorCount: Integer; ErrorLog: TStrings);
     procedure CheckMismatchedOriginals(out ErrorCount: Integer; ErrorLog: TStrings);
     procedure CheckDuplicateOriginals(out WarningCount: Integer; ErrorLog: TStrings);
-    procedure CheckStatistics;
+    procedure CheckStatistics(ErrorCnt: Integer);
 
   public
     procedure RunTests(const TestTypes: TPoTestTypes; const TestOptions: TPoTestOptions;
@@ -96,14 +96,16 @@
     FNrTranslated: Integer;
     FNrUnTranslated: Integer;
     FNrFuzzy: Integer;
+    FNrErrors: Integer;
   public
-    constructor Create(APoName: String; ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy: Integer);
+    constructor Create(APoName: String; ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy,ANrErrors: Integer);
     function ShortPoName: String;
     property PoName: string read FPoName;
     property NrTotal: Integer read FNrTotal;
     property NrTranslated: Integer read FNrTranslated;
     property NrUnTranslated: Integer read FNrUnTranslated;
     property NrFuzzy: Integer read FNrFuzzy;
+    property NrErrors: Integer read FNrErrors;
     function PercTranslated: Double; inline;
     function PercUnTranslated: Double; inline;
     function PercFuzzy: Double; inline;
@@ -119,7 +121,7 @@
     function GetItems(Index: Integer): TStat;
   public
     procedure Clear;
-    procedure Add(AName: String; ANrTotal, ANrTranslated, ANrUnTranslated, ANrFuzzy: Integer);
+    procedure Add(AName: String; ANrTotal, ANrTranslated, ANrUnTranslated, ANrFuzzy,ANrErrors: Integer);
     constructor Create;
     destructor Destroy; override;
     procedure AddStatisticsToLog(ALog: TStrings);
@@ -320,13 +322,14 @@
 
 { TStat }
 
-constructor TStat.Create(APoName: String; ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy: Integer);
+constructor TStat.Create(APoName: String; ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy,ANrErrors: Integer);
 begin
   FPoName := APoName;
   FNrTotal := ANrTotal;
   FNrTranslated := ANrTranslated;
   FNrUntranslated := ANrUntranslated;
   FNrFuzzy := ANrFuzzy;
+  FNrErrors:= ANrErrors;
 end;
 
 function TStat.ShortPoName: String;
@@ -381,9 +384,9 @@
   FList.Clear;
 end;
 
-procedure TPoFamilyStats.Add(AName: String; ANrTotal, ANrTranslated, ANrUnTranslated, ANrFuzzy: Integer);
+procedure TPoFamilyStats.Add(AName: String; ANrTotal, ANrTranslated, ANrUnTranslated, ANrFuzzy,ANrErrors: Integer);
 begin
-  FList.Add(TStat.Create(AName, ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy));
+  FList.Add(TStat.Create(AName, ANrTotal, ANrTranslated, ANrUntranslated, ANrFuzzy,ANrErrors));
 end;
 
 constructor TPoFamilyStats.Create;
@@ -758,7 +761,7 @@
   //debugln('TPoFamily.CheckDuplicateOriginals: ',Dbgs(WarningCount),' Errors');
 end;
 
-procedure TPoFamily.CheckStatistics;
+procedure TPoFamily.CheckStatistics(ErrorCnt: Integer);
 var
   i: Integer;
   CPoItem: TPOFileItem;
@@ -791,7 +794,7 @@
   NrTotal := NrTranslated + NrUntranslated + NrFuzzy;
   if (NrTotal > 0) then
   begin
-    FPoFamilyStats.Add(ChildName, NrTotal, NrTranslated, NrUntranslated, NrFuzzy);
+    FPoFamilyStats.Add(ChildName, NrTotal, NrTranslated, NrUntranslated, NrFuzzy,ErrorCnt);
   end;
   DoTestEnd(PoTestTypeNames[pttCheckFormatArgs], 0);
   //debugln('TPoFamily.CheckIncompatibleFormatArgs: ',Dbgs(ErrorCount),' Errors');
@@ -807,7 +810,7 @@
                              out ErrorCount, WarningCount: Integer; ErrorLog: TStrings);
 var
   SL: TStringList;
-  CurrErrCnt, CurrWarnCnt: Integer;
+  CurrErrCnt, CurrWarnCnt,ThisErrCnt: Integer;
   i: Integer;
   CurrChildName: String;
   S: String;
@@ -897,6 +900,7 @@
     //then iterate all Children
     for i := 0 to SL.Count - 1 do
     begin
+      ThisErrCnt:= 0;
       CurrChildName := SL.Strings[i];
       //debugln('TPoFamily.RunTests: setting ChildName to ',CurrChildName);
       SetChildName(CurrChildName);
@@ -905,12 +909,14 @@
       begin
         CheckNrOfItems(CurrErrCnt, ErrorLog);
         ErrorCount := CurrErrCnt + ErrorCount;
+        ThisErrCnt := ThisErrCnt + CurrErrCnt;
       end;
 
       if (pttCheckFormatArgs in TestTypes) then
       begin
         CheckFormatArgs(CurrErrCnt, ErrorLog, (ptoIgnoreFuzzyStrings in TestOptions));
         ErrorCount := CurrErrCnt + ErrorCount;
+        ThisErrCnt := ThisErrCnt + CurrErrCnt;
       end;
 
 
@@ -918,19 +924,21 @@
       begin
         CheckMissingIdentifiers(CurrErrCnt, ErrorLog);
         ErrorCount := CurrErrCnt + ErrorCount;
+        ThisErrCnt := ThisErrCnt + CurrErrCnt;
       end;
 
       if (pttCheckMismatchedOriginals in TestTypes) then
       begin
         CheckMismatchedOriginals(CurrErrCnt, ErrorLog);
         ErrorCount := CurrErrCnt + ErrorCount;
+        ThisErrCnt := ThisErrCnt + CurrErrCnt;
       end;
 
 
       //Always run this as the last test please
       if (pttCheckStatistics in TestTypes) then
       begin
-        CheckStatistics;
+        CheckStatistics(ThisErrCnt);
       end;
        {
         if (ptt in TestTypes) then
Index: graphstat.lfm
===================================================================
--- graphstat.lfm	(revision 46356)
+++ graphstat.lfm	(working copy)
@@ -41,25 +41,25 @@
     end
     object TranslatedLabel: TLabel
       Left = 104
-      Height = 15
+      Height = 17
       Top = 17
-      Width = 83
+      Width = 105
       Caption = 'TranslatedLabel'
       ParentColor = False
     end
     object UnTranslatedLabel: TLabel
       Left = 104
-      Height = 15
+      Height = 17
       Top = 36
-      Width = 98
+      Width = 122
       Caption = 'UnTranslatedLabel'
       ParentColor = False
     end
     object FuzzyLabel: TLabel
       Left = 104
-      Height = 15
+      Height = 17
       Top = 55
-      Width = 57
+      Width = 75
       Caption = 'FuzzyLabel'
       ParentColor = False
     end
Index: graphstat.pp
===================================================================
--- graphstat.pp	(revision 46356)
+++ graphstat.pp	(working copy)
@@ -99,7 +99,7 @@
     AStat := FPoFamilyStats.Items[Index];
     ListView.Hint := Format(sStatHint,[AStat.NrTranslated, AStat.PercTranslated,
                                        AStat.NrUnTranslated, AStat.PercUnTranslated,
-                                       AStat.NrFuzzy, AStat.PercFuzzy]);
+                                       AStat.NrFuzzy, AStat.PercFuzzy,AStat.NrErrors]);
   end
   else
   begin
@@ -174,10 +174,12 @@
 function TGraphStatForm.CreateBitmap(AStat: TStat): TBitmap;
 const
   FullCircle = 16 * 360;
+  QMark = ' ? ';
 var
   Bmp: TBitmap;
   Translated16Angle, UnTranslated16Angle, Fuzzy16Angle: Integer;
   PieRect: TRect;
+  TextSize: TSize;
 begin
   Bmp := TBitmap.Create;
   Bmp.SetSize(BmpWH,BmpWH);
@@ -220,6 +222,17 @@
       else
         Canvas.RadialPie(PieRect.Left,PieRect.Top,PieRect.Right,PieRect.Bottom,Translated16Angle+UnTranslated16Angle,Fuzzy16Angle);
     end;
+    if AStat.NrErrors <> 0 then begin
+      Bmp.Canvas.Font := Font;
+      Canvas.Font.Size := BmpWH div 6;
+      Canvas.Font.Style:= [fsBold];
+      Canvas.Font.Color:= clRed;
+      TextSize := Bmp.Canvas.TextExtent(QMark);
+      Canvas.Brush.Color:= clBlack;
+      Canvas.Rectangle(0,PieRect.Bottom-TextSize.cy-4,TextSize.cx+4,PieRect.Bottom);
+      Canvas.Brush.Color:= clYellow;
+      Canvas.TextOut(2,PieRect.Bottom-TextSize.cy-2,QMark);
+    end;
   end;
   Result := Bmp;
 end;
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to