-
Notifications
You must be signed in to change notification settings - Fork 22
/
uAbout.pas
142 lines (116 loc) · 3.91 KB
/
uAbout.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
unit uAbout;
{$MODE objfpc}
interface
uses
{Windows, Messages,} SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, {ShellApi,} LCLIntf, ExtCtrls, ButtonPanel;
type
{ TAboutForm }
TAboutForm = class(TForm)
ButtonPanel: TButtonPanel;
BuildDateValueLabel: TLabel;
AuthorValueLabel: TLabel;
CompillerTitleLabel: TLabel;
CompillerValueLabel: TLabel;
LinkTitleLabel: TLabel;
LicenseValueLabel: TLabel;
LocalizationAuthorValueLabel: TLabel;
VersionValueLabel: TLabel;
LicenseTitleLabel: TLabel;
Panel: TPanel;
ProgramNameLabel: TLabel;
VersionTitleLabel: TLabel;
AuthorTitleLabel: TLabel;
LinkValueLabel: TLabel;
Logo: TImage;
BuildDateTitleLabel: TLabel;
LocalizationAuthorTitleLabel: TLabel;
procedure FormCreate(Sender: TObject);
procedure LinkValueLabelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
AboutForm: TAboutForm;
implementation
uses uLocalization, uUtils, LazVersion, DateUtils, StrUtils;
{$R *.lfm}
const
ProjectURLTitle = 'https://github.com/artem78/AutoScreenshot';
ProjectURL = ProjectURLTitle + '#readme';
procedure TAboutForm.FormCreate(Sender: TObject);
const
Bitness =
{$IF defined(CPU64)}
'64-bit'
{$ElseIf defined(CPU32)}
'32-bit'
{$Else}
'' // Unknown
{$ENDIF}
;
License = {'GNU General Public License v3.0'} 'GNU GPLv3';
var
Png: TPortableNetworkGraphic;
ResourceName: String;
begin
Caption := Localizer.I18N('About');
//Logo.Picture.Icon.Handle := LoadImage(HInstance, 'MAINICON', IMAGE_ICON,
// 64, 64, LR_DEFAULTCOLOR);
//Logo.Picture.LoadFromLazarusResource('_LOGO');
if Screen.PixelsPerInch <= 120 then // Scale = 100% or 125%
ResourceName := '_LOGO' // Default size with 64px width
else // Scale = 150% or 200%
ResourceName := '_LOGO_HIGH_DPI'; // High resolution with 128px width
png := TPortableNetworkGraphic.Create;
try
Png.LoadFromResourceName(Hinstance, ResourceName);
Logo.Picture.Graphic := Png;
finally
Png.Free;
end;
ProgramNameLabel.Caption := Application.Title;
VersionTitleLabel.Caption := Localizer.I18N('Version') + ':';
VersionValueLabel.Caption := Format('%s (%s) %s', [
GetProgramVersionStr(), Bitness,
IfThen(IsPortable, Localizer.I18N('Portable'))
]);
{$IFOPT D+}
VersionValueLabel.Caption := VersionValueLabel.Caption + ' [DEBUG BUILD]';
{$ENDIF}
AuthorTitleLabel.Caption := Localizer.I18N('Author') + ':';
AuthorValueLabel.Caption := 'Artem Demin (artem78) <[email protected]>';
with Localizer.LanguageInfo do
begin
if (Code <> 'en') and (Author <> '') then
begin
LocalizationAuthorTitleLabel.Caption := Localizer.I18N('LocalizationAuthor') + ':';
LocalizationAuthorTitleLabel.Show;
LocalizationAuthorValueLabel.Caption := Author;
LocalizationAuthorValueLabel.Show;
end
else
begin
LocalizationAuthorTitleLabel.Hide;
LocalizationAuthorValueLabel.Hide;
end;
end;
LinkTitleLabel.Caption := Localizer.I18N('HomePage') + ':';
LinkValueLabel.Caption := ProjectURLTitle;
BuildDateTitleLabel.Caption := Localizer.I18N('BuildDate') + ':';
BuildDateValueLabel.Caption := FormatDateTime('dddddd', GetBuildDateTime);
LicenseTitleLabel.Caption := Localizer.I18N('License') + ':';
LicenseValueLabel.Caption := License;
ButtonPanel.CloseButton.Caption := Localizer.I18N('Close');
CompillerTitleLabel.Caption := Localizer.I18N('Compiller') + ':';
CompillerValueLabel.Caption := Format('FPC %s / Lazarus %s',
[{$I %FPCVersion%}, laz_version]);
// FixMe: Close button icon not hidden
end;
procedure TAboutForm.LinkValueLabelClick(Sender: TObject);
begin
OpenURL(ProjectURL);
end;
end.