about box, emit a warning when important tools miss

This commit is contained in:
Basile Burg 2016-09-09 01:23:44 +02:00
parent fe8afffa63
commit dd60df8b7e
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 22 additions and 8 deletions

View File

@ -7,7 +7,8 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, strutils, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, strutils,
{$IFDEF WINDOWS}Windows,{$ENDIF} {$IFDEF WINDOWS}Windows,{$ENDIF}
StdCtrls, ExtCtrls, Buttons, Menus,ce_widget, ce_common, ce_sharedres; StdCtrls, ExtCtrls, Buttons, Menus,ce_widget, ce_common, ce_sharedres,
ce_interfaces;
type type
@ -20,6 +21,7 @@ type
fKind: TToolInfoKind; fKind: TToolInfoKind;
fToolName: string; fToolName: string;
fIco: TSpeedButton; fIco: TSpeedButton;
fPresent: boolean;
procedure buttonClick(sender: TObject); procedure buttonClick(sender: TObject);
protected protected
procedure SetVisible(Value: Boolean); override; procedure SetVisible(Value: Boolean); override;
@ -28,6 +30,7 @@ type
const toolName, description: string); const toolName, description: string);
procedure refreshStatus; procedure refreshStatus;
procedure Update; override; procedure Update; override;
property present: boolean read fPresent;
end; end;
@ -115,6 +118,7 @@ var
begin begin
if fLabel.isNil or fStatus.isNil then exit; if fLabel.isNil or fStatus.isNil then exit;
// //
fPresent := false;
fLabel.Caption:= fToolName; fLabel.Caption:= fToolName;
case fKind of case fKind of
tikFindable: tikFindable:
@ -129,6 +133,7 @@ begin
begin begin
fStatus.Caption:= ' the tool is available'; fStatus.Caption:= ' the tool is available';
AssignPng(fIco, 'BULLET_GREEN'); AssignPng(fIco, 'BULLET_GREEN');
fPresent := true;
end; end;
end; end;
tikOptional: tikOptional:
@ -143,6 +148,7 @@ begin
begin begin
fStatus.Caption:= ' the tool is available'; fStatus.Caption:= ' the tool is available';
AssignPng(fIco, 'BULLET_GREEN'); AssignPng(fIco, 'BULLET_GREEN');
fPresent := true;
end; end;
end; end;
tikRunning: tikRunning:
@ -157,11 +163,13 @@ begin
begin begin
fStatus.Caption:= ' the tool is available and running'; fStatus.Caption:= ' the tool is available and running';
AssignPng(fIco, 'BULLET_GREEN'); AssignPng(fIco, 'BULLET_GREEN');
fPresent := true;
end end
else else
begin begin
fStatus.Caption:= ' the tool is available but is not running'; fStatus.Caption:= ' the tool is available but is not running';
AssignPng(fIco, 'BULLET_YELLOW'); AssignPng(fIco, 'BULLET_YELLOW');
fPresent := true;
end; end;
end; end;
end; end;
@ -211,19 +219,19 @@ begin
itm.Parent := boxTools; itm.Parent := boxTools;
itm.ReAlign; itm.ReAlign;
itm := TToolInfo.Construct(self, tikOptional, 'ddemangle', itm := TToolInfo.Construct(self, tikOptional, 'ddemangle',
'optional, allows to demangle cryptic symbols in the message widget'); 'optional, allows to demangle the symbols in the message widget');
itm.Parent := boxTools; itm.Parent := boxTools;
itm.ReAlign; itm.ReAlign;
itm := TToolInfo.Construct(self, tikRunning, 'dcd-server', itm := TToolInfo.Construct(self, tikRunning, 'dcd-server',
'mandatory, provides IDE-level features such as the completion'); 'mandatory, provides IDE-grade features such as the completion');
itm.Parent := boxTools; itm.Parent := boxTools;
itm.ReAlign; itm.ReAlign;
itm := TToolInfo.Construct(self, tikFindable, 'dcd-client', itm := TToolInfo.Construct(self, tikFindable, 'dcd-client',
'mandatory, provides IDE-level features such as the completion'); 'mandatory, provides IDE-grade features such as the completion');
itm.Parent := boxTools; itm.Parent := boxTools;
itm.ReAlign; itm.ReAlign;
itm := TToolInfo.Construct(self, tikFindable, 'dastworx', itm := TToolInfo.Construct(self, tikFindable, 'dastworx',
'background tool that works on the D modules AST to extract informations' + 'background tool that processes the D modules to extract informations' +
LineEnding + 'such as the declarations, the imports, the "TODO" comments, etc.'); LineEnding + 'such as the declarations, the imports, the "TODO" comments, etc.');
itm.Parent := boxTools; itm.Parent := boxTools;
itm.ReAlign; itm.ReAlign;
@ -232,8 +240,7 @@ begin
itm.Parent := boxTools; itm.Parent := boxTools;
itm.ReAlign; itm.ReAlign;
itm := TToolInfo.Construct(self, tikFindable, 'dmd', itm := TToolInfo.Construct(self, tikFindable, 'dmd',
'the reference D compiler, mandatory to compile native projects, ' 'mandatory, the reference D compiler');
+ 'to unittest and to launch runnable modules');
itm.Parent := boxTools; itm.Parent := boxTools;
itm.ReAlign; itm.ReAlign;
// //
@ -243,13 +250,20 @@ end;
procedure TCEInfoWidget.RefreshAllStatus; procedure TCEInfoWidget.RefreshAllStatus;
var var
i: integer; i: integer;
s: string = '';
t: TToolInfo;
begin begin
for i := 0 to boxTools.ControlCount -1 do for i := 0 to boxTools.ControlCount -1 do
begin begin
if not (boxTools.Controls[i] is TToolInfo) then if not (boxTools.Controls[i] is TToolInfo) then
continue; continue;
TToolInfo(boxTools.Controls[i]).refreshStatus; t := TToolInfo(boxTools.Controls[i]);
t.refreshStatus;
if (t.fKind in [tikFindable, tikRunning]) and not t.present then
s += ' ' + t.fToolName;
end; end;
if s.isNotEmpty then
getMessageDisplay.message('Some tools cannot be found:' + s, nil, amcApp, amkWarn);
end; end;
procedure TCEInfoWidget.SetVisible(Value: Boolean); procedure TCEInfoWidget.SetVisible(Value: Boolean);