реструктуризация файлов, добавление вебчатов
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
[uCreateChat.pas]
|
||||
SaveTime=14.08.2025 10:44:31
|
||||
FileCount=2
|
||||
File0=C:\Users\PTyTb\Documents\Embarcadero\Studio\Projects\ttw_fmx_v10\forms\uCreateChat.pas
|
||||
File1=C:\Users\PTyTb\Documents\Embarcadero\Studio\Projects\ttw_fmx_v10\forms\uCreateChat.fmx
|
||||
@@ -0,0 +1,189 @@
|
||||
object fCreateChat: TfCreateChat
|
||||
Left = 0
|
||||
Top = 0
|
||||
Caption = #1056#1077#1076#1072#1082#1090#1086#1088' '#1095#1072#1090#1086#1074
|
||||
ClientHeight = 287
|
||||
ClientWidth = 810
|
||||
FormFactor.Width = 320
|
||||
FormFactor.Height = 480
|
||||
FormFactor.Devices = [Desktop]
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
DesignerMasterStyle = 0
|
||||
object GroupBox1: TGroupBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 305.000000000000000000
|
||||
Size.Height = 271.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1041#1083#1086#1082' '#1089#1086#1086#1073#1097#1077#1085#1080#1103
|
||||
TabOrder = 1
|
||||
inline frChatSettings1: TfrColorSettings
|
||||
Align = Client
|
||||
Margins.Top = 20.000000000000000000
|
||||
Size.Width = 305.000000000000000000
|
||||
Size.Height = 251.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbStyleBorderColor: TColorComboBox
|
||||
TabOrder = 30
|
||||
end
|
||||
inherited Label40: TLabel
|
||||
TabOrder = 8
|
||||
end
|
||||
inherited Label42: TLabel
|
||||
TabOrder = 35
|
||||
end
|
||||
inherited Label44: TLabel
|
||||
TabOrder = 38
|
||||
end
|
||||
inherited Label48: TLabel
|
||||
TabOrder = 40
|
||||
end
|
||||
inherited sbStyleBlockBorderSize: TSpinBox
|
||||
TabOrder = 37
|
||||
end
|
||||
inherited sbStyleBlockPadding: TSpinBox
|
||||
TabOrder = 41
|
||||
end
|
||||
inherited Label1: TLabel
|
||||
TabOrder = 34
|
||||
end
|
||||
inherited ccbBColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited btnChangeBGColor: TButton
|
||||
TabOrder = 39
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
Position.X = 321.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 240.000000000000000000
|
||||
Size.Height = 145.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1064#1088#1080#1092#1090
|
||||
TabOrder = 2
|
||||
inline frFontSettings1: TfrFontSettings
|
||||
Align = Client
|
||||
Margins.Top = 20.000000000000000000
|
||||
Size.Width = 240.000000000000000000
|
||||
Size.Height = 125.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbFontColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited Label49: TLabel
|
||||
TabOrder = 35
|
||||
end
|
||||
inherited Label46: TLabel
|
||||
TabOrder = 39
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox10: TGroupBox
|
||||
Position.X = 569.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 232.000000000000000000
|
||||
Size.Height = 203.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1053#1072#1089#1090#1088#1086#1081#1082#1080
|
||||
TabOrder = 0
|
||||
object Label27: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 22.000000000000000000
|
||||
Size.Width = 249.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1052#1072#1082#1089#1080#1084#1072#1083#1100#1085#1086#1077' '#1082#1086#1083#1080#1095#1077#1089#1090#1074#1086' '#1089#1086#1086#1073#1097#1077#1085#1080#1081
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label38: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 77.000000000000000000
|
||||
Size.Width = 249.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1042#1088#1077#1084#1103' '#1086#1090#1086#1073#1088#1072#1078#1077#1085#1080#1103' '#1089#1086#1086#1073#1097#1077#1085#1080#1103
|
||||
TabOrder = 0
|
||||
end
|
||||
object sbMaxMsg: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 5
|
||||
Cursor = crIBeam
|
||||
Value = 5.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 47.000000000000000000
|
||||
end
|
||||
object sbTimeMsg: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 2
|
||||
Cursor = crIBeam
|
||||
Value = 10.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 102.000000000000000000
|
||||
end
|
||||
object Label39: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 132.000000000000000000
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1055#1086#1088#1090' '#1042#1077#1073' '#1057#1077#1088#1074#1077#1088#1072
|
||||
TabOrder = 6
|
||||
end
|
||||
object cbFreez: TCheckBox
|
||||
Position.X = 112.000000000000000000
|
||||
Position.Y = 105.000000000000000000
|
||||
Size.Width = 112.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 38
|
||||
Text = #1042#1077#1095#1085#1086
|
||||
end
|
||||
object sbWebServerPort: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 4
|
||||
Cursor = crIBeam
|
||||
Min = 8080.000000000000000000
|
||||
Max = 65000.000000000000000000
|
||||
Value = 8085.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 157.000000000000000000
|
||||
end
|
||||
end
|
||||
object edtWebChatTest: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 5
|
||||
Position.X = 321.000000000000000000
|
||||
Position.Y = 161.000000000000000000
|
||||
Size.Width = 240.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnWebChatTest: TButton
|
||||
Position.X = 321.000000000000000000
|
||||
Position.Y = 191.000000000000000000
|
||||
Size.Width = 152.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 3
|
||||
Text = #1058#1077#1089#1090#1086#1074#1086#1077' '#1089#1086#1086#1073#1097#1077#1085#1080#1077
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnWebChatTestClick
|
||||
end
|
||||
object btnCreateWebChat: TButton
|
||||
Position.X = 704.000000000000000000
|
||||
Position.Y = 257.000000000000000000
|
||||
Size.Width = 97.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1057#1086#1079#1076#1072#1090#1100' '#1095#1072#1090
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCreateWebChatClick
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,207 @@
|
||||
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, uRecords;
|
||||
|
||||
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);
|
||||
procedure btnCreateWebChatClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure btnWebChatTestClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
function GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
public
|
||||
{ Public declarations }
|
||||
isEdit: boolean;
|
||||
oldPort: integer;
|
||||
procedure setRecord(aRec: TOBSChat);
|
||||
end;
|
||||
|
||||
var
|
||||
fCreateChat: TfCreateChat;
|
||||
|
||||
implementation
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
function TfCreateChat.GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
var
|
||||
Color: TAlphaColor;
|
||||
r, G, B: Byte;
|
||||
A: Real;
|
||||
FS: TFormatSettings;
|
||||
begin
|
||||
Color := aColor;
|
||||
r := TAlphaColorRec(Color).r;
|
||||
G := TAlphaColorRec(Color).G;
|
||||
B := TAlphaColorRec(Color).B;
|
||||
A := TAlphaColorRec(Color).A / 255; // Преобразуем альфа-канал в диапазон 0..1
|
||||
|
||||
// Устанавливаем точку в качестве десятичного разделителя
|
||||
FS := TFormatSettings.Create;
|
||||
FS.DecimalSeparator := '.';
|
||||
|
||||
result := Format('rgba(%d, %d, %d, %.2f)', [r, G, B, A], FS);
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.setRecord(aRec: TOBSChat);
|
||||
var
|
||||
SavedColor: TAlphaColor;
|
||||
begin
|
||||
if TryStrToUInt('$' + aRec.ColorBlock, Cardinal(SavedColor)) then
|
||||
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := SavedColor
|
||||
else
|
||||
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := TAlphaColorRec.Black;
|
||||
fCreateChat.frChatSettings1.ccbStyleBorderColor.ItemIndex := aRec.ColorBorder;
|
||||
fCreateChat.frChatSettings1.ccbBColor.ItemIndex := aRec.ColorBackground;
|
||||
fCreateChat.frChatSettings1.sbStyleBlockBorderSize.Value := aRec.SolidBorder;
|
||||
fCreateChat.frChatSettings1.sbStyleBlockPadding.Value := aRec.Paddings;
|
||||
|
||||
fCreateChat.frFontSettings1.ccbFontColor.ItemIndex := aRec.ColorFont;
|
||||
fCreateChat.frFontSettings1.sbFontSize.Value := aRec.SizeFont;
|
||||
fCreateChat.frFontSettings1.cbFontStyleDefault.ItemIndex := aRec.StyleFont;
|
||||
|
||||
fCreateChat.sbTimeMsg.Value := aRec.TimeMess;
|
||||
fCreateChat.sbMaxMsg.Value := aRec.MaxCountMess;
|
||||
fCreateChat.sbWebServerPort.Value := aRec.port;
|
||||
oldPort := aRec.port;
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.btnCreateWebChatClick(Sender: TObject);
|
||||
var
|
||||
OBSChat: TOBSChat;
|
||||
begin
|
||||
OBSChat.ColorBlock := GetColorFromColorPanel
|
||||
(frChatSettings1.cpStyleBlockColor.Color);
|
||||
OBSChat.ColorBorder := frChatSettings1.ccbStyleBorderColor.ItemIndex;
|
||||
OBSChat.ColorBackground := frChatSettings1.ccbBColor.ItemIndex;
|
||||
OBSChat.SolidBorder := round(frChatSettings1.sbStyleBlockBorderSize.Value);
|
||||
OBSChat.Paddings := round(frChatSettings1.sbStyleBlockPadding.Value);
|
||||
|
||||
OBSChat.ColorFont := frFontSettings1.ccbFontColor.ItemIndex;
|
||||
OBSChat.SizeFont := round(frFontSettings1.sbFontSize.Value);
|
||||
OBSChat.StyleFont := frFontSettings1.cbFontStyleDefault.ItemIndex;
|
||||
|
||||
OBSChat.MaxCountMess := round(sbMaxMsg.Value);
|
||||
OBSChat.TimeMess := round(sbTimeMsg.Value);
|
||||
OBSChat.port := round(sbWebServerPort.Value);
|
||||
|
||||
if isEdit then
|
||||
TTW_Bot.frOBS1.EdtChat(OBSChat, oldPort)
|
||||
else
|
||||
TTW_Bot.frOBS1.AddChat(OBSChat);
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.btnWebChatTestClick(Sender: TObject);
|
||||
var j:integer; aRecord: TTwitchChatMessage;
|
||||
begin
|
||||
aRecord.Username:='Test';
|
||||
aRecord.DisplayName:='Test';
|
||||
aRecord.Message:=edtWebChatTest.Text;
|
||||
for j := 0 to TTW_Bot.frOBS1.ChatWebServers.Count - 1 do
|
||||
begin
|
||||
if TTW_Bot.frOBS1.ChatWebServers[j].port = round(sbWebServerPort.Value) then
|
||||
begin
|
||||
TTW_Bot.frOBS1.MsgToWebServer(aRecord);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
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
|
||||
isEdit := false;
|
||||
LoadChatOBSSettings;
|
||||
LoadFontList;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.FormShow(Sender: TObject);
|
||||
begin
|
||||
if isEdit then
|
||||
btnCreateWebChat.text := 'Изменить чат'
|
||||
else
|
||||
btnCreateWebChat.text := 'Создать чат';
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,188 @@
|
||||
object fCreateChat: TfCreateChat
|
||||
Left = 0
|
||||
Top = 0
|
||||
Caption = #1056#1077#1076#1072#1082#1090#1086#1088' '#1095#1072#1090#1086#1074
|
||||
ClientHeight = 287
|
||||
ClientWidth = 810
|
||||
FormFactor.Width = 320
|
||||
FormFactor.Height = 480
|
||||
FormFactor.Devices = [Desktop]
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
DesignerMasterStyle = 0
|
||||
object GroupBox1: TGroupBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 305.000000000000000000
|
||||
Size.Height = 271.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1041#1083#1086#1082' '#1089#1086#1086#1073#1097#1077#1085#1080#1103
|
||||
TabOrder = 1
|
||||
inline frChatSettings1: TfrColorSettings
|
||||
Align = Client
|
||||
Margins.Top = 20.000000000000000000
|
||||
Size.Width = 305.000000000000000000
|
||||
Size.Height = 251.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbStyleBorderColor: TColorComboBox
|
||||
TabOrder = 31
|
||||
end
|
||||
inherited Label40: TLabel
|
||||
TabOrder = 8
|
||||
end
|
||||
inherited Label42: TLabel
|
||||
TabOrder = 35
|
||||
end
|
||||
inherited Label44: TLabel
|
||||
TabOrder = 38
|
||||
end
|
||||
inherited Label48: TLabel
|
||||
TabOrder = 40
|
||||
end
|
||||
inherited sbStyleBlockBorderSize: TSpinBox
|
||||
TabOrder = 37
|
||||
end
|
||||
inherited Label1: TLabel
|
||||
TabOrder = 34
|
||||
end
|
||||
inherited ccbBColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited btnChangeBGColor: TButton
|
||||
TabOrder = 39
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
Position.X = 321.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 240.000000000000000000
|
||||
Size.Height = 145.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1064#1088#1080#1092#1090
|
||||
TabOrder = 2
|
||||
inline frFontSettings1: TfrFontSettings
|
||||
Align = Client
|
||||
Margins.Top = 20.000000000000000000
|
||||
Size.Width = 240.000000000000000000
|
||||
Size.Height = 125.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited Label41: TLabel
|
||||
TabOrder = 6
|
||||
end
|
||||
inherited ccbFontColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited Label49: TLabel
|
||||
TabOrder = 35
|
||||
end
|
||||
inherited Label46: TLabel
|
||||
TabOrder = 39
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox10: TGroupBox
|
||||
Position.X = 569.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 232.000000000000000000
|
||||
Size.Height = 203.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1053#1072#1089#1090#1088#1086#1081#1082#1080
|
||||
TabOrder = 0
|
||||
object Label27: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 22.000000000000000000
|
||||
Size.Width = 249.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1052#1072#1082#1089#1080#1084#1072#1083#1100#1085#1086#1077' '#1082#1086#1083#1080#1095#1077#1089#1090#1074#1086' '#1089#1086#1086#1073#1097#1077#1085#1080#1081
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label38: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 77.000000000000000000
|
||||
Size.Width = 249.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1042#1088#1077#1084#1103' '#1086#1090#1086#1073#1088#1072#1078#1077#1085#1080#1103' '#1089#1086#1086#1073#1097#1077#1085#1080#1103
|
||||
TabOrder = 0
|
||||
end
|
||||
object sbMaxMsg: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 5
|
||||
Cursor = crIBeam
|
||||
Value = 5.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 47.000000000000000000
|
||||
end
|
||||
object sbTimeMsg: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 2
|
||||
Cursor = crIBeam
|
||||
Value = 10.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 102.000000000000000000
|
||||
end
|
||||
object Label39: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 132.000000000000000000
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1055#1086#1088#1090' '#1042#1077#1073' '#1057#1077#1088#1074#1077#1088#1072
|
||||
TabOrder = 6
|
||||
end
|
||||
object cbFreez: TCheckBox
|
||||
Position.X = 112.000000000000000000
|
||||
Position.Y = 105.000000000000000000
|
||||
Size.Width = 112.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 37
|
||||
Text = #1042#1077#1095#1085#1086
|
||||
end
|
||||
object sbWebServerPort: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 4
|
||||
Cursor = crIBeam
|
||||
Min = 8080.000000000000000000
|
||||
Max = 65000.000000000000000000
|
||||
Value = 8085.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 157.000000000000000000
|
||||
end
|
||||
end
|
||||
object edtWebChatTest: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 5
|
||||
Position.X = 321.000000000000000000
|
||||
Position.Y = 161.000000000000000000
|
||||
Size.Width = 240.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnWebChatTest: TButton
|
||||
Position.X = 321.000000000000000000
|
||||
Position.Y = 191.000000000000000000
|
||||
Size.Width = 152.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 3
|
||||
Text = #1058#1077#1089#1090#1086#1074#1086#1077' '#1089#1086#1086#1073#1097#1077#1085#1080#1077
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnCreateWebChat: TButton
|
||||
Position.X = 704.000000000000000000
|
||||
Position.Y = 257.000000000000000000
|
||||
Size.Width = 97.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1057#1086#1079#1076#1072#1090#1100' '#1095#1072#1090
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCreateWebChatClick
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,191 @@
|
||||
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, uRecords;
|
||||
|
||||
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);
|
||||
procedure btnCreateWebChatClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
function GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
public
|
||||
{ Public declarations }
|
||||
isEdit: boolean;
|
||||
oldPort: integer;
|
||||
procedure setRecord(aRec: TOBSChat);
|
||||
end;
|
||||
|
||||
var
|
||||
fCreateChat: TfCreateChat;
|
||||
|
||||
implementation
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
function TfCreateChat.GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
var
|
||||
Color: TAlphaColor;
|
||||
r, G, B: Byte;
|
||||
A: Real;
|
||||
FS: TFormatSettings;
|
||||
begin
|
||||
Color := aColor;
|
||||
r := TAlphaColorRec(Color).r;
|
||||
G := TAlphaColorRec(Color).G;
|
||||
B := TAlphaColorRec(Color).B;
|
||||
A := TAlphaColorRec(Color).A / 255; // Ïðåîáðàçóåì àëüôà-êàíàë â äèàïàçîí 0..1
|
||||
|
||||
// Óñòàíàâëèâàåì òî÷êó â êà÷åñòâå äåñÿòè÷íîãî ðàçäåëèòåëÿ
|
||||
FS := TFormatSettings.Create;
|
||||
FS.DecimalSeparator := '.';
|
||||
|
||||
result := Format('rgba(%d, %d, %d, %.2f)', [r, G, B, A], FS);
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.setRecord(aRec: TOBSChat);
|
||||
var
|
||||
SavedColor: TAlphaColor;
|
||||
begin
|
||||
if TryStrToUInt('$' + aRec.ColorBlock, Cardinal(SavedColor)) then
|
||||
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := SavedColor
|
||||
else
|
||||
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := TAlphaColorRec.Black;
|
||||
fCreateChat.frChatSettings1.ccbStyleBorderColor.ItemIndex := aRec.ColorBorder;
|
||||
fCreateChat.frChatSettings1.ccbBColor.ItemIndex := aRec.ColorBackground;
|
||||
fCreateChat.frChatSettings1.sbStyleBlockBorderSize.Value := aRec.SolidBorder;
|
||||
fCreateChat.frChatSettings1.sbStyleBlockPadding.Value := aRec.Paddings;
|
||||
|
||||
fCreateChat.frFontSettings1.ccbFontColor.ItemIndex := aRec.ColorFont;
|
||||
fCreateChat.frFontSettings1.sbFontSize.Value := aRec.SizeFont;
|
||||
fCreateChat.frFontSettings1.cbFontStyleDefault.ItemIndex := aRec.StyleFont;
|
||||
|
||||
fCreateChat.sbTimeMsg.Value := aRec.TimeMess;
|
||||
fCreateChat.sbMaxMsg.Value := aRec.MaxCountMess;
|
||||
fCreateChat.sbWebServerPort.Value := aRec.port;
|
||||
oldPort := aRec.port;
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.btnCreateWebChatClick(Sender: TObject);
|
||||
var
|
||||
OBSChat: TOBSChat;
|
||||
begin
|
||||
OBSChat.ColorBlock := GetColorFromColorPanel
|
||||
(frChatSettings1.cpStyleBlockColor.Color);
|
||||
OBSChat.ColorBorder := frChatSettings1.ccbStyleBorderColor.ItemIndex;
|
||||
OBSChat.ColorBackground := frChatSettings1.ccbBColor.ItemIndex;
|
||||
OBSChat.SolidBorder := round(frChatSettings1.sbStyleBlockBorderSize.Value);
|
||||
OBSChat.Paddings := round(frChatSettings1.sbStyleBlockPadding.Value);
|
||||
|
||||
OBSChat.ColorFont := frFontSettings1.ccbFontColor.ItemIndex;
|
||||
OBSChat.SizeFont := round(frFontSettings1.sbFontSize.Value);
|
||||
OBSChat.StyleFont := frFontSettings1.cbFontStyleDefault.ItemIndex;
|
||||
|
||||
OBSChat.MaxCountMess := round(sbMaxMsg.Value);
|
||||
OBSChat.TimeMess := round(sbTimeMsg.Value);
|
||||
OBSChat.port := round(sbWebServerPort.Value);
|
||||
|
||||
if isEdit then
|
||||
TTW_Bot.frOBS1.EdtChat(OBSChat, oldPort)
|
||||
else
|
||||
TTW_Bot.frOBS1.AddChat(OBSChat);
|
||||
close;
|
||||
end;
|
||||
|
||||
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
|
||||
isEdit := false;
|
||||
LoadChatOBSSettings;
|
||||
LoadFontList;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.FormShow(Sender: TObject);
|
||||
begin
|
||||
if isEdit then
|
||||
btnCreateWebChat.text := 'Èçìåíèòü ÷àò'
|
||||
else
|
||||
btnCreateWebChat.text := 'Ñîçäàòü ÷àò';
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,280 @@
|
||||
object fCreateNotify: TfCreateNotify
|
||||
Left = 0
|
||||
Top = 0
|
||||
Caption = #1056#1077#1076#1072#1082#1090#1086#1088' '#1086#1087#1086#1074#1077#1097#1077#1085#1080#1103
|
||||
ClientHeight = 383
|
||||
ClientWidth = 813
|
||||
FormFactor.Width = 320
|
||||
FormFactor.Height = 480
|
||||
FormFactor.Devices = [Desktop]
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
DesignerMasterStyle = 0
|
||||
object btnESImageOpen: TButton
|
||||
Hint = #1050#1072#1088#1090#1080#1085#1082#1080'|*.jpg; *.jpeg; *.gif; *.webp'
|
||||
Position.X = 297.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 22.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 45
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnESSoundOpen: TButton
|
||||
Hint = #1052#1091#1079#1099#1082#1072'|*.mp3'
|
||||
Position.X = 297.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 22.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 42
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object edtESImage: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 36
|
||||
ReadOnly = True
|
||||
Text = '\imgs\follow.gif'
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 281.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtESSound: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 35
|
||||
ReadOnly = True
|
||||
Text = '\sounds\report_bobdyfound.mp3'
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 281.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object Label58: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1050#1072#1088#1090#1080#1085#1082#1072
|
||||
TabOrder = 49
|
||||
end
|
||||
object Label68: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1047#1074#1091#1082
|
||||
TabOrder = 37
|
||||
end
|
||||
inline frColorSettings1: TfrColorSettings
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 118.000000000000000000
|
||||
Size.Width = 311.000000000000000000
|
||||
Size.Height = 258.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbStyleBorderColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited Label42: TLabel
|
||||
TabOrder = 37
|
||||
end
|
||||
inherited Label44: TLabel
|
||||
TabOrder = 38
|
||||
end
|
||||
inherited Label48: TLabel
|
||||
TabOrder = 40
|
||||
end
|
||||
inherited Label1: TLabel
|
||||
TabOrder = 35
|
||||
end
|
||||
inherited ccbBColor: TColorComboBox
|
||||
TabOrder = 39
|
||||
end
|
||||
inherited btnChangeBGColor: TButton
|
||||
TabOrder = 41
|
||||
end
|
||||
end
|
||||
object GroupBox10: TGroupBox
|
||||
Position.X = 596.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 209.000000000000000000
|
||||
Size.Height = 247.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1053#1072#1089#1090#1088#1086#1081#1082#1080
|
||||
TabOrder = 0
|
||||
object Label38: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 25.000000000000000000
|
||||
Size.Width = 216.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1042#1088#1077#1084#1103' '#1086#1090#1086#1073#1088#1072#1078#1077#1085#1080#1103' '#1086#1087#1086#1074#1077#1097#1077#1085#1080#1103
|
||||
TabOrder = 0
|
||||
end
|
||||
object sbTimeMsg: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 2
|
||||
Cursor = crIBeam
|
||||
Value = 10.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 50.000000000000000000
|
||||
end
|
||||
object Label39: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 80.000000000000000000
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1055#1086#1088#1090' '#1042#1077#1073' '#1057#1077#1088#1074#1077#1088#1072
|
||||
TabOrder = 4
|
||||
end
|
||||
object sbWebServerPort: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 3
|
||||
Cursor = crIBeam
|
||||
Min = 8080.000000000000000000
|
||||
Max = 65000.000000000000000000
|
||||
Value = 8085.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 105.000000000000000000
|
||||
end
|
||||
object Label2: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 135.000000000000000000
|
||||
Text = #1057#1086#1073#1099#1090#1080#1077
|
||||
TabOrder = 42
|
||||
end
|
||||
object cbEventsType: TComboBox
|
||||
Items.Strings = (
|
||||
#1054#1090#1089#1083#1077#1078#1080#1074#1072#1085#1080#1077
|
||||
#1055#1086#1076#1087#1080#1089#1082#1072
|
||||
#1055#1086#1076#1072#1088#1086#1095#1085#1072#1103' '#1087#1086#1076#1087#1080#1089#1082#1072
|
||||
#1056#1077#1081#1076
|
||||
#1044#1086#1085#1072#1090)
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 160.000000000000000000
|
||||
Size.Width = 192.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 43
|
||||
OnChange = cbEventsTypeChange
|
||||
end
|
||||
object Label3: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 190.000000000000000000
|
||||
Text = #1059#1089#1083#1086#1074#1080#1077' '#1089#1091#1084#1084#1099
|
||||
Visible = False
|
||||
TabOrder = 44
|
||||
end
|
||||
object edtIF: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 45
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 215.000000000000000000
|
||||
Size.Width = 192.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Visible = False
|
||||
end
|
||||
end
|
||||
object btnCreateEvent: TButton
|
||||
Position.X = 596.000000000000000000
|
||||
Position.Y = 353.000000000000000000
|
||||
Size.Width = 209.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 64
|
||||
Text = #1057#1086#1079#1076#1072#1090#1100' '#1086#1087#1086#1074#1077#1097#1077#1085#1080#1077
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCreateEventClick
|
||||
end
|
||||
object btnESTest: TButton
|
||||
Position.X = 596.000000000000000000
|
||||
Position.Y = 263.000000000000000000
|
||||
TabOrder = 59
|
||||
Text = #1058#1077#1089#1090
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object GroupBox1: TGroupBox
|
||||
Padding.Left = 10.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 10.000000000000000000
|
||||
Padding.Bottom = 10.000000000000000000
|
||||
Position.X = 327.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 261.000000000000000000
|
||||
Size.Height = 167.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1047#1072#1075#1086#1083#1086#1074#1086#1082
|
||||
TabOrder = 66
|
||||
object edtESTitle: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
Align = Top
|
||||
TabOrder = 37
|
||||
Text = '[NICK] '#1085#1072#1095#1072#1083' '#1086#1090#1089#1083#1077#1078#1080#1074#1072#1090#1100' '#1074#1072#1089
|
||||
Position.X = 10.000000000000000000
|
||||
Position.Y = 20.000000000000000000
|
||||
Size.Width = 241.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
inline frFontSettings2: TfrFontSettings
|
||||
Align = Client
|
||||
Size.Width = 241.000000000000000000
|
||||
Size.Height = 115.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbFontColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited Label49: TLabel
|
||||
TabOrder = 35
|
||||
end
|
||||
inherited Label46: TLabel
|
||||
TabOrder = 39
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
Padding.Left = 10.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 10.000000000000000000
|
||||
Padding.Bottom = 10.000000000000000000
|
||||
Position.X = 327.000000000000000000
|
||||
Position.Y = 183.000000000000000000
|
||||
Size.Width = 261.000000000000000000
|
||||
Size.Height = 167.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1057#1086#1086#1073#1097#1077#1085#1080#1077
|
||||
TabOrder = 65
|
||||
inline frFontSettings3: TfrFontSettings
|
||||
Align = Client
|
||||
Size.Width = 241.000000000000000000
|
||||
Size.Height = 115.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbFontColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited Label49: TLabel
|
||||
TabOrder = 35
|
||||
end
|
||||
inherited Label46: TLabel
|
||||
TabOrder = 38
|
||||
end
|
||||
end
|
||||
object edtESMessage: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
Align = Top
|
||||
TabOrder = 35
|
||||
Text = #1044#1086#1073#1088#1086' '#1087#1086#1078#1072#1083#1086#1074#1072#1090#1100
|
||||
Position.X = 10.000000000000000000
|
||||
Position.Y = 20.000000000000000000
|
||||
Size.Width = 241.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,312 @@
|
||||
unit uCreateNotify;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants,
|
||||
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, fFontSettings,
|
||||
fColorSettings, FMX.StdCtrls, FMX.Edit, FMX.Controls.Presentation,
|
||||
FMX.ListBox, FMX.EditBox, FMX.SpinBox, FMX.Colors, uRecords;
|
||||
|
||||
type
|
||||
TfCreateNotify = class(TForm)
|
||||
btnESImageOpen: TButton;
|
||||
btnESSoundOpen: TButton;
|
||||
edtESImage: TEdit;
|
||||
edtESSound: TEdit;
|
||||
edtESTitle: TEdit;
|
||||
Label58: TLabel;
|
||||
Label68: TLabel;
|
||||
frColorSettings1: TfrColorSettings;
|
||||
frFontSettings2: TfrFontSettings;
|
||||
GroupBox10: TGroupBox;
|
||||
Label38: TLabel;
|
||||
sbTimeMsg: TSpinBox;
|
||||
Label39: TLabel;
|
||||
sbWebServerPort: TSpinBox;
|
||||
Label2: TLabel;
|
||||
cbEventsType: TComboBox;
|
||||
Label3: TLabel;
|
||||
edtIF: TEdit;
|
||||
btnCreateEvent: TButton;
|
||||
btnESTest: TButton;
|
||||
GroupBox1: TGroupBox;
|
||||
GroupBox2: TGroupBox;
|
||||
frFontSettings3: TfrFontSettings;
|
||||
edtESMessage: TEdit;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure btnCreateEventClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure cbEventsTypeChange(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
function GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
public
|
||||
{ Public declarations }
|
||||
isEdit: boolean;
|
||||
oldPort: integer;
|
||||
procedure setRecord(aRec: TOBSNotify);
|
||||
end;
|
||||
|
||||
var
|
||||
fCreateNotify: TfCreateNotify;
|
||||
|
||||
implementation
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
function TfCreateNotify.GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
var
|
||||
Color: TAlphaColor;
|
||||
r, G, B: Byte;
|
||||
A: Real;
|
||||
FS: TFormatSettings;
|
||||
begin
|
||||
Color := aColor;
|
||||
r := TAlphaColorRec(Color).r;
|
||||
G := TAlphaColorRec(Color).G;
|
||||
B := TAlphaColorRec(Color).B;
|
||||
A := TAlphaColorRec(Color).A / 255; // Ïðåîáðàçóåì àëüôà-êàíàë â äèàïàçîí 0..1
|
||||
|
||||
// Óñòàíàâëèâàåì òî÷êó â êà÷åñòâå äåñÿòè÷íîãî ðàçäåëèòåëÿ
|
||||
FS := TFormatSettings.Create;
|
||||
FS.DecimalSeparator := '.';
|
||||
|
||||
result := Format('rgba(%d, %d, %d, %.2f)', [r, G, B, A], FS);
|
||||
end;
|
||||
|
||||
procedure TfCreateNotify.setRecord(aRec: TOBSNotify);
|
||||
var
|
||||
SavedColor: TAlphaColor;
|
||||
begin
|
||||
with aRec do
|
||||
begin
|
||||
fCreateNotify.edtESImage.Text := Picture;
|
||||
fCreateNotify.edtESSound.Text := Sound;
|
||||
|
||||
if TryStrToUInt('$' + ColorBlock, Cardinal(SavedColor)) then
|
||||
fCreateNotify.frColorSettings1.cpStyleBlockColor.Color := SavedColor
|
||||
else
|
||||
fCreateNotify.frColorSettings1.cpStyleBlockColor.Color :=
|
||||
TAlphaColorRec.Black;
|
||||
|
||||
fCreateNotify.frColorSettings1.sbStyleBlockBorderSize.Value := SolidBorder;
|
||||
fCreateNotify.frColorSettings1.sbStyleBlockPadding.Value := Paddings;
|
||||
fCreateNotify.frColorSettings1.ccbStyleBorderColor.ItemIndex := ColorBorder;
|
||||
fCreateNotify.frColorSettings1.ccbBColor.ItemIndex := ColorBackground;
|
||||
|
||||
fCreateNotify.edtESTitle.Text := HeaderText;
|
||||
fCreateNotify.frFontSettings2.ccbFontColor.ItemIndex := HeaderColorFont;
|
||||
fCreateNotify.frFontSettings2.sbFontSize.Value := HeaderSizeFont;
|
||||
fCreateNotify.frFontSettings2.cbFontStyleDefault.ItemIndex :=
|
||||
HeaderStyleFont;
|
||||
|
||||
fCreateNotify.edtESMessage.Text := MessText;
|
||||
fCreateNotify.frFontSettings3.ccbFontColor.ItemIndex := MessColorFont;
|
||||
fCreateNotify.frFontSettings3.sbFontSize.Value := MessSizeFont;
|
||||
fCreateNotify.frFontSettings3.cbFontStyleDefault.ItemIndex := MessStyleFont;
|
||||
|
||||
fCreateNotify.sbTimeMsg.Value := TimeMess;
|
||||
fCreateNotify.cbEventsType.ItemIndex := TypeEvent;
|
||||
fCreateNotify.edtIF.Text := TypeEdit;
|
||||
fCreateNotify.sbWebServerPort.Value := port;
|
||||
oldPort:=port;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfCreateNotify.btnCreateEventClick(Sender: TObject);
|
||||
var
|
||||
OBSNotify: TOBSNotify;
|
||||
begin
|
||||
with OBSNotify do
|
||||
begin
|
||||
Picture := edtESImage.Text;
|
||||
Sound := edtESSound.Text;
|
||||
|
||||
ColorBlock := GetColorFromColorPanel
|
||||
(frColorSettings1.cpStyleBlockColor.Color);
|
||||
SolidBorder := round(frColorSettings1.sbStyleBlockBorderSize.Value);
|
||||
Paddings := round(frColorSettings1.sbStyleBlockPadding.Value);
|
||||
ColorBorder := frColorSettings1.ccbStyleBorderColor.ItemIndex;
|
||||
ColorBackground := frColorSettings1.ccbBColor.ItemIndex;
|
||||
|
||||
HeaderText := edtESTitle.Text;
|
||||
HeaderColorFont := frFontSettings2.ccbFontColor.ItemIndex;
|
||||
HeaderSizeFont := round(frFontSettings2.sbFontSize.Value);
|
||||
HeaderStyleFont := frFontSettings2.cbFontStyleDefault.ItemIndex;
|
||||
|
||||
MessText := edtESMessage.Text;
|
||||
MessColorFont := frFontSettings3.ccbFontColor.ItemIndex;
|
||||
MessSizeFont := round(frFontSettings3.sbFontSize.Value);
|
||||
MessStyleFont := frFontSettings3.cbFontStyleDefault.ItemIndex;
|
||||
|
||||
TimeMess := round(sbTimeMsg.Value);
|
||||
TypeEvent := cbEventsType.ItemIndex;
|
||||
TypeEdit := edtIF.Text;
|
||||
port := round(sbWebServerPort.Value);
|
||||
end;
|
||||
if isEdit then
|
||||
TTW_Bot.frOBS1.EdtNotify(OBSNotify, oldPort)
|
||||
else
|
||||
TTW_Bot.frOBS1.AddNotify(OBSNotify);
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfCreateNotify.cbEventsTypeChange(Sender: TObject);
|
||||
begin
|
||||
Label3.Visible := cbEventsType.ItemIndex = 4;
|
||||
edtIF.Visible := cbEventsType.ItemIndex = 4;
|
||||
end;
|
||||
|
||||
procedure TfCreateNotify.FormCreate(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
SavedColor: TAlphaColor;
|
||||
c: TComponent;
|
||||
ColorStr: string;
|
||||
begin
|
||||
isEdit := false;
|
||||
for i := 0 to frColorSettings1.ComponentCount - 1 do
|
||||
begin
|
||||
c := frColorSettings1.Components[i];
|
||||
if c is TComboBox then
|
||||
begin
|
||||
TComboBox(c).ItemIndex :=
|
||||
strtoint(DB.ReadSetting(TComboBox(c).Name, '0'));
|
||||
end;
|
||||
if c is TColorComboBox then
|
||||
begin
|
||||
TColorComboBox(c).ItemIndex :=
|
||||
strtoint(DB.ReadSetting(TComboBox(c).Name, '147'));
|
||||
end;
|
||||
if c is TSpinBox then
|
||||
begin
|
||||
TSpinBox(c).Text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
end;
|
||||
if c is TColorPanel then
|
||||
begin
|
||||
ColorStr := DB.ReadSetting(TColorPanel(c).Name, 'FF000000');
|
||||
if TryStrToUInt('$' + ColorStr, Cardinal(SavedColor)) then
|
||||
TColorPanel(c).Color := SavedColor
|
||||
else
|
||||
TColorPanel(c).Color := TAlphaColorRec.Black;
|
||||
end;
|
||||
if c is TEdit then
|
||||
begin
|
||||
if TEdit(c).Name <> 'edtPortServer' then
|
||||
TEdit(c).Text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
end;
|
||||
if c is TCheckBox then
|
||||
begin
|
||||
TCheckBox(c).IsChecked := DB.ReadSetting(TCheckBox(c).Name) = '1';
|
||||
end;
|
||||
end;
|
||||
for i := 0 to frFontSettings2.ComponentCount - 1 do
|
||||
begin
|
||||
c := frFontSettings2.Components[i];
|
||||
if c is TComboBox then
|
||||
begin
|
||||
TComboBox(c).ItemIndex :=
|
||||
strtoint(DB.ReadSetting(TComboBox(c).Name, '0'));
|
||||
end;
|
||||
if c is TColorComboBox then
|
||||
begin
|
||||
TColorComboBox(c).ItemIndex :=
|
||||
strtoint(DB.ReadSetting(TComboBox(c).Name, '147'));
|
||||
end;
|
||||
if c is TSpinBox then
|
||||
begin
|
||||
TSpinBox(c).Text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
end;
|
||||
if c is TColorPanel then
|
||||
begin
|
||||
ColorStr := DB.ReadSetting(TColorPanel(c).Name, 'FF000000');
|
||||
if TryStrToUInt('$' + ColorStr, Cardinal(SavedColor)) then
|
||||
TColorPanel(c).Color := SavedColor
|
||||
else
|
||||
TColorPanel(c).Color := TAlphaColorRec.Black;
|
||||
end;
|
||||
if c is TEdit then
|
||||
begin
|
||||
if TEdit(c).Name <> 'edtPortServer' then
|
||||
TEdit(c).Text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
end;
|
||||
if c is TCheckBox then
|
||||
begin
|
||||
TCheckBox(c).IsChecked := DB.ReadSetting(TCheckBox(c).Name) = '1';
|
||||
end;
|
||||
end;
|
||||
|
||||
for i := 0 to frFontSettings3.ComponentCount - 1 do
|
||||
begin
|
||||
c := frFontSettings3.Components[i];
|
||||
if c is TComboBox then
|
||||
begin
|
||||
TComboBox(c).ItemIndex :=
|
||||
strtoint(DB.ReadSetting(TComboBox(c).Name, '0'));
|
||||
end;
|
||||
if c is TColorComboBox then
|
||||
begin
|
||||
TColorComboBox(c).ItemIndex :=
|
||||
strtoint(DB.ReadSetting(TComboBox(c).Name, '147'));
|
||||
end;
|
||||
if c is TSpinBox then
|
||||
begin
|
||||
TSpinBox(c).Text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
end;
|
||||
if c is TColorPanel then
|
||||
begin
|
||||
ColorStr := DB.ReadSetting(TColorPanel(c).Name, 'FF000000');
|
||||
if TryStrToUInt('$' + ColorStr, Cardinal(SavedColor)) then
|
||||
TColorPanel(c).Color := SavedColor
|
||||
else
|
||||
TColorPanel(c).Color := TAlphaColorRec.Black;
|
||||
end;
|
||||
if c is TEdit then
|
||||
begin
|
||||
if TEdit(c).Name <> 'edtPortServer' then
|
||||
TEdit(c).Text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
end;
|
||||
if c is TCheckBox then
|
||||
begin
|
||||
TCheckBox(c).IsChecked := DB.ReadSetting(TCheckBox(c).Name) = '1';
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
cDir := myconst.fontsPath; // Èñêàòü â ïàïêå ñ ïðîãðàììîé
|
||||
var
|
||||
FileName := '*.*'; // Èùåì âñå ôàéëû
|
||||
ChDir(cDir); // âîéòè â êàòàëîã
|
||||
var
|
||||
SearchRec: TSearchRec;
|
||||
if FindFirst(FileName, faArchive, SearchRec) = 0 then
|
||||
repeat
|
||||
if (SearchRec.Attr and faAnyFile) = SearchRec.Attr then
|
||||
begin
|
||||
frFontSettings2.cbFontStyleDefault.Items.Add(SearchRec.Name);
|
||||
frFontSettings3.cbFontStyleDefault.Items.Add(SearchRec.Name);
|
||||
|
||||
|
||||
end;
|
||||
until FindNext(SearchRec) <> 0;
|
||||
ChDir('..');
|
||||
|
||||
end;
|
||||
|
||||
procedure TfCreateNotify.FormShow(Sender: TObject);
|
||||
begin
|
||||
if isEdit then
|
||||
begin
|
||||
btnCreateEvent.Text := 'Èçìåíèòü îïîâåùåíèå';
|
||||
end
|
||||
else
|
||||
begin
|
||||
btnCreateEvent.Text := 'Ñîçäàòü îïîâåùåíèå';
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
+22352
File diff suppressed because it is too large
Load Diff
+1724
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
object frmQ: TfrmQ
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = ToolWindow
|
||||
Caption = #1042#1074#1077#1076#1080#1090#1077' '#1079#1085#1072#1095#1077#1085#1080#1077
|
||||
ClientHeight = 96
|
||||
ClientWidth = 466
|
||||
FormFactor.Width = 320
|
||||
FormFactor.Height = 480
|
||||
FormFactor.Devices = [Desktop]
|
||||
DesignerMasterStyle = 0
|
||||
object Button1: TButton
|
||||
Position.X = 378.000000000000000000
|
||||
Position.Y = 66.000000000000000000
|
||||
TabOrder = 0
|
||||
Text = #1054#1082
|
||||
TextSettings.Trimming = None
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 450.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1048#1084#1103' '#1073#1086#1090#1072
|
||||
TabOrder = 1
|
||||
end
|
||||
object Edit1: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 2
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 450.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
unit uQ;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Edit,
|
||||
FMX.StdCtrls, FMX.Controls.Presentation;
|
||||
|
||||
type
|
||||
TfrmQ = class(TForm)
|
||||
Button1: TButton;
|
||||
Label1: TLabel;
|
||||
Edit1: TEdit;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
function GetEditText: string;
|
||||
procedure SetLabelText(const Text: string);
|
||||
end;
|
||||
|
||||
var
|
||||
frmQ: TfrmQ;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
procedure TfrmQ.Button1Click(Sender: TObject);
|
||||
begin
|
||||
ModalResult := mrOk;
|
||||
end;
|
||||
|
||||
function TfrmQ.GetEditText: string;
|
||||
begin
|
||||
Result := Edit1.Text;
|
||||
Edit1.Text:='';
|
||||
end;
|
||||
|
||||
procedure TfrmQ.SetLabelText(const Text: string);
|
||||
begin
|
||||
Label1.Text := Text;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,39 @@
|
||||
object fShowText: TfShowText
|
||||
Left = 0
|
||||
Top = 0
|
||||
Caption = #1057#1089#1099#1083#1082#1072' '#1085#1072' '#1072#1074#1090#1086#1088#1080#1079#1072#1094#1080#1102
|
||||
ClientHeight = 295
|
||||
ClientWidth = 498
|
||||
FormFactor.Width = 320
|
||||
FormFactor.Height = 480
|
||||
FormFactor.Devices = [Desktop]
|
||||
DesignerMasterStyle = 0
|
||||
object Memo1: TMemo
|
||||
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
|
||||
DataDetectorTypes = []
|
||||
Align = Client
|
||||
Size.Width = 498.000000000000000000
|
||||
Size.Height = 262.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 0
|
||||
Viewport.Width = 498.000000000000000000
|
||||
Viewport.Height = 262.000000000000000000
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Align = Bottom
|
||||
Position.Y = 262.000000000000000000
|
||||
Size.Width = 498.000000000000000000
|
||||
Size.Height = 33.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 345.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1057#1082#1086#1087#1080#1088#1091#1081' '#1101#1090#1091' '#1089#1089#1099#1083#1082#1091' '#1080' '#1086#1090#1082#1088#1086#1081' '#1074' '#1073#1088#1072#1091#1079#1077#1088#1077' '#1089' '#1072#1082#1082#1072#1091#1085#1090#1086#1084' '#1073#1086#1090#1072
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
unit uShowText;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types,
|
||||
FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo;
|
||||
|
||||
type
|
||||
TfShowText = class(TForm)
|
||||
Memo1: TMemo;
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
fShowText: TfShowText;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user