-
Notifications
You must be signed in to change notification settings - Fork 86
/
uFrmAbout.pas
118 lines (99 loc) · 2.61 KB
/
uFrmAbout.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
unit uFrmAbout;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls,
StdCtrls, ImgList, uSharedGlobals, uFrmMain, Vcl.Imaging.pngimage, Winapi.Shellapi;
type
TFileHashThread = class(TThread)
private
FFileName: string;
FFileHash: string;
procedure UpdateUI;
protected
procedure Execute; override;
public
constructor Create(fileName: string);
end;
TfrmAbout = class(TForm)
imgLogo: TImage;
btnClose: TButton;
Label1: TLabel;
lblVersion: TLabel;
lblMD5: TLabel;
lblCopyright: TLabel;
lblWebsite: TLabel;
Label2: TLabel;
btnDonate: TButton;
procedure btnCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnDonateClick(Sender: TObject);
procedure lblWebsiteMouseEnter(Sender: TObject);
procedure lblWebsiteMouseLeave(Sender: TObject);
procedure lblWebsiteClick(Sender: TObject);
private
FThreadsRunning: Integer;
procedure ThreadDone(Sender: TObject);
public
{ Public declarations }
end;
var
frmAbout: TfrmAbout;
implementation
{$R *.dfm}
uses
uDM;
constructor TFileHashThread.Create(fileName: string);
begin
FFileName := fileName;
FFileHash := '';
FreeOnTerminate := True;
inherited Create(False);
end;
procedure TFileHashThread.Execute;
begin
FFileHash := MD5FileHash(FFileName);
Synchronize(UpdateUI);
end;
procedure TfrmAbout.btnCloseClick(Sender: TObject);
begin
close;
end;
procedure TfrmAbout.btnDonateClick(Sender: TObject);
begin
ShellExecute(Application.Handle, 'open', DONATE_URL, nil, nil, SW_SHOWNORMAL);
end;
procedure TfrmAbout.FormShow(Sender: TObject);
begin
//sWebLabel1.URL := VISUAL_MASM_WEBSITE_URL;
imgLogo.Picture.LoadFromFile(logoFile);
FThreadsRunning := 1;
with TFileHashThread.Create(dm.VisualMASMOptions.AppFolder+VISUALMASM_FILENAME) do
OnTerminate := ThreadDone;
lblVersion.Caption := 'Version: '+VISUALMASM_VERSION_DISPLAY;
lblCopyright.Caption := COPYRIGHT;
end;
procedure TfrmAbout.lblWebsiteClick(Sender: TObject);
begin
ShellExecute(Application.Handle, 'open', VISUAL_MASM_WEBSITE_URL, nil, nil, SW_SHOWNORMAL);
end;
procedure TfrmAbout.lblWebsiteMouseEnter(Sender: TObject);
begin
lblWebsite.Font.Style := [fsUnderline];
end;
procedure TfrmAbout.lblWebsiteMouseLeave(Sender: TObject);
begin
lblWebsite.Font.Style := [];
end;
procedure TfrmAbout.ThreadDone(Sender: TObject);
begin
Dec(FThreadsRunning);
if FThreadsRunning = 0 then
begin
//StartBtn.Enabled := True;
end;
end;
procedure TFileHashThread.UpdateUI;
begin
frmAbout.lblMD5.Caption := 'MD5: '+FFileHash;
end;
end.