FreeLaunch
135 строк · 4.4 Кб
1{
2##########################################################################
3# FreeLaunch is a free links manager for Microsoft Windows #
4# #
5# Copyright (C) 2023 Alexey Tatuyko <feedback@ta2i4.ru> #
6# Copyright (C) 2019 Mykola Petrivskiy #
7# Copyright (C) 2010 Joker-jar <joker-jar@yandex.ru> #
8# #
9# This file is part of FreeLaunch. #
10# #
11# FreeLaunch is free software: you can redistribute it and/or modify #
12# it under the terms of the GNU General Public License as published by #
13# the Free Software Foundation, either version 3 of the License, or #
14# (at your option) any later version. #
15# #
16# FreeLaunch is distributed in the hope that it will be useful, #
17# but WITHOUT ANY WARRANTY; without even the implied warranty of #
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
19# GNU General Public License for more details. #
20# #
21# You should have received a copy of the GNU General Public License #
22# along with FreeLaunch. If not, see <http://www.gnu.org/licenses/>. #
23##########################################################################
24}
25
26//define nightly build directive if DEBUG release configuration enabled
27{$IFDEF DEBUG}
28{$DEFINE NIGHTLYBUILD}
29{$ENDIF}
30
31unit AboutFormModule;
32
33interface
34
35uses
36Winapi.Windows, Winapi.Messages,
37System.SysUtils, System.Variants, System.Classes,
38Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
39Vcl.ExtCtrls,
40FLLanguage;
41
42const
43fn_authors = 'AUTHORS.txt';
44fn_license = 'COPYING.txt';
45fn_thanks = 'THANKS.txt';
46
47type
48TAboutForm = class(TForm)
49grp1: TGroupBox;
50LogoImg: TImage;
51AppName: TLabel;
52VerInfo: TLabel;
53Credits: TMemo;
54Contributors: TLabel;
55License: TLabel;
56Thanks: TLabel;
57procedure FormShow(Sender: TObject);
58procedure FormClose(Sender: TObject; var Action: TCloseAction);
59procedure ContributorsClick(Sender: TObject);
60procedure LicenseClick(Sender: TObject);
61procedure ThanksClick(Sender: TObject);
62procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
63private
64procedure LoadFile(FileName: string);
65end;
66
67implementation
68
69uses
70FLaunchMainFormModule, FLFunctions;
71
72{$R *.dfm}
73
74//loading file to credits
75procedure TAboutForm.LoadFile(FileName: string);
76begin
77Credits.Lines.Clear;
78try
79Credits.Lines.LoadFromFile(ExtractFilePath(Application.Exename) + FileName);
80except
81Credits.Lines.Text := Format(Language.Messages.FileNotFound, [FileName]);
82end;
83end;
84
85//click on "Contributors" label
86procedure TAboutForm.ContributorsClick(Sender: TObject);
87begin
88LoadFile(fn_authors);
89end;
90
91//click on "Thanks" label
92procedure TAboutForm.ThanksClick(Sender: TObject);
93begin
94LoadFile(fn_thanks);
95end;
96
97//click on "License" label
98procedure TAboutForm.LicenseClick(Sender: TObject);
99begin
100LoadFile(fn_license);
101end;
102
103procedure TAboutForm.FormClose(Sender: TObject; var Action: TCloseAction);
104begin
105aboutshowing := false;
106action := CAFree;
107end;
108
109procedure TAboutForm.FormKeyDown(Sender: TObject; var Key: Word;
110Shift: TShiftState);
111begin
112if Key = VK_ESCAPE then Close;
113end;
114
115procedure TAboutForm.FormShow(Sender: TObject);
116begin
117aboutshowing := true;
118if AlwaysOnTop then FormStyle := fsStayOnTop;
119//--Loading language
120Caption := Language.About.Caption;
121AppName.Caption := cr_progname;
122VerInfo.Caption := Format('%s: %s.%s (%s build: %s%s)',
123[Language.About.Version, FlVer.Major, FlVer.Minor,
124{$IFDEF NIGHTLYBUILD}'nightly'{$ELSE}'release'{$ENDIF}, FlVer.Release,
125FlVer.Build]);
126Contributors.Caption := Language.About.Contributors;
127License.Caption := Language.About.License;
128License.Left := grp1.Width - license.Width - 20;
129Thanks.Caption := Language.About.Thanks;
130Thanks.Left := Thanks.Left - Round(Thanks.Width / 2);
131LogoImg.Picture.Icon.Handle := LoadIcon(hinstance, 'MAINICON');
132LoadFile(fn_authors);
133end;
134
135end.
136