Skip to content

Commit

Permalink
A few more tweaks to the "About" dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
RemyLebeau authored and RemyLebeau committed Oct 4, 2014
1 parent 6740879 commit b7d10ec
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 20 deletions.
8 changes: 5 additions & 3 deletions Lib/Core/IdAbout.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ interface
IdAboutVCL;
{$ENDIF}

procedure ShowAboutBox(const AProductName, AProductVersion : String);
//we have a procedure for providing a product name and version in case
//we ever want to make another product.
procedure ShowAboutBox(const AProductName, AProductName2, AProductVersion : String);
procedure ShowDlg;

implementation
Expand All @@ -22,9 +24,9 @@ implementation
{$R 'IdAboutDotNET.TfrmAbout.resources' 'IdAboutDotNET.resx'}
{$ENDIF}

procedure ShowAboutBox(const AProductName, AProductVersion : String);
procedure ShowAboutBox(const AProductName, AProductName2, AProductVersion : String);
begin
TfrmAbout.ShowAboutBox(AProductName, AProductVersion);
TfrmAbout.ShowAboutBox(AProductName, AProductName2, AProductVersion);
end;

procedure ShowDlg;
Expand Down
24 changes: 18 additions & 6 deletions Lib/Core/IdAboutDotNET.pas
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ TfrmAbout = class(System.Windows.Forms.Form)
{ Private Declarations }
function GetProductName: string;
procedure SetProductName(const AValue: string);
function GetProductName2: string;
procedure SetProductName2(const AValue: string);
function GetVersion: string;
procedure SetVersion(const AValue: string);
function LoadBitmap(AResName: string): Bitmap;
public
constructor Create;
//we have a method for providing a product name and version in case
//we ever want to make another prdocut.
class Procedure ShowAboutBox(const AProductName, AProductVersion : String);
//we ever want to make another product.
class Procedure ShowAboutBox(const AProductName, AProductName2, AProductVersion : String);
class Procedure ShowDlg;
property ProductName : String read GetProductName write SetProductName;
property ProductName2 : String read GetProductName2 write SetProductName2;
property Version : String read GetVersion write SetVersion;

end;
Expand Down Expand Up @@ -264,30 +267,39 @@ procedure TfrmAbout.SetProductName(const AValue : String);
Self.lblName.Text := AValue;
end;

procedure TfrmAbout.SetProductName2(const AValue : String);
begin
Self.lblName2.Text := AValue;
end;

procedure TfrmAbout.SetVersion(const AValue: string);
begin
Self.lblVersion.Text := AValue;
end;

function TfrmAbout.GetVersion: string;

begin
Result := Self.lblVersion.Text;
end;

function TfrmAbout.GetProductName: string;

begin
Result := Self.lblName.Text;
end;

