FreeLaunch

Форк
0
/
AboutFormModule.pas 
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

31
unit AboutFormModule;
32

33
interface
34

35
uses
36
  Winapi.Windows, Winapi.Messages,
37
  System.SysUtils, System.Variants, System.Classes,
38
  Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
39
  Vcl.ExtCtrls,
40
  FLLanguage;
41

42
const
43
  fn_authors = 'AUTHORS.txt';
44
  fn_license = 'COPYING.txt';
45
  fn_thanks  = 'THANKS.txt';
46

47
type
48
  TAboutForm = class(TForm)
49
    grp1: TGroupBox;
50
    LogoImg: TImage;
51
    AppName: TLabel;
52
    VerInfo: TLabel;
53
    Credits: TMemo;
54
    Contributors: TLabel;
55
    License: TLabel;
56
    Thanks: TLabel;
57
    procedure FormShow(Sender: TObject);
58
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
59
    procedure ContributorsClick(Sender: TObject);
60
    procedure LicenseClick(Sender: TObject);
61
    procedure ThanksClick(Sender: TObject);
62
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
63
  private
64
    procedure LoadFile(FileName: string);
65
  end;
66

67
implementation
68

69
uses
70
  FLaunchMainFormModule, FLFunctions;
71

72
{$R *.dfm}
73

74
//loading file to credits
75
procedure TAboutForm.LoadFile(FileName: string);
76
begin
77
  Credits.Lines.Clear;
78
  try
79
    Credits.Lines.LoadFromFile(ExtractFilePath(Application.Exename) + FileName);
80
  except
81
    Credits.Lines.Text := Format(Language.Messages.FileNotFound, [FileName]);
82
  end;
83
end;
84

85
//click on "Contributors" label
86
procedure TAboutForm.ContributorsClick(Sender: TObject);
87
begin
88
  LoadFile(fn_authors);
89
end;
90

91
//click on "Thanks" label
92
procedure TAboutForm.ThanksClick(Sender: TObject);
93
begin
94
  LoadFile(fn_thanks);
95
end;
96

97
//click on "License" label
98
procedure TAboutForm.LicenseClick(Sender: TObject);
99
begin
100
  LoadFile(fn_license);
101
end;
102

103
procedure TAboutForm.FormClose(Sender: TObject; var Action: TCloseAction);
104
begin
105
  aboutshowing := false;
106
  action := CAFree;
107
end;
108

109
procedure TAboutForm.FormKeyDown(Sender: TObject; var Key: Word;
110
  Shift: TShiftState);
111
begin
112
  if Key = VK_ESCAPE then Close;
113
end;
114

115
procedure TAboutForm.FormShow(Sender: TObject);
116
begin
117
  aboutshowing := true;
118
  if AlwaysOnTop then FormStyle := fsStayOnTop;
119
  //--Loading language
120
  Caption := Language.About.Caption;
121
  AppName.Caption := cr_progname;
122
  VerInfo.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,
125
    FlVer.Build]);
126
  Contributors.Caption := Language.About.Contributors;
127
  License.Caption := Language.About.License;
128
  License.Left := grp1.Width - license.Width - 20;
129
  Thanks.Caption := Language.About.Thanks;
130
  Thanks.Left := Thanks.Left - Round(Thanks.Width / 2);
131
  LogoImg.Picture.Icon.Handle := LoadIcon(hinstance, 'MAINICON');
132
  LoadFile(fn_authors);
133
end;
134

135
end.
136

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.