forked from JOGAsoft/EBC-controller
-
Notifications
You must be signed in to change notification settings - Fork 3
/
aboutform.pas
executable file
·99 lines (78 loc) · 2.57 KB
/
aboutform.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
unit aboutForm;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
IpFileBroker, IpHtml, SynHighlighterHTML, lclintf, LazVersion;
type
{ TfrmAbout }
TfrmAbout = class(TForm)
Button1: TButton;
IpHtmlPanel1: TIpHtmlPanel;
TopPannel: TPanel;
BottomPannel: TPanel;
procedure LoadResourceStrings;
procedure FormCreate(Sender: TObject);
procedure IpHtmlPanel1HotClick(Sender: TObject);
procedure IpHtmlPanel1HotURL(Sender: TObject; const URL: String);
private
currURL : string;
public
end;
var
frmAbout: TfrmAbout;
implementation
{$R *.lfm}
Resourcestring
cWhatAmI = 'A GUI Software for Linux (and Windows) to control ZTE Tech EBC series battery testers and electronic loads intailly written by %s';
cEnhanced = 'This version %s supports the A20 as well as the A40.';
cEnhancedVersion = 'enhanced version';
cVersion = 'Version';
cCompileDate = 'Compiled';
cFPCVersion = 'FPC Version';
cLazarusVersion = 'Lazarus Version';
{ TfrmAbout }
procedure TfrmAbout.LoadResourceStrings;
var VersionInfo : array[0..3] of string;
maxLen,i,j,k : integer;
begin
maxLen := 0;
VersionInfo[0] := cVersion;
VersionInfo[1] := cCompileDate;
VersionInfo[2] := cFPCVersion;
VersionInfo[3] := cLazarusVersion;
for i := low(VersionInfo) to high(VersionInfo) do
if Length(VersionInfo[i]) > maxLen then maxLen := Length(VersionInfo[i]);
inc(maxLen);
for i := low(VersionInfo) to high(VersionInfo) do
begin
j := maxLen - Length(VersionInfo[i]);
for k := 1 to j do
VersionInfo[i] := VersionInfo[i] + ' ';
end;
IpHtmlPanel1.SetHtmlFromStr(Format(
'<html><head>'+
'<title>'+Caption+'</title>'+
'</head><body>'+
'<h1>EBC-Controller</h1>'+
'<p>'+Format(cWhatAmI,['<a href="https:/JOGAsoft/EBC-controller">JOGAsoft</a>'])+'</p>'+
'<p>'+Format(cEnhanced,['<a href="https:/ardiehl/EBC-controller">'+cEnhancedVersion+'</a>'])+'</p>'+
'<tt>'+VersionInfo[0]+': '+cVersion+'</tt><br>'+
'<tt>'+VersionInfo[1]+': ' + {$I %DATE%} + ' ' + {$I %TIME%} + '</tt><br>' +
'<tt>'+VersionInfo[2]+': '+ {$I %FPCVERSION%} + '</tt><br>'+
'<tt>'+VersionInfo[3]+': %s</tt>' +
'</body></html>',[laz_version]));
end;
procedure TfrmAbout.FormCreate(Sender: TObject);
begin
LoadResourceStrings;
end;
procedure TfrmAbout.IpHtmlPanel1HotClick(Sender: TObject);
begin
openUrl(currURL);
end;
procedure TfrmAbout.IpHtmlPanel1HotURL(Sender: TObject; const URL: String);
begin
currURL:=URL;
end;
end.