From b7d10ec01e43a0f0ab8a3dfe6c57f82fc043cb72 Mon Sep 17 00:00:00 2001 From: RemyLebeau Date: Sat, 4 Oct 2014 17:34:34 +0000 Subject: [PATCH] A few more tweaks to the "About" dialog. --- Lib/Core/IdAbout.pas | 8 +++++--- Lib/Core/IdAboutDotNET.pas | 24 ++++++++++++++++++------ Lib/Core/IdAboutVCL.pas | 26 +++++++++++++++++++++----- Lib/Core/IdCoreDsnRegister.pas | 7 +------ 4 files changed, 45 insertions(+), 20 deletions(-) diff --git a/Lib/Core/IdAbout.pas b/Lib/Core/IdAbout.pas index 746155896..d34fe0cb0 100644 --- a/Lib/Core/IdAbout.pas +++ b/Lib/Core/IdAbout.pas @@ -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 @@ -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; diff --git a/Lib/Core/IdAboutDotNET.pas b/Lib/Core/IdAboutDotNET.pas index a3761dd77..7fe5e50ec 100644 --- a/Lib/Core/IdAboutDotNET.pas +++ b/Lib/Core/IdAboutDotNET.pas @@ -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; @@ -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 @@ -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); diff --git a/Lib/Core/IdAboutVCL.pas b/Lib/Core/IdAboutVCL.pas index fc5138090..7a3ceaf7d 100644 --- a/Lib/Core/IdAboutVCL.pas +++ b/Lib/Core/IdAboutVCL.pas @@ -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; @@ -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; @@ -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 @@ -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 @@ -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; diff --git a/Lib/Core/IdCoreDsnRegister.pas b/Lib/Core/IdCoreDsnRegister.pas index a6b8638e7..491901f73 100644 --- a/Lib/Core/IdCoreDsnRegister.pas +++ b/Lib/Core/IdCoreDsnRegister.pas @@ -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; @@ -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;