class procedure TfrmAbout.ShowAboutBox(const AProductName,
function TfrmAbout.GetProductName2: string;
begin
Result := Self.lblName2.Text;
end;

class procedure TfrmAbout.ShowAboutBox(const AProductName, AProductName2,
AProductVersion: String);
begin
with TfrmAbout.Create do
try
Version := IndyFormat(RSAAboutBoxVersion, [AProductVersion]);
ProductName := AProductName;
ProductName2 := AProductName2;
Text := AProductName;
ShowDialog;
finally
Expand All @@ -297,7 +309,7 @@ class procedure TfrmAbout.ShowAboutBox(const AProductName,

class procedure TfrmAbout.ShowDlg;
begin
ShowAboutBox(RSAAboutBoxTitle1{RSAAboutBoxCompName}, gsIdVersion);
ShowAboutBox(RSAAboutBoxTitle1, RSAAboutBoxTitle2, gsIdVersion);
end;

procedure TfrmAbout.lblURL_LinkClicked(sender: System.Object; e: System.Windows.Forms.LinkLabelLinkClickedEventArgs);
Expand Down
26 changes: 21 additions & 5 deletions Lib/Core/IdAboutVCL.pas
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ TfrmAbout = class(TForm)
procedure lblURLClick(Sender: TObject);
function GetProductName: String;
procedure SetProductName(const AValue: String);
function GetProductName2: String;
procedure SetProductName2(const AValue: String);
function GetVersion: String;
procedure SetVersion(const AValue: String);
public
//we have a method for providing a product name and version in case
//we ever want to make another product.
class procedure ShowDlg;
class procedure ShowAboutBox(const AProductName, AProductVersion: String);
class procedure ShowAboutBox(const AProductName, AProductName2, AProductVersion: String);
constructor Create(AOwner : TComponent); overload; override;
constructor Create; reintroduce; overload;
constructor Create; reintroduce; overload;
property ProductName : String read GetProductName write SetProductName;
property ProductName2 : String read GetProductName2 write SetProductName2;
property Version : String read GetVersion write SetVersion;
end;

Expand Down Expand Up @@ -346,10 +351,15 @@ function TfrmAbout.GetProductName: String;
Result := FlblName.Caption;
end;

function TfrmAbout.GetProductName2: String;
begin
Result := FlblName2.Caption;
end;

procedure TfrmAbout.lblURLClick(Sender: TObject);
begin
{$IFDEF WIN32}
ShellAPI.ShellExecute(Handle, PChar('open'), PChar(FlblURL.Caption), nil, nil, 0); {Do not Localize}
ShellAPI.ShellExecute(Handle, nil, PChar(FlblURL.Caption), nil, nil, 0); {Do not Localize}
FlblURL.Font.Color := clPurple;
{$ENDIF}
end;
Expand All @@ -364,7 +374,12 @@ procedure TfrmAbout.SetProductName(const AValue: String);
FlblName.Caption := AValue;
end;

class procedure TfrmAbout.ShowAboutBox(const AProductName, AProductVersion: String);
procedure TfrmAbout.SetProductName2(const AValue: String);
begin
FlblName2.Caption := AValue;
end;

class procedure TfrmAbout.ShowAboutBox(const AProductName, AProductName2, AProductVersion: String);
var
LFrm: TfrmAbout;
begin
Expand All @@ -374,6 +389,7 @@ class procedure TfrmAbout.ShowAboutBox(const AProductName, AProductVersion: Stri
{$ENDIF}
LFrm.Version := IndyFormat(RSAAboutBoxVersion, [AProductVersion]);
LFrm.ProductName := AProductName;
LFrm.ProductName2 := AProductName2;
LFrm.ShowModal;
{$IFNDEF USE_OBJECT_ARC}
finally
Expand All @@ -384,7 +400,7 @@ class procedure TfrmAbout.ShowAboutBox(const AProductName, AProductVersion: Stri

class procedure TfrmAbout.ShowDlg;
begin
ShowAboutBox(RSAAboutBoxTitle1{RSAAboutBoxCompName}, gsIdVersion);
ShowAboutBox(RSAAboutBoxTitle1, RSAAboutBoxTitle2, gsIdVersion);
end;

constructor TfrmAbout.Create;
Expand Down
7 changes: 1 addition & 6 deletions Lib/Core/IdCoreDsnRegister.pas
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ implementation
TIdPropEdBindingEntry = TIdDsnPropEdBindingVCL;
{$ENDIF}

procedure ShowAboutBox(const AProductName, AProductVersion : String);
begin
TfrmAbout.ShowAboutBox(AProductName, AProductVersion);
end;

procedure TIdPropEdBinding.Edit;
var
pSockets: TIdSocketHandles;
Expand Down Expand Up @@ -224,7 +219,7 @@ procedure TIdPropEdBinding.SetValue(const Value: string);
procedure TIdBaseComponentEditor.ExecuteVerb(Index: Integer);
begin
case Index of
0 : ShowAboutBox(RSAAboutBoxCompName, gsIdVersion);
0 : TfrmAbout.ShowDlg;
end;
end;

Expand Down

0 comments on commit b7d10ec

Please sign in to comment.