108 lines
2.7 KiB
ObjectPascal
108 lines
2.7 KiB
ObjectPascal
unit uCreateChat;
|
|
|
|
interface
|
|
|
|
uses
|
|
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
|
System.Variants, FMX.ListBox, FMX.Colors, FMX.SpinBox,
|
|
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
|
|
fColorSettings, fFontSettings, FMX.Controls.Presentation, FMX.StdCtrls,
|
|
FMX.Edit, FMX.EditBox, StrUtils;
|
|
|
|
type
|
|
TfCreateChat = class(TForm)
|
|
frChatSettings1: TfrColorSettings;
|
|
GroupBox1: TGroupBox;
|
|
GroupBox2: TGroupBox;
|
|
frFontSettings1: TfrFontSettings;
|
|
GroupBox10: TGroupBox;
|
|
Label27: TLabel;
|
|
Label38: TLabel;
|
|
sbMaxMsg: TSpinBox;
|
|
sbTimeMsg: TSpinBox;
|
|
Label39: TLabel;
|
|
cbFreez: TCheckBox;
|
|
sbWebServerPort: TSpinBox;
|
|
edtWebChatTest: TEdit;
|
|
btnWebChatTest: TButton;
|
|
btnCreateWebChat: TButton;
|
|
procedure FormCreate(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
fCreateChat: TfCreateChat;
|
|
|
|
implementation
|
|
|
|
uses uGeneral;
|
|
|
|
{$R *.fmx}
|
|
|
|
procedure TfCreateChat.FormCreate(Sender: TObject);
|
|
procedure LoadFontList;
|
|
var
|
|
SearchRec: TSearchRec;
|
|
n: Integer;
|
|
begin
|
|
if not DirectoryExists(myConst.fontsPath) then
|
|
CreateDir(myConst.fontsPath);
|
|
|
|
n := 1;
|
|
if FindFirst(IncludeTrailingPathDelimiter(myConst.fontsPath) + '*.*',
|
|
faArchive, SearchRec) = 0 then
|
|
try
|
|
repeat
|
|
if (SearchRec.Attr and faAnyFile) = SearchRec.Attr then
|
|
begin
|
|
fCreateChat.frFontSettings1.cbFontStyleDefault.Items.Add
|
|
(SearchRec.Name);
|
|
Inc(n);
|
|
end;
|
|
until FindNext(SearchRec) <> 0;
|
|
finally
|
|
System.SysUtils.FindClose(SearchRec);
|
|
end;
|
|
end;
|
|
|
|
procedure LoadChatOBSSettings;
|
|
var
|
|
I: Integer;
|
|
c: TComponent;
|
|
ColorStr: string;
|
|
SavedColor: TAlphaColor;
|
|
begin
|
|
for I := 0 to frChatSettings1.ComponentCount - 1 do
|
|
begin
|
|
c := frChatSettings1.Components[I];
|
|
if c is TComboBox then
|
|
TComboBox(c).ItemIndex :=
|
|
strtoint(db.ReadSetting(TComboBox(c).Name, '0'))
|
|
else if c is TColorComboBox then
|
|
TColorComboBox(c).ItemIndex :=
|
|
strtoint(db.ReadSetting(TComboBox(c).Name, '147'))
|
|
else if c is TSpinBox then
|
|
TSpinBox(c).text := db.ReadSetting(TSpinBox(c).Name,
|
|
IfThen(TSpinBox(c).Name = 'sbWebServerPort', '8080', '1'))
|
|
else if c is TCheckBox then
|
|
TCheckBox(c).IsChecked := db.ReadSetting(TCheckBox(c).Name, '0') = '1';
|
|
end;
|
|
|
|
ColorStr := db.ReadSetting('cpStyleBlockColor', 'FF000000');
|
|
if TryStrToUInt('$' + ColorStr, Cardinal(SavedColor)) then
|
|
frChatSettings1.cpStyleBlockColor.Color := SavedColor
|
|
else
|
|
frChatSettings1.cpStyleBlockColor.Color := TAlphaColorRec.Black;
|
|
end;
|
|
|
|
begin
|
|
LoadChatOBSSettings;
|
|
LoadFontList;
|
|
|
|
end;
|
|
|
|
end.
|