реструктуризация файлов, добавление вебчатов
This commit is contained in:
+215
@@ -0,0 +1,215 @@
|
||||
object frAI: TfrAI
|
||||
Size.Width = 723.000000000000000000
|
||||
Size.Height = 181.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object btnGetAIDef: TButton
|
||||
Position.X = 313.000000000000000000
|
||||
Position.Y = 148.000000000000000000
|
||||
Size.Width = 149.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 43
|
||||
Text = #1055#1086#1083#1091#1095#1080#1090#1100' GigaChat'
|
||||
TextSettings.Trimming = None
|
||||
Visible = False
|
||||
OnClick = btnGetAIDefClick
|
||||
end
|
||||
object edtAIP2: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 40
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 143.000000000000000000
|
||||
Size.Width = 297.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtAIP1: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 37
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 297.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtGPTPrefix: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 42
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 297.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object Label45: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = 'ClientID'
|
||||
TabOrder = 36
|
||||
end
|
||||
object Label47: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 118.000000000000000000
|
||||
Size.Width = 175.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = 'Autorization Code'
|
||||
TabOrder = 41
|
||||
end
|
||||
object GroupBox1: TGroupBox
|
||||
Position.X = 313.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 145.000000000000000000
|
||||
Size.Height = 132.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1040#1082#1090#1080#1074#1085#1072#1103' '#1085#1077#1081#1088#1086#1089#1077#1090#1100
|
||||
TabOrder = 44
|
||||
object rbGC: TRadioButton
|
||||
Align = Top
|
||||
Hint = '0'
|
||||
IsChecked = True
|
||||
Margins.Left = 5.000000000000000000
|
||||
Margins.Top = 15.000000000000000000
|
||||
Margins.Right = 5.000000000000000000
|
||||
Margins.Bottom = 5.000000000000000000
|
||||
Position.X = 5.000000000000000000
|
||||
Position.Y = 15.000000000000000000
|
||||
Size.Width = 135.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 40
|
||||
Text = 'GigaChat'
|
||||
OnChange = RBCustomChange
|
||||
end
|
||||
object RBCustom: TRadioButton
|
||||
Align = Top
|
||||
Hint = '3'
|
||||
Margins.Left = 5.000000000000000000
|
||||
Margins.Top = 5.000000000000000000
|
||||
Margins.Right = 5.000000000000000000
|
||||
Margins.Bottom = 5.000000000000000000
|
||||
Position.X = 5.000000000000000000
|
||||
Position.Y = 102.000000000000000000
|
||||
Size.Width = 135.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 39
|
||||
Text = 'Custom'
|
||||
OnChange = RBCustomChange
|
||||
end
|
||||
object rbDS: TRadioButton
|
||||
Align = Top
|
||||
Hint = '1'
|
||||
Margins.Left = 5.000000000000000000
|
||||
Margins.Top = 5.000000000000000000
|
||||
Margins.Right = 5.000000000000000000
|
||||
Margins.Bottom = 5.000000000000000000
|
||||
Position.X = 5.000000000000000000
|
||||
Position.Y = 44.000000000000000000
|
||||
Size.Width = 135.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 38
|
||||
Text = 'DeepSeek'
|
||||
OnChange = RBCustomChange
|
||||
end
|
||||
object rbCG: TRadioButton
|
||||
Align = Top
|
||||
Hint = '2'
|
||||
Margins.Left = 5.000000000000000000
|
||||
Margins.Top = 5.000000000000000000
|
||||
Margins.Right = 5.000000000000000000
|
||||
Margins.Bottom = 5.000000000000000000
|
||||
Position.X = 5.000000000000000000
|
||||
Position.Y = 73.000000000000000000
|
||||
Size.Width = 135.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 37
|
||||
Text = 'ChatGPT'
|
||||
OnChange = RBCustomChange
|
||||
end
|
||||
end
|
||||
object edtAIP3: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 38
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 198.000000000000000000
|
||||
Size.Width = 297.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Visible = False
|
||||
end
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 173.000000000000000000
|
||||
Size.Width = 175.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1052#1086#1076#1077#1083#1100
|
||||
Visible = False
|
||||
TabOrder = 39
|
||||
end
|
||||
object Label2: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 297.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1060#1088#1072#1079#1072' '#1087#1077#1088#1077#1076' '#1089#1086#1086#1073#1097#1077#1085#1080#1077#1084' '#1087#1086#1083#1100#1079#1086#1074#1072#1090#1077#1083#1103
|
||||
TabOrder = 45
|
||||
end
|
||||
object cbOllama: TCheckBox
|
||||
Position.X = 313.000000000000000000
|
||||
Position.Y = 198.000000000000000000
|
||||
TabOrder = 46
|
||||
Text = 'Ollama'
|
||||
Visible = False
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
Position.X = 466.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 247.000000000000000000
|
||||
Size.Height = 132.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = 'Kandinsky'
|
||||
TabOrder = 47
|
||||
object Label3: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 25.000000000000000000
|
||||
Text = 'API '#1082#1083#1102#1095
|
||||
TabOrder = 37
|
||||
end
|
||||
object Label4: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 80.000000000000000000
|
||||
Text = #1057#1077#1082#1088#1077#1090#1085#1099#1081' '#1082#1083#1102#1095
|
||||
TabOrder = 38
|
||||
end
|
||||
object edtKandiKey: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 39
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 50.000000000000000000
|
||||
Size.Width = 233.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtKandiSecret: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 40
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 105.000000000000000000
|
||||
Size.Width = 231.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
end
|
||||
end
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
unit fAI;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Edit, FMX.Controls.Presentation;
|
||||
|
||||
type
|
||||
TfrAI = class(TFrame)
|
||||
btnGetAIDef: TButton;
|
||||
edtAIP2: TEdit;
|
||||
edtAIP1: TEdit;
|
||||
edtGPTPrefix: TEdit;
|
||||
Label45: TLabel;
|
||||
Label47: TLabel;
|
||||
GroupBox1: TGroupBox;
|
||||
rbGC: TRadioButton;
|
||||
RBCustom: TRadioButton;
|
||||
rbDS: TRadioButton;
|
||||
rbCG: TRadioButton;
|
||||
edtAIP3: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
cbOllama: TCheckBox;
|
||||
GroupBox2: TGroupBox;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
edtKandiKey: TEdit;
|
||||
edtKandiSecret: TEdit;
|
||||
procedure RBCustomChange(Sender: TObject);
|
||||
procedure btnGetAIDefClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
procedure TfrAI.btnGetAIDefClick(Sender: TObject);
|
||||
begin
|
||||
rbGC.IsChecked := true;
|
||||
if appconst.AI_GigaChat_ClientID <> '' then
|
||||
edtAIP1.text := appconst.AI_GigaChat_ClientID;
|
||||
if appconst.AI_GigaChat_AC <> '' then
|
||||
edtAIP2.text := appconst.AI_GigaChat_AC;
|
||||
|
||||
DB.WriteSetting('edtAIP1', edtAIP1.text);
|
||||
DB.WriteSetting('edtAIP2', edtAIP2.text);
|
||||
end;
|
||||
|
||||
procedure TfrAI.RBCustomChange(Sender: TObject);
|
||||
var
|
||||
aiIndex: Integer;
|
||||
begin
|
||||
aiIndex := -1;
|
||||
if TRadioButton(Sender).IsChecked then
|
||||
aiIndex := strtoint(TRadioButton(Sender).Hint);
|
||||
if aiIndex = -1 then
|
||||
exit;
|
||||
case aiIndex of
|
||||
0:
|
||||
begin
|
||||
Label45.text := 'ClientID';
|
||||
Label47.text := 'Autorization Code';
|
||||
Label1.Visible := false;
|
||||
edtAIP2.Visible := true;
|
||||
edtAIP2.Password := true;
|
||||
edtAIP3.Visible := false;
|
||||
cbOllama.IsChecked:=false;
|
||||
cbOllama.Visible:=false;
|
||||
end;
|
||||
1:
|
||||
begin
|
||||
Label45.text := 'API Token';
|
||||
Label47.text := '';
|
||||
Label1.Visible := false;
|
||||
edtAIP2.Visible := false;
|
||||
edtAIP2.Password := false;
|
||||
edtAIP3.Visible := false;
|
||||
cbOllama.IsChecked:=false;
|
||||
cbOllama.Visible:=false;
|
||||
end;
|
||||
2:
|
||||
begin
|
||||
Label45.text := 'API Token';
|
||||
Label47.text := '';
|
||||
Label1.Visible := false;
|
||||
edtAIP2.Visible := false;
|
||||
edtAIP2.Password := false;
|
||||
edtAIP3.Visible := false;
|
||||
cbOllama.IsChecked:=false;
|
||||
cbOllama.Visible:=false;
|
||||
end;
|
||||
3:
|
||||
begin
|
||||
Label45.text := 'API Token';
|
||||
Label47.text := 'URL';
|
||||
Label1.Visible := true;
|
||||
edtAIP2.Visible := true;
|
||||
edtAIP2.Password := false;
|
||||
edtAIP3.Visible := true;
|
||||
cbOllama.IsChecked:=false;
|
||||
cbOllama.Visible:=true;
|
||||
end;
|
||||
end;
|
||||
DB.WriteSetting('aiIndex', inttostr(aiIndex));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,324 @@
|
||||
object frAutoActions: TfrAutoActions
|
||||
Size.Width = 813.000000000000000000
|
||||
Size.Height = 548.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object GroupBox20: TGroupBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 479.000000000000000000
|
||||
Size.Height = 320.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1058#1072#1081#1084#1077#1088#1099
|
||||
TabOrder = 1
|
||||
object edtMessage: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 38
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 257.000000000000000000
|
||||
Size.Width = 406.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtInterval: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 39
|
||||
Text = '10'
|
||||
Position.X = 412.000000000000000000
|
||||
Position.Y = 257.000000000000000000
|
||||
Size.Width = 55.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnAddMessage: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 287.000000000000000000
|
||||
TabOrder = 40
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnAddMessageClick
|
||||
end
|
||||
object btnRmMessage: TButton
|
||||
Position.X = 184.000000000000000000
|
||||
Position.Y = 287.000000000000000000
|
||||
TabOrder = 41
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnRmMessageClick
|
||||
end
|
||||
object btnEditMessage: TButton
|
||||
Position.X = 96.000000000000000000
|
||||
Position.Y = 287.000000000000000000
|
||||
TabOrder = 42
|
||||
Text = #1048#1079#1084#1077#1085#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnEditMessageClick
|
||||
end
|
||||
object btnNotifyTest: TButton
|
||||
Position.X = 412.000000000000000000
|
||||
Position.Y = 287.000000000000000000
|
||||
Size.Width = 55.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 43
|
||||
Text = #1058#1077#1089#1090
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyTestClick
|
||||
end
|
||||
object sgTimers: TStringGrid
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
Size.Width = 463.000000000000000000
|
||||
Size.Height = 225.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 44
|
||||
RowCount = 0
|
||||
OnEditingDone = sgTimersEditingDone
|
||||
OnCellClick = sgTimersCellClick
|
||||
Viewport.Width = 459.000000000000000000
|
||||
Viewport.Height = 200.000000000000000000
|
||||
object ccTimerEnable: TCheckColumn
|
||||
Header = #1042#1082#1083
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
object scTimerMessage: TStringColumn
|
||||
Header = #1057#1086#1086#1073#1097#1077#1085#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
ReadOnly = True
|
||||
Size.Width = 301.000000000000000000
|
||||
end
|
||||
object icTimerInterval: TIntegerColumn
|
||||
Header = #1048#1085#1090#1077#1088#1074#1072#1083
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
ReadOnly = True
|
||||
Size.Width = 67.000000000000000000
|
||||
end
|
||||
object ccTimerO: TCheckColumn
|
||||
Header = #1054
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox23: TGroupBox
|
||||
Position.X = 495.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 313.000000000000000000
|
||||
Size.Height = 401.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1040#1074#1090#1086' '#1073#1072#1085
|
||||
TabOrder = 2
|
||||
object edtBanWords: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 38
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 257.000000000000000000
|
||||
Size.Width = 297.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnBanWordsAdd: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 367.000000000000000000
|
||||
TabOrder = 39
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnBanWordsAddClick
|
||||
end
|
||||
object btnBanWordsEdt: TButton
|
||||
Position.X = 96.000000000000000000
|
||||
Position.Y = 367.000000000000000000
|
||||
TabOrder = 40
|
||||
Text = #1048#1079#1084#1077#1085#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnBanWordsEdtClick
|
||||
end
|
||||
object btnBanWordsDel: TButton
|
||||
Position.X = 184.000000000000000000
|
||||
Position.Y = 367.000000000000000000
|
||||
TabOrder = 41
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnBanWordsDelClick
|
||||
end
|
||||
object sgBanWords: TStringGrid
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
Size.Width = 297.000000000000000000
|
||||
Size.Height = 225.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 42
|
||||
RowCount = 0
|
||||
OnCellClick = sgBanWordsCellClick
|
||||
Viewport.Width = 293.000000000000000000
|
||||
Viewport.Height = 200.000000000000000000
|
||||
object scRegEx: TStringColumn
|
||||
Header = #1056#1077#1075#1091#1083#1103#1088#1085#1086#1077' '#1074#1099#1088#1072#1078#1077#1085#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
ReadOnly = True
|
||||
Size.Width = 265.000000000000000000
|
||||
end
|
||||
end
|
||||
object btnBanWordsCheck: TButton
|
||||
Position.X = 225.000000000000000000
|
||||
Position.Y = 312.000000000000000000
|
||||
TabOrder = 43
|
||||
Text = #1055#1088#1086#1074#1077#1088#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnBanWordsCheckClick
|
||||
end
|
||||
object Label6: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 287.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1055#1088#1086#1074#1077#1088#1082#1072':'
|
||||
TabOrder = 44
|
||||
end
|
||||
object edtBanWordsCheck: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 45
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 312.000000000000000000
|
||||
Size.Width = 209.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object Label7: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 342.000000000000000000
|
||||
Size.Width = 65.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1056#1077#1079#1091#1083#1100#1090#1072#1090':'
|
||||
TabOrder = 46
|
||||
end
|
||||
object lBanWordsCheck: TLabel
|
||||
Position.X = 81.000000000000000000
|
||||
Position.Y = 342.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1085#1077#1090' '#1073#1072#1085#1074#1086#1088#1076#1072
|
||||
TabOrder = 47
|
||||
end
|
||||
end
|
||||
object GroupBox17: TGroupBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 328.000000000000000000
|
||||
Size.Width = 479.000000000000000000
|
||||
Size.Height = 217.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1057#1095#1077#1090#1095#1080#1082#1080
|
||||
TabOrder = 0
|
||||
object edtCounterName: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 41
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 153.000000000000000000
|
||||
Size.Width = 102.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtCounterTrigger: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 39
|
||||
Position.X = 118.000000000000000000
|
||||
Position.Y = 153.000000000000000000
|
||||
Size.Width = 290.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtCounterCount: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 38
|
||||
Text = '0'
|
||||
Position.X = 416.000000000000000000
|
||||
Position.Y = 153.000000000000000000
|
||||
Size.Width = 55.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnCounterAdd: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 183.000000000000000000
|
||||
TabOrder = 40
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCounterAddClick
|
||||
end
|
||||
object btnCounterDelete: TButton
|
||||
Position.X = 184.000000000000000000
|
||||
Position.Y = 183.000000000000000000
|
||||
TabOrder = 42
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCounterDeleteClick
|
||||
end
|
||||
object btnCounterP: TButton
|
||||
Position.X = 410.000000000000000000
|
||||
Position.Y = 183.000000000000000000
|
||||
Size.Width = 25.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 43
|
||||
Text = '+'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCounterPClick
|
||||
end
|
||||
object btnCounterM: TButton
|
||||
Position.X = 443.000000000000000000
|
||||
Position.Y = 183.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 44
|
||||
Text = '-'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCounterMClick
|
||||
end
|
||||
object btnCounterEdit: TButton
|
||||
Position.X = 96.000000000000000000
|
||||
Position.Y = 183.000000000000000000
|
||||
TabOrder = 45
|
||||
Text = #1048#1079#1084#1077#1085#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCounterEditClick
|
||||
end
|
||||
object sgCounter: TStringGrid
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
Size.Width = 463.000000000000000000
|
||||
Size.Height = 121.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 46
|
||||
RowCount = 0
|
||||
OnCellClick = sgCounterCellClick
|
||||
Viewport.Width = 459.000000000000000000
|
||||
Viewport.Height = 96.000000000000000000
|
||||
object scCounterName: TStringColumn
|
||||
Header = #1053#1072#1079#1074#1072#1085#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
ReadOnly = True
|
||||
end
|
||||
object scCounterTrigger: TStringColumn
|
||||
Header = #1058#1088#1080#1075#1075#1077#1088
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
ReadOnly = True
|
||||
Size.Width = 236.000000000000000000
|
||||
end
|
||||
object icCounterCount: TIntegerColumn
|
||||
Header = #1050#1086#1083#1080#1095#1077#1089#1090#1074#1086
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
ReadOnly = True
|
||||
Size.Width = 73.000000000000000000
|
||||
end
|
||||
object ccCounterAuto: TCheckColumn
|
||||
Header = #1040
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,482 @@
|
||||
unit fAutoActions;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants, uRegExpr,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
System.Rtti, FMX.Grid.Style, FMX.Grid, FMX.ScrollBox, FMX.Edit, StrUtils,
|
||||
FMX.Controls.Presentation, uMyTimer, uRecords, System.Generics.Collections;
|
||||
|
||||
type
|
||||
TfrAutoActions = class(TFrame)
|
||||
GroupBox20: TGroupBox;
|
||||
edtMessage: TEdit;
|
||||
edtInterval: TEdit;
|
||||
btnAddMessage: TButton;
|
||||
btnRmMessage: TButton;
|
||||
btnEditMessage: TButton;
|
||||
btnNotifyTest: TButton;
|
||||
sgTimers: TStringGrid;
|
||||
ccTimerEnable: TCheckColumn;
|
||||
scTimerMessage: TStringColumn;
|
||||
icTimerInterval: TIntegerColumn;
|
||||
ccTimerO: TCheckColumn;
|
||||
GroupBox23: TGroupBox;
|
||||
edtBanWords: TEdit;
|
||||
btnBanWordsAdd: TButton;
|
||||
btnBanWordsEdt: TButton;
|
||||
btnBanWordsDel: TButton;
|
||||
sgBanWords: TStringGrid;
|
||||
scRegEx: TStringColumn;
|
||||
btnBanWordsCheck: TButton;
|
||||
Label6: TLabel;
|
||||
edtBanWordsCheck: TEdit;
|
||||
Label7: TLabel;
|
||||
lBanWordsCheck: TLabel;
|
||||
GroupBox17: TGroupBox;
|
||||
edtCounterName: TEdit;
|
||||
edtCounterTrigger: TEdit;
|
||||
edtCounterCount: TEdit;
|
||||
btnCounterAdd: TButton;
|
||||
btnCounterDelete: TButton;
|
||||
btnCounterP: TButton;
|
||||
btnCounterM: TButton;
|
||||
btnCounterEdit: TButton;
|
||||
sgCounter: TStringGrid;
|
||||
scCounterName: TStringColumn;
|
||||
scCounterTrigger: TStringColumn;
|
||||
icCounterCount: TIntegerColumn;
|
||||
ccCounterAuto: TCheckColumn;
|
||||
procedure btnAddMessageClick(Sender: TObject);
|
||||
procedure btnEditMessageClick(Sender: TObject);
|
||||
procedure btnRmMessageClick(Sender: TObject);
|
||||
procedure btnNotifyTestClick(Sender: TObject);
|
||||
procedure sgTimersEditingDone(Sender: TObject; const ACol, ARow: Integer);
|
||||
procedure btnBanWordsCheckClick(Sender: TObject);
|
||||
procedure btnBanWordsAddClick(Sender: TObject);
|
||||
procedure btnBanWordsEdtClick(Sender: TObject);
|
||||
procedure btnBanWordsDelClick(Sender: TObject);
|
||||
procedure btnCounterAddClick(Sender: TObject);
|
||||
procedure btnCounterEditClick(Sender: TObject);
|
||||
procedure btnCounterDeleteClick(Sender: TObject);
|
||||
procedure btnCounterPClick(Sender: TObject);
|
||||
procedure btnCounterMClick(Sender: TObject);
|
||||
procedure sgTimersCellClick(const Column: TColumn; const Row: Integer);
|
||||
procedure sgBanWordsCellClick(const Column: TColumn; const Row: Integer);
|
||||
procedure sgCounterCellClick(const Column: TColumn; const Row: Integer);
|
||||
private
|
||||
{ Private declarations }
|
||||
procedure OnMyTimerExec(Sender: TObject; const txt: string; o: Boolean);
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
FTimerList: TObjectList<TMyTimerThread>;
|
||||
listTimer: TArray<TListTimer>;
|
||||
listBanWords: TArray<TBanWord>;
|
||||
listCounters: TArray<TCounter>;
|
||||
destructor Destroy; override;
|
||||
procedure UpdateGridFromArray;
|
||||
procedure initTimers;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
procedure TfrAutoActions.btnAddMessageClick(Sender: TObject);
|
||||
var
|
||||
TimerThread: TMyTimerThread;
|
||||
NewRec: TListTimer;
|
||||
begin
|
||||
if (edtMessage.text = '') or (edtInterval.text = '') then
|
||||
exit;
|
||||
|
||||
TimerThread := TMyTimerThread.Create(edtInterval.text.ToInteger,
|
||||
edtMessage.text, false);
|
||||
TimerThread.OnTimerExec := OnMyTimerExec;
|
||||
FTimerList.Add(TimerThread);
|
||||
|
||||
NewRec.Enable := 1;
|
||||
NewRec.interval := edtInterval.text.ToInteger;
|
||||
NewRec.o := 0;
|
||||
NewRec.mess := edtMessage.text;
|
||||
|
||||
SetLength(listTimer, Length(listTimer) + 1);
|
||||
listTimer[High(listTimer)] := NewRec;
|
||||
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListTimer>('listTimer', listTimer);
|
||||
|
||||
edtMessage.text := '';
|
||||
edtInterval.text := '10';
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnBanWordsAddClick(Sender: TObject);
|
||||
var
|
||||
NewRec: TBanWord;
|
||||
begin
|
||||
if (edtBanWords.text = '') then
|
||||
exit;
|
||||
|
||||
NewRec.regexp := edtBanWords.text;
|
||||
|
||||
SetLength(listBanWords, Length(listBanWords) + 1);
|
||||
listBanWords[High(listBanWords)] := NewRec;
|
||||
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TBanWord>('listBanWords', listBanWords);
|
||||
|
||||
edtBanWords.text := '';
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnBanWordsCheckClick(Sender: TObject);
|
||||
var
|
||||
rx: TRegExpr;
|
||||
begin
|
||||
rx := TRegExpr.Create;
|
||||
try
|
||||
rx.InputString := edtBanWordsCheck.text;
|
||||
rx.Expression := edtBanWords.text;
|
||||
if rx.Exec then
|
||||
lBanWordsCheck.text := 'åñòü áàíâîðä'
|
||||
else
|
||||
lBanWordsCheck.text := 'íåò áàíâîðäà';
|
||||
finally
|
||||
rx.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnBanWordsDelClick(Sender: TObject);
|
||||
var
|
||||
SelectedRow: Integer;
|
||||
I: Integer;
|
||||
begin
|
||||
SelectedRow := sgBanWords.Row;
|
||||
// Ïðîâåðÿåì âàëèäíîñòü âûáðàííîé ñòðîêè
|
||||
if (SelectedRow < 0) or (SelectedRow >= sgBanWords.RowCount) then
|
||||
exit;
|
||||
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for I := SelectedRow to High(listBanWords) - 1 do
|
||||
listBanWords[I] := listBanWords[I + 1];
|
||||
SetLength(listBanWords, Length(listBanWords) - 1);
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TBanWord>('listBanWords', listBanWords);
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnBanWordsEdtClick(Sender: TObject);
|
||||
var
|
||||
SelectedRow: Integer;
|
||||
NewText, oldText: string;
|
||||
I: Integer;
|
||||
myRec: TBanWord;
|
||||
begin
|
||||
SelectedRow := sgBanWords.Row;
|
||||
if (edtBanWords.text = '') or (SelectedRow <= 0) or
|
||||
(SelectedRow >= sgBanWords.RowCount) then
|
||||
exit;
|
||||
NewText := edtBanWords.text;
|
||||
oldText := sgBanWords.Cells[0, SelectedRow];
|
||||
for I := 0 to High(listBanWords) do
|
||||
if listBanWords[I].regexp = oldText then
|
||||
begin
|
||||
listBanWords[I].regexp := NewText;
|
||||
break;
|
||||
end;
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TBanWord>('listBanWords', listBanWords);
|
||||
edtBanWords.text := '';
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnCounterAddClick(Sender: TObject);
|
||||
var
|
||||
NewRec: TCounter;
|
||||
begin
|
||||
if (edtCounterName.text = '') or (edtCounterTrigger.text = '') then
|
||||
exit;
|
||||
if (edtCounterCount.text = '') then
|
||||
edtCounterCount.text := '0';
|
||||
|
||||
NewRec.counterName := edtCounterName.text;
|
||||
NewRec.trigger := edtCounterTrigger.text;
|
||||
NewRec.count := strtoint(edtCounterCount.text);
|
||||
NewRec.auto := 0;
|
||||
|
||||
SetLength(listCounters, Length(listCounters) + 1);
|
||||
listCounters[High(listCounters)] := NewRec;
|
||||
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TCounter>('listCounters', listCounters);
|
||||
|
||||
edtCounterName.text := '';
|
||||
edtCounterTrigger.text := '';
|
||||
edtCounterCount.text := '0';
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnCounterDeleteClick(Sender: TObject);
|
||||
var
|
||||
SelectedRow: Integer;
|
||||
I: Integer;
|
||||
begin
|
||||
SelectedRow := sgCounter.Row;
|
||||
// Ïðîâåðÿåì âàëèäíîñòü âûáðàííîé ñòðîêè
|
||||
if (SelectedRow < 0) or (SelectedRow >= sgCounter.RowCount) then
|
||||
exit;
|
||||
|
||||
for I := SelectedRow to High(listCounters) - 1 do
|
||||
listCounters[I] := listCounters[I + 1];
|
||||
SetLength(listCounters, Length(listCounters) - 1);
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TCounter>('listCounters', listCounters);
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnCounterEditClick(Sender: TObject);
|
||||
var
|
||||
SelectedRow: Integer;
|
||||
oldName: string;
|
||||
I: Integer;
|
||||
begin
|
||||
SelectedRow := sgCounter.Row;
|
||||
if (edtCounterName.text = '') or (edtCounterTrigger.text = '') then
|
||||
exit;
|
||||
if (edtCounterCount.text = '') then
|
||||
edtCounterCount.text := '0';
|
||||
oldName := sgCounter.Cells[0, SelectedRow];
|
||||
for I := 0 to high(listCounters) do
|
||||
if listCounters[I].counterName = oldName then
|
||||
begin
|
||||
listCounters[I].counterName := edtCounterName.text;
|
||||
listCounters[I].trigger := edtCounterTrigger.text;
|
||||
listCounters[I].count := strtoint(edtCounterCount.text);
|
||||
end;
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TCounter>('listCounters', listCounters);
|
||||
edtCounterName.text := '';
|
||||
edtCounterTrigger.text := '';
|
||||
edtCounterCount.text := '0';
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnCounterMClick(Sender: TObject);
|
||||
begin
|
||||
edtCounterCount.text := inttostr(strtoint(edtCounterCount.text) - 1);
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnCounterPClick(Sender: TObject);
|
||||
begin
|
||||
edtCounterCount.text := inttostr(strtoint(edtCounterCount.text) + 1);
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnEditMessageClick(Sender: TObject);
|
||||
var
|
||||
SelectedRow: Integer;
|
||||
NewText: string;
|
||||
NewInterval: Integer;
|
||||
|
||||
begin
|
||||
SelectedRow := sgTimers.Row;
|
||||
if (edtMessage.text = '') or (edtInterval.text = '') or (SelectedRow <= 0) or
|
||||
(SelectedRow >= sgTimers.RowCount) then
|
||||
exit;
|
||||
NewText := edtMessage.text;
|
||||
NewInterval := StrToIntDef(edtInterval.text, 0);
|
||||
|
||||
// Îáíîâëÿåì íàñòðîéêè òàéìåðà
|
||||
FTimerList[SelectedRow].Update(sgTimers.Cells[2, SelectedRow].ToInteger,
|
||||
sgTimers.Cells[1, SelectedRow], (sgTimers.Cells[3, SelectedRow] = 'True'));
|
||||
listTimer[SelectedRow].interval := NewInterval;
|
||||
listTimer[SelectedRow].mess := NewText;
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListTimer>('listTimer', listTimer);
|
||||
|
||||
edtMessage.text := '';
|
||||
edtInterval.text := '';
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnNotifyTestClick(Sender: TObject);
|
||||
var
|
||||
s: string;
|
||||
B: Boolean;
|
||||
begin
|
||||
s := sgTimers.Cells[1, sgTimers.Row];
|
||||
B := sgTimers.Cells[3, sgTimers.Row] = 'True';
|
||||
{ if B then
|
||||
ttw_API.sendNotify(s)
|
||||
else
|
||||
ttw_IRS.sendMessage(s); }
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.btnRmMessageClick(Sender: TObject);
|
||||
var
|
||||
SelectedRow: Integer;
|
||||
I: Integer;
|
||||
begin
|
||||
SelectedRow := sgTimers.Row;
|
||||
// Ïðîâåðÿåì âàëèäíîñòü âûáðàííîé ñòðîêè
|
||||
if (SelectedRow < 0) or (SelectedRow >= sgTimers.RowCount) then
|
||||
exit;
|
||||
// Ïðîâåðÿåì íàëè÷èå òàéìåðà â ñïèñêå
|
||||
if (SelectedRow < FTimerList.count) then
|
||||
begin
|
||||
// Îñòàíàâëèâàåì è óíè÷òîæàåì òàéìåð
|
||||
if Assigned(FTimerList[SelectedRow]) then
|
||||
begin
|
||||
FTimerList[SelectedRow].StopT;
|
||||
FTimerList[SelectedRow].Terminate; // Ìåòîä äëÿ îñòàíîâêè ïîòîêà
|
||||
FTimerList[SelectedRow].Free;
|
||||
FTimerList.Delete(SelectedRow); // Óäàëÿåì èç ñïèñêà ñ àâòîóíè÷òîæåíèåì
|
||||
end;
|
||||
end;
|
||||
|
||||
for I := SelectedRow to High(listTimer) - 1 do
|
||||
listTimer[I] := listTimer[I + 1];
|
||||
SetLength(listTimer, Length(listTimer) - 1);
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListTimer>('listTimer', listTimer);
|
||||
end;
|
||||
|
||||
destructor TfrAutoActions.Destroy;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if Assigned(FTimerList) then
|
||||
begin
|
||||
for i := FTimerList.Count - 1 downto 0 do
|
||||
begin
|
||||
if Assigned(FTimerList[i]) then
|
||||
begin
|
||||
FTimerList[i].StopT;
|
||||
FTimerList[i].Terminate;
|
||||
FTimerList[i].Free;
|
||||
end;
|
||||
end;
|
||||
FreeAndNil(FTimerList);
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.initTimers;
|
||||
var
|
||||
I: Integer;
|
||||
TimerThread: TMyTimerThread;
|
||||
begin
|
||||
for I := 0 to High(listTimer) do
|
||||
begin
|
||||
TimerThread := TMyTimerThread.Create(listTimer[I].interval,
|
||||
listTimer[I].mess, listTimer[I].o = 1);
|
||||
TimerThread.OnTimerExec := OnMyTimerExec;
|
||||
FTimerList.Add(TimerThread);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.OnMyTimerExec(Sender: TObject; const txt: string;
|
||||
o: Boolean);
|
||||
begin
|
||||
{ if o then
|
||||
ttw_API.sendNotify(txt)
|
||||
else
|
||||
ttw_IRS.sendMessage(txt); }
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.sgBanWordsCellClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
edtBanWords.text := sgBanWords.Cells[0, Row];
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.sgCounterCellClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
edtCounterName.text := sgCounter.Cells[0, Row];
|
||||
edtCounterTrigger.text := sgCounter.Cells[1, Row];
|
||||
edtCounterCount.text := sgCounter.Cells[2, Row];
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.sgTimersCellClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
edtMessage.text := sgTimers.Cells[1, Row];
|
||||
edtInterval.text := sgTimers.Cells[2, Row];
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.sgTimersEditingDone(Sender: TObject;
|
||||
const ACol, ARow: Integer);
|
||||
var
|
||||
NewRec: TListTimer;
|
||||
begin
|
||||
NewRec.Enable := strtoint(ifthen(sgTimers.Cells[0, ARow] = 'True', '1', '0'));
|
||||
NewRec.o := strtoint(ifthen(sgTimers.Cells[3, ARow] = 'True', '1', '0'));
|
||||
NewRec.interval := strtoint(sgTimers.Cells[2, ARow]);
|
||||
NewRec.mess := sgTimers.Cells[1, ARow];
|
||||
if ACol = 0 then // Êîëîíêà enabled
|
||||
begin
|
||||
if NewRec.Enable = 1 then
|
||||
FTimerList[ARow].StartT
|
||||
else
|
||||
FTimerList[ARow].StopT;
|
||||
end;
|
||||
if ACol = 3 then // Êîëîíêà o
|
||||
begin
|
||||
// Îáíîâëÿåì íàñòðîéêè òàéìåðà
|
||||
FTimerList[ARow].Update(NewRec.interval, NewRec.mess, (NewRec.o = 1));
|
||||
end;
|
||||
listTimer[ARow] := NewRec;
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListTimer>('listTimer', listTimer);
|
||||
end;
|
||||
|
||||
procedure TfrAutoActions.UpdateGridFromArray;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
sgTimers.BeginUpdate;
|
||||
try
|
||||
sgTimers.RowCount := 0; // Ñáðàñûâàåì ñòðîêè (îñòàâëÿåì òîëüêî çàãîëîâêè)
|
||||
|
||||
for I := 0 to High(listTimer) do
|
||||
begin
|
||||
sgTimers.RowCount := I + 1;
|
||||
sgTimers.Cells[0, I] := ifthen(listTimer[I].Enable = 1, 'True', 'False');
|
||||
sgTimers.Cells[1, I] := listTimer[I].mess;
|
||||
sgTimers.Cells[2, I] := inttostr(listTimer[I].interval);
|
||||
sgTimers.Cells[3, I] := ifthen(listTimer[I].o = 1, 'True', 'False');
|
||||
end;
|
||||
finally
|
||||
sgTimers.EndUpdate;
|
||||
end;
|
||||
sgBanWords.BeginUpdate;
|
||||
try
|
||||
sgBanWords.RowCount := 0; // Ñáðàñûâàåì ñòðîêè (îñòàâëÿåì òîëüêî çàãîëîâêè)
|
||||
|
||||
for I := 0 to High(listBanWords) do
|
||||
begin
|
||||
sgBanWords.RowCount := I + 1;
|
||||
sgBanWords.Cells[0, I] := listBanWords[I].regexp;
|
||||
end;
|
||||
finally
|
||||
sgBanWords.EndUpdate;
|
||||
end;
|
||||
sgCounter.BeginUpdate;
|
||||
try
|
||||
sgCounter.RowCount := 0; // Ñáðàñûâàåì ñòðîêè (îñòàâëÿåì òîëüêî çàãîëîâêè)
|
||||
|
||||
for I := 0 to High(listCounters) do
|
||||
begin
|
||||
sgCounter.RowCount := I + 1;
|
||||
sgCounter.Cells[0, I] := listCounters[I].counterName;
|
||||
sgCounter.Cells[1, I] := listCounters[I].trigger;
|
||||
sgCounter.Cells[2, I] := inttostr(listCounters[I].count);
|
||||
sgCounter.Cells[3, I] := ifthen(listCounters[I].auto = 1, '1', '0');
|
||||
end;
|
||||
finally
|
||||
sgCounter.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,108 @@
|
||||
object frColorSettings: TfrColorSettings
|
||||
Size.Width = 311.000000000000000000
|
||||
Size.Height = 253.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object ccbStyleBorderColor: TColorComboBox
|
||||
DropDownKind = Custom
|
||||
Color = claNull
|
||||
DisableFocusEffect = False
|
||||
ItemIndex = 147
|
||||
Position.X = 177.000000000000000000
|
||||
Position.Y = 35.000000000000000000
|
||||
Size.Width = 120.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 39
|
||||
end
|
||||
object cpStyleBlockColor: TColorPanel
|
||||
Color = claWhite
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 161.000000000000000000
|
||||
Size.Height = 150.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 6
|
||||
end
|
||||
object Label40: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 161.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1062#1074#1077#1090' '#1080' '#1087#1088#1086#1079#1088#1072#1095#1085#1086#1089#1090#1100' '#1073#1083#1086#1082#1072
|
||||
TabOrder = 7
|
||||
end
|
||||
object Label42: TLabel
|
||||
Position.X = 177.000000000000000000
|
||||
Position.Y = 10.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1062#1074#1077#1090' '#1088#1072#1084#1082#1080
|
||||
TabOrder = 37
|
||||
end
|
||||
object Label44: TLabel
|
||||
Position.X = 177.000000000000000000
|
||||
Position.Y = 120.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1054#1090#1089#1090#1091#1087#1099
|
||||
TabOrder = 41
|
||||
end
|
||||
object Label48: TLabel
|
||||
Position.X = 177.000000000000000000
|
||||
Position.Y = 65.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1058#1086#1083#1097#1080#1085#1072' '#1088#1072#1084#1082#1080
|
||||
TabOrder = 42
|
||||
end
|
||||
object sbStyleBlockBorderSize: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 44
|
||||
Cursor = crIBeam
|
||||
Value = 2.000000000000000000
|
||||
Position.X = 177.000000000000000000
|
||||
Position.Y = 90.000000000000000000
|
||||
Size.Width = 120.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object sbStyleBlockPadding: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 45
|
||||
Cursor = crIBeam
|
||||
Value = 10.000000000000000000
|
||||
Position.X = 177.000000000000000000
|
||||
Position.Y = 145.000000000000000000
|
||||
Size.Width = 120.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 191.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1062#1074#1077#1090' '#1092#1086#1085#1072
|
||||
TabOrder = 38
|
||||
end
|
||||
object ccbBColor: TColorComboBox
|
||||
DropDownKind = Custom
|
||||
Color = claLime
|
||||
DisableFocusEffect = False
|
||||
ItemIndex = 82
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 216.000000000000000000
|
||||
Size.Width = 120.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 40
|
||||
end
|
||||
object btnChangeBGColor: TButton
|
||||
Position.X = 136.000000000000000000
|
||||
Position.Y = 216.000000000000000000
|
||||
Size.Width = 145.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 43
|
||||
Text = #1055#1088#1080#1084#1077#1085#1080#1090#1100' '#1094#1074#1077#1090' '#1092#1086#1085#1072
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
unit fColorSettings;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Edit, FMX.Colors, FMX.ListBox, FMX.EditBox, FMX.SpinBox,
|
||||
FMX.Controls.Presentation;
|
||||
|
||||
type
|
||||
TfrColorSettings = class(TFrame)
|
||||
cpStyleBlockColor: TColorPanel;
|
||||
Label40: TLabel;
|
||||
Label42: TLabel;
|
||||
ccbStyleBorderColor: TColorComboBox;
|
||||
Label44: TLabel;
|
||||
sbStyleBlockPadding: TSpinBox;
|
||||
sbStyleBlockBorderSize: TSpinBox;
|
||||
Label48: TLabel;
|
||||
Label1: TLabel;
|
||||
ccbBColor: TColorComboBox;
|
||||
btnChangeBGColor: TButton;
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,346 @@
|
||||
object frCommands: TfrCommands
|
||||
Size.Width = 973.000000000000000000
|
||||
Size.Height = 705.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object sgCommands: TStringGrid
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Position.X = 5.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 540.000000000000000000
|
||||
Size.Height = 193.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 5
|
||||
RowCount = 0
|
||||
Options = [ColumnResize, ColumnMove, ColLines, RowLines, Tabs, Header, HeaderClick, AutoDisplacement]
|
||||
OnCellClick = sgCommandsCellClick
|
||||
Viewport.Width = 540.000000000000000000
|
||||
Viewport.Height = 193.000000000000000000
|
||||
object scCommand: TStringColumn
|
||||
Header = #1050#1086#1084#1072#1085#1076#1072
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 134.000000000000000000
|
||||
end
|
||||
object scResponse: TStringColumn
|
||||
Header = #1054#1090#1074#1077#1090
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 380.000000000000000000
|
||||
end
|
||||
end
|
||||
object GroupBox1: TGroupBox
|
||||
Padding.Left = 5.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 5.000000000000000000
|
||||
Padding.Bottom = 5.000000000000000000
|
||||
Position.X = 544.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 410.000000000000000000
|
||||
Size.Height = 442.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1050#1086#1085#1089#1090#1088#1091#1082#1090#1086#1088' '#1086#1090#1074#1077#1090#1072
|
||||
TabOrder = 0
|
||||
inline frContruct1: TfrContruct
|
||||
Align = Client
|
||||
Size.Width = 400.000000000000000000
|
||||
Size.Height = 417.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited mResponse: TMemo
|
||||
Viewport.Width = 392.000000000000000000
|
||||
Viewport.Height = 161.000000000000000000
|
||||
end
|
||||
inherited GroupBox7: TGroupBox
|
||||
inherited btnAddUserName: TButton
|
||||
TabOrder = 37
|
||||
end
|
||||
inherited btnGetDateFollow: TButton
|
||||
TabOrder = 38
|
||||
end
|
||||
inherited btnGetAgeAccaunt: TButton
|
||||
TabOrder = 39
|
||||
end
|
||||
inherited btnCounterAddtoText: TButton
|
||||
TabOrder = 40
|
||||
end
|
||||
inherited cbCounterName: TComboBox
|
||||
TabOrder = 41
|
||||
end
|
||||
inherited btnGPT: TButton
|
||||
TabOrder = 42
|
||||
end
|
||||
inherited btnRandomUserName: TButton
|
||||
TabOrder = 43
|
||||
end
|
||||
inherited btnGetChannelStat: TButton
|
||||
TabOrder = 44
|
||||
end
|
||||
inherited btnAIPic: TButton
|
||||
TabOrder = 45
|
||||
end
|
||||
end
|
||||
inherited btnAddCommand: TButton
|
||||
OnClick = frContruct1btnAddCommandClick
|
||||
end
|
||||
inherited btnEditCommand: TButton
|
||||
OnClick = frContruct1btnEditCommandClick
|
||||
end
|
||||
inherited btnRmCommand: TButton
|
||||
OnClick = frContruct1btnRmCommandClick
|
||||
end
|
||||
object cbTextToSpeach: TCheckBox
|
||||
Position.X = 272.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TabOrder = 47
|
||||
Text = #1054#1079#1074#1091#1095#1082#1072' '#1087#1086#1089#1083#1077' !!!'
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox9: TGroupBox
|
||||
Padding.Left = 5.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 5.000000000000000000
|
||||
Padding.Bottom = 5.000000000000000000
|
||||
Position.X = 191.000000000000000000
|
||||
Position.Y = 209.000000000000000000
|
||||
Size.Width = 354.000000000000000000
|
||||
Size.Height = 241.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1056#1072#1085#1076#1086#1084#1085#1099#1077' '#1075#1088#1091#1087#1087#1099' '#1086#1090#1074#1077#1090#1086#1074
|
||||
TabOrder = 3
|
||||
inline frGroupsRequest1: TfrGroupsRequest
|
||||
Align = Client
|
||||
Size.Width = 344.000000000000000000
|
||||
Size.Height = 216.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited lbRandomGroup: TListBox
|
||||
OnDblClick = frGroupsRequest1lbRandomGroupDblClick
|
||||
Viewport.Width = 117.000000000000000000
|
||||
Viewport.Height = 116.000000000000000000
|
||||
end
|
||||
inherited lbRandomRespons: TListBox
|
||||
Viewport.Width = 207.000000000000000000
|
||||
Viewport.Height = 116.000000000000000000
|
||||
end
|
||||
inherited btnRandomAdd: TButton
|
||||
TabOrder = 33
|
||||
end
|
||||
inherited btnRandomDel: TButton
|
||||
TabOrder = 34
|
||||
end
|
||||
inherited btnRmGroup: TButton
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited Label4: TLabel
|
||||
TabOrder = 38
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox8: TGroupBox
|
||||
Padding.Left = 5.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 5.000000000000000000
|
||||
Padding.Bottom = 5.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 209.000000000000000000
|
||||
Size.Width = 175.000000000000000000
|
||||
Size.Height = 241.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1056#1072#1085#1076#1086#1084#1085#1099#1077' '#1095#1080#1089#1083#1072
|
||||
TabOrder = 1
|
||||
object edtRandomName: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 3
|
||||
Text = 'RANDOM1'
|
||||
Position.X = 9.000000000000000000
|
||||
Position.Y = 176.000000000000000000
|
||||
Size.Width = 74.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Left = 3
|
||||
Top = 514
|
||||
end
|
||||
object edtOt: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 4
|
||||
Text = '0'
|
||||
Position.X = 82.000000000000000000
|
||||
Position.Y = 176.000000000000000000
|
||||
Size.Width = 41.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Left = 83
|
||||
Top = 514
|
||||
end
|
||||
object edtTo: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 5
|
||||
Text = '100'
|
||||
Position.X = 123.000000000000000000
|
||||
Position.Y = 176.000000000000000000
|
||||
Size.Width = 41.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Left = 130
|
||||
Top = 514
|
||||
end
|
||||
object btnRandAdd: TButton
|
||||
Position.X = 9.000000000000000000
|
||||
Position.Y = 205.000000000000000000
|
||||
TabOrder = 31
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnRandAddClick
|
||||
end
|
||||
object btnRandDel: TButton
|
||||
Position.X = 97.000000000000000000
|
||||
Position.Y = 205.000000000000000000
|
||||
Size.Width = 70.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 33
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnRandDelClick
|
||||
end
|
||||
object sgRandomInt: TStringGrid
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Position.X = 9.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
Size.Width = 157.000000000000000000
|
||||
Size.Height = 144.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 36
|
||||
RowCount = 0
|
||||
Options = [ColumnResize, ColumnMove, ColLines, RowLines, Tabs, Header, HeaderClick, AutoDisplacement]
|
||||
OnCellDblClick = sgRandomIntCellDblClick
|
||||
Viewport.Width = 157.000000000000000000
|
||||
Viewport.Height = 144.000000000000000000
|
||||
object scRIntName: TStringColumn
|
||||
Header = #1053#1072#1079#1074#1072#1085#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 70.000000000000000000
|
||||
end
|
||||
object IntegerColumn1: TIntegerColumn
|
||||
Header = #1054#1090
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 31.000000000000000000
|
||||
end
|
||||
object scRIntTo: TIntegerColumn
|
||||
Header = #1044#1086
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 31.000000000000000000
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox11: TGroupBox
|
||||
Padding.Left = 10.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 10.000000000000000000
|
||||
Padding.Bottom = 10.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 458.000000000000000000
|
||||
Size.Width = 313.000000000000000000
|
||||
Size.Height = 240.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1047#1074#1091#1082
|
||||
TabOrder = 4
|
||||
inline frsgSounds: TfrSimpleGrid
|
||||
Align = Client
|
||||
Hint = '||'
|
||||
Size.Width = 293.000000000000000000
|
||||
Size.Height = 210.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited sg: TStringGrid
|
||||
Size.Width = 293.000000000000000000
|
||||
OnCellDblClick = frsgSoundssgCellDblClick
|
||||
Viewport.Width = 293.000000000000000000
|
||||
Viewport.Height = 149.000000000000000000
|
||||
inherited sgR2: TStringColumn
|
||||
Size.Width = 170.000000000000000000
|
||||
end
|
||||
end
|
||||
inherited edtFileName: TEdit
|
||||
Size.Width = 128.000000000000000000
|
||||
end
|
||||
inherited btnOpen: TButton
|
||||
Position.X = 258.000000000000000000
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox24: TGroupBox
|
||||
Padding.Left = 10.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 10.000000000000000000
|
||||
Padding.Bottom = 10.000000000000000000
|
||||
Position.X = 329.000000000000000000
|
||||
Position.Y = 458.000000000000000000
|
||||
Size.Width = 313.000000000000000000
|
||||
Size.Height = 241.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1060#1072#1081#1083#1099
|
||||
TabOrder = 2
|
||||
inline frsgFiles: TfrSimpleGrid
|
||||
Align = Client
|
||||
Hint = '|('
|
||||
Size.Width = 293.000000000000000000
|
||||
Size.Height = 211.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited sg: TStringGrid
|
||||
Size.Width = 293.000000000000000000
|
||||
OnCellDblClick = frsgFilessgCellDblClick
|
||||
Viewport.Width = 293.000000000000000000
|
||||
Viewport.Height = 149.000000000000000000
|
||||
inherited sgR2: TStringColumn
|
||||
Size.Width = 170.000000000000000000
|
||||
end
|
||||
end
|
||||
inherited edtFileName: TEdit
|
||||
Size.Width = 128.000000000000000000
|
||||
end
|
||||
inherited btnOpen: TButton
|
||||
Position.X = 258.000000000000000000
|
||||
end
|
||||
end
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Left = 744
|
||||
Top = 392
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
Padding.Left = 10.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 10.000000000000000000
|
||||
Padding.Bottom = 10.000000000000000000
|
||||
Position.X = 650.000000000000000000
|
||||
Position.Y = 458.000000000000000000
|
||||
Size.Width = 313.000000000000000000
|
||||
Size.Height = 240.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1053#1077#1081#1088#1086#1082#1086#1085#1089#1090#1088#1091#1082#1090#1086#1088
|
||||
TabOrder = 8
|
||||
inline frsgNeiro: TfrSimpleGrid
|
||||
Align = Client
|
||||
Hint = '<|'
|
||||
Size.Width = 293.000000000000000000
|
||||
Size.Height = 210.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited sg: TStringGrid
|
||||
Size.Width = 293.000000000000000000
|
||||
OnCellDblClick = frsgNeirosgCellDblClick
|
||||
Viewport.Width = 293.000000000000000000
|
||||
Viewport.Height = 149.000000000000000000
|
||||
inherited sgR2: TStringColumn
|
||||
Header = #1047#1072#1087#1088#1086#1089
|
||||
Size.Width = 170.000000000000000000
|
||||
end
|
||||
end
|
||||
inherited edtFileName: TEdit
|
||||
Size.Width = 163.000000000000000000
|
||||
end
|
||||
inherited btnOpen: TButton
|
||||
Position.X = 258.000000000000000000
|
||||
Visible = False
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,261 @@
|
||||
unit fCommands;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
System.Rtti, FMX.Grid.Style, FMX.Memo.Types, FMX.Grid, FMX.Layouts, uRecords,
|
||||
FMX.ListBox, FMX.Memo, FMX.Edit, FMX.Controls.Presentation, FMX.ScrollBox,
|
||||
fSimpleGrid, fContruct, fGroupsRequest;
|
||||
|
||||
type
|
||||
TfrCommands = class(TFrame)
|
||||
sgCommands: TStringGrid;
|
||||
scCommand: TStringColumn;
|
||||
scResponse: TStringColumn;
|
||||
GroupBox1: TGroupBox;
|
||||
GroupBox9: TGroupBox;
|
||||
GroupBox8: TGroupBox;
|
||||
edtRandomName: TEdit;
|
||||
edtOt: TEdit;
|
||||
edtTo: TEdit;
|
||||
btnRandAdd: TButton;
|
||||
btnRandDel: TButton;
|
||||
sgRandomInt: TStringGrid;
|
||||
scRIntName: TStringColumn;
|
||||
IntegerColumn1: TIntegerColumn;
|
||||
scRIntTo: TIntegerColumn;
|
||||
GroupBox11: TGroupBox;
|
||||
GroupBox24: TGroupBox;
|
||||
OpenDialog1: TOpenDialog;
|
||||
GroupBox2: TGroupBox;
|
||||
frsgSounds: TfrSimpleGrid;
|
||||
frsgFiles: TfrSimpleGrid;
|
||||
frsgNeiro: TfrSimpleGrid;
|
||||
frContruct1: TfrContruct;
|
||||
frGroupsRequest1: TfrGroupsRequest;
|
||||
cbTextToSpeach: TCheckBox;
|
||||
procedure btnRandAddClick(Sender: TObject);
|
||||
procedure btnRandDelClick(Sender: TObject);
|
||||
procedure frsgSoundsbtnSoundDelClick(Sender: TObject);
|
||||
procedure frsgSoundssgCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
procedure frsgFilessgCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
procedure frsgNeirosgCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
procedure frContruct1btnAddCommandClick(Sender: TObject);
|
||||
procedure frContruct1btnEditCommandClick(Sender: TObject);
|
||||
procedure frContruct1btnRmCommandClick(Sender: TObject);
|
||||
procedure sgCommandsCellClick(const Column: TColumn; const Row: Integer);
|
||||
procedure sgRandomIntCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
procedure frGroupsRequest1lbRandomGroupDblClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
RandomCounters: TArray<TRandomCounters>;
|
||||
listSounds: TArray<TListCommands>;
|
||||
listFiles: TArray<TListCommands>;
|
||||
listNeiro: TArray<TListCommands>;
|
||||
listCommands: TArray<TListCommands>;
|
||||
|
||||
procedure UpdateGridFromArray;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
procedure TfrCommands.btnRandDelClick(Sender: TObject);
|
||||
var
|
||||
i, RowIndex: Integer;
|
||||
begin
|
||||
RowIndex := sgRandomInt.Row;
|
||||
if (RowIndex < 0) or (RowIndex > High(RandomCounters)) then
|
||||
Exit;
|
||||
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for i := RowIndex to High(RandomCounters) - 1 do
|
||||
RandomCounters[i] := RandomCounters[i + 1];
|
||||
SetLength(RandomCounters, Length(RandomCounters) - 1);
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TRandomCounters>('RandomCounters', RandomCounters);
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frContruct1btnAddCommandClick(Sender: TObject);
|
||||
var
|
||||
sCommand: string;
|
||||
NewRec: TListCommands;
|
||||
begin
|
||||
sCommand := frContruct1.edtCommand.text;
|
||||
if (sCommand = '') or (sCommand = '!') or (frContruct1.mResponse.text = '') then
|
||||
exit;
|
||||
if (sCommand <> '') and (sCommand[1] = '!') then
|
||||
begin
|
||||
Delete(sCommand, 1, 1);
|
||||
end;
|
||||
|
||||
NewRec.R1 := sCommand;
|
||||
NewRec.R2 := frContruct1.mResponse.text;
|
||||
SetLength(listCommands, Length(listCommands) + 1);
|
||||
listCommands[High(listCommands)] := NewRec;
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListCommands>('listCommands', listCommands);
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frContruct1btnEditCommandClick(Sender: TObject);
|
||||
var RowIndex: integer; sCommand:string;
|
||||
begin
|
||||
RowIndex := sgCommands.Row;
|
||||
|
||||
sCommand := frContruct1.edtCommand.text;
|
||||
if (sCommand = '') or (sCommand = '!') or (frContruct1.mResponse.text = '') then
|
||||
exit;
|
||||
if (sCommand <> '') and (sCommand[1] = '!') then
|
||||
begin
|
||||
Delete(sCommand, 1, 1);
|
||||
end;
|
||||
|
||||
if (RowIndex < 0) or (RowIndex > High(listCommands)) then
|
||||
exit;
|
||||
listCommands[RowIndex].R1 := sCommand;
|
||||
listCommands[RowIndex].R2 := frContruct1.mResponse.text;
|
||||
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListCommands>('listCommands', listCommands);
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frContruct1btnRmCommandClick(Sender: TObject);
|
||||
var
|
||||
i, RowIndex: Integer;
|
||||
begin
|
||||
RowIndex := sgCommands.Row;
|
||||
if (RowIndex < 0) or (RowIndex > High(listCommands)) then
|
||||
exit;
|
||||
for i := RowIndex to High(listCommands) - 1 do
|
||||
listCommands[i] := listCommands[i + 1];
|
||||
SetLength(listCommands, Length(listCommands) - 1);
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListCommands>('listCommands', listCommands);
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frGroupsRequest1lbRandomGroupDblClick(Sender: TObject);
|
||||
begin
|
||||
frContruct1.mResponse.Lines.text := frContruct1.mResponse.Lines.text + ' {{' + frGroupsRequest1.lbRandomGroup.Items
|
||||
[frGroupsRequest1.lbRandomGroup.ItemIndex] + '}}';
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frsgFilessgCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
frContruct1.mResponse.Lines.text := frContruct1.mResponse.Lines.text + ' ' +
|
||||
frsgFiles.Hint + frsgFiles.sg.Cells[0, Row] + frsgFiles.Hint;
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frsgNeirosgCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
frContruct1.mResponse.Lines.text := frContruct1.mResponse.Lines.text + ' ' +
|
||||
frsgNeiro.Hint + frsgNeiro.sg.Cells[0, Row] + frsgNeiro.Hint;
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frsgSoundsbtnSoundDelClick(Sender: TObject);
|
||||
var
|
||||
i, RowIndex: Integer;
|
||||
begin
|
||||
RowIndex := frsgSounds.sg.Row;
|
||||
if (RowIndex < 0) or (RowIndex > High(listSounds)) then
|
||||
Exit;
|
||||
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for i := RowIndex to High(listSounds) - 1 do
|
||||
listSounds[i] := listSounds[i + 1];
|
||||
|
||||
SetLength(listSounds, Length(listSounds) - 1);
|
||||
|
||||
UpdateGridFromArray;
|
||||
DB.SaveRecordArray<TListCommands>('listSounds', listSounds);
|
||||
end;
|
||||
|
||||
procedure TfrCommands.frsgSoundssgCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
frContruct1.mResponse.Lines.text := frContruct1.mResponse.Lines.text + ' ' +
|
||||
frsgSounds.Hint + frsgSounds.sg.Cells[0, Row] + frsgSounds.Hint;
|
||||
end;
|
||||
|
||||
procedure TfrCommands.sgCommandsCellClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
frContruct1.edtCommand.text := sgCommands.Cells[0, Row];
|
||||
frContruct1.mResponse.text := sgCommands.Cells[1, Row];
|
||||
end;
|
||||
|
||||
procedure TfrCommands.sgRandomIntCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
frContruct1.mResponse.Lines.text := frContruct1.mResponse.Lines.text + ' [[' + sgRandomInt.Cells
|
||||
[0, Row] + ']]';
|
||||
end;
|
||||
|
||||
procedure TfrCommands.UpdateGridFromArray;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
sgRandomInt.BeginUpdate;
|
||||
try
|
||||
sgRandomInt.RowCount := 0; // Ñáðàñûâàåì ñòðîêè (îñòàâëÿåì òîëüêî çàãîëîâêè)
|
||||
|
||||
for i := 0 to High(RandomCounters) do
|
||||
begin
|
||||
sgRandomInt.RowCount := i +1;
|
||||
sgRandomInt.Cells[0, i] := RandomCounters[i].rndName;
|
||||
sgRandomInt.Cells[1, i] := IntToStr(RandomCounters[i].Ot);
|
||||
sgRandomInt.Cells[2, i] := IntToStr(RandomCounters[i].ToValue);
|
||||
end;
|
||||
finally
|
||||
sgRandomInt.EndUpdate;
|
||||
end;
|
||||
sgCommands.BeginUpdate;
|
||||
try
|
||||
sgCommands.RowCount := 0; // Ñáðàñûâàåì ñòðîêè (îñòàâëÿåì òîëüêî çàãîëîâêè)
|
||||
|
||||
for i := 0 to High(listCommands) do
|
||||
begin
|
||||
sgCommands.RowCount := i+1 ;
|
||||
sgCommands.Cells[0, i] := listCommands[i].R1;
|
||||
sgCommands.Cells[1, i] := listCommands[i].R2; //9067254178
|
||||
end;
|
||||
finally
|
||||
sgCommands.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrCommands.btnRandAddClick(Sender: TObject);
|
||||
var
|
||||
NewRec: TRandomCounters;
|
||||
begin
|
||||
NewRec.rndName := edtRandomName.text;
|
||||
NewRec.Ot := StrToIntDef(edtOt.text, 0);
|
||||
NewRec.ToValue := StrToIntDef(edtTo.text, 100);
|
||||
|
||||
SetLength(RandomCounters, Length(RandomCounters) + 1);
|
||||
RandomCounters[High(RandomCounters)] := NewRec;
|
||||
|
||||
UpdateGridFromArray;
|
||||
// DB.SaveGridToTable('sgRandomInt', sgRandomInt);
|
||||
DB.SaveRecordArray<TRandomCounters>('RandomCounters', RandomCounters);
|
||||
edtRandomName.text := '';
|
||||
edtOt.text := '0';
|
||||
edtTo.text := '100';
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,167 @@
|
||||
object frContruct: TfrContruct
|
||||
Size.Width = 406.000000000000000000
|
||||
Size.Height = 417.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object Label12: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1050#1086#1084#1072#1085#1076#1072
|
||||
TabOrder = 38
|
||||
end
|
||||
object edtCommand: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 39
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 208.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object mResponse: TMemo
|
||||
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
|
||||
DataDetectorTypes = []
|
||||
TextSettings.WordWrap = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 392.000000000000000000
|
||||
Size.Height = 161.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 40
|
||||
Viewport.Width = 388.000000000000000000
|
||||
Viewport.Height = 157.000000000000000000
|
||||
end
|
||||
object Label14: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1054#1090#1074#1077#1090
|
||||
TabOrder = 41
|
||||
end
|
||||
object GroupBox7: TGroupBox
|
||||
Padding.Left = 5.000000000000000000
|
||||
Padding.Top = 20.000000000000000000
|
||||
Padding.Right = 5.000000000000000000
|
||||
Padding.Bottom = 5.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 257.000000000000000000
|
||||
Size.Width = 392.000000000000000000
|
||||
Size.Height = 120.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1042#1089#1090#1072#1074#1082#1080
|
||||
TabOrder = 42
|
||||
object btnAddUserName: TButton
|
||||
Position.X = 9.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
Size.Width = 94.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 38
|
||||
Text = #1054#1073#1088#1072#1097#1077#1085#1080#1077
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnAddUserNameClick
|
||||
end
|
||||
object btnGetDateFollow: TButton
|
||||
Position.X = 111.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
TabOrder = 39
|
||||
Text = 'Follow'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnGetDateFollowClick
|
||||
end
|
||||
object btnGetAgeAccaunt: TButton
|
||||
Position.X = 199.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
TabOrder = 40
|
||||
Text = 'Age'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnGetAgeAccauntClick
|
||||
end
|
||||
object btnCounterAddtoText: TButton
|
||||
Position.X = 9.000000000000000000
|
||||
Position.Y = 54.000000000000000000
|
||||
Size.Width = 94.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 41
|
||||
Text = #1057#1095#1077#1090#1095#1080#1082
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object cbCounterName: TComboBox
|
||||
Position.X = 111.000000000000000000
|
||||
Position.Y = 54.000000000000000000
|
||||
Size.Width = 168.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 42
|
||||
end
|
||||
object btnGPT: TButton
|
||||
Position.X = 287.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
TabOrder = 43
|
||||
Text = #1053#1077#1081#1088#1086#1085#1082#1072
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnGPTClick
|
||||
end
|
||||
object btnRandomUserName: TButton
|
||||
Position.X = 9.000000000000000000
|
||||
Position.Y = 84.000000000000000000
|
||||
Size.Width = 168.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 44
|
||||
Text = #1056#1072#1085#1076#1086#1084#1085#1099#1081' '#1087#1086#1083#1100#1079#1086#1074#1072#1090#1077#1083#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnRandomUserNameClick
|
||||
end
|
||||
object btnGetChannelStat: TButton
|
||||
Position.X = 185.000000000000000000
|
||||
Position.Y = 84.000000000000000000
|
||||
Size.Width = 122.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 45
|
||||
Text = #1057#1090#1072#1090#1080#1089#1090#1080#1082#1072' '#1082#1072#1085#1072#1083#1072
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnGetChannelStatClick
|
||||
end
|
||||
object btnAIPic: TButton
|
||||
Position.X = 287.000000000000000000
|
||||
Position.Y = 54.000000000000000000
|
||||
TabOrder = 46
|
||||
Text = #1050#1072#1088#1090#1080#1085#1082#1072
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnAIPicClick
|
||||
end
|
||||
end
|
||||
object btnAddCommand: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 385.000000000000000000
|
||||
TabOrder = 43
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnEditCommand: TButton
|
||||
Position.X = 96.000000000000000000
|
||||
Position.Y = 385.000000000000000000
|
||||
TabOrder = 44
|
||||
Text = #1048#1079#1084#1077#1085#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnRmCommand: TButton
|
||||
Position.X = 184.000000000000000000
|
||||
Position.Y = 385.000000000000000000
|
||||
TabOrder = 45
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object cbTextToSpeech: TCheckBox
|
||||
Position.X = 167.000000000000000000
|
||||
Size.Width = 217.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 46
|
||||
Text = #1054#1079#1074#1091#1095#1080#1074#1072#1090#1100' '#1089#1086#1086#1073#1097#1077#1085#1080#1103' '#1087#1086#1089#1083#1077' "!!!"'
|
||||
Visible = False
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,83 @@
|
||||
unit fContruct;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Memo.Types, FMX.ListBox, FMX.ScrollBox, FMX.Memo, FMX.Edit,
|
||||
FMX.Controls.Presentation;
|
||||
|
||||
type
|
||||
TfrContruct = class(TFrame)
|
||||
Label12: TLabel;
|
||||
edtCommand: TEdit;
|
||||
mResponse: TMemo;
|
||||
Label14: TLabel;
|
||||
GroupBox7: TGroupBox;
|
||||
btnAddUserName: TButton;
|
||||
btnGetDateFollow: TButton;
|
||||
btnGetAgeAccaunt: TButton;
|
||||
btnCounterAddtoText: TButton;
|
||||
cbCounterName: TComboBox;
|
||||
btnGPT: TButton;
|
||||
btnRandomUserName: TButton;
|
||||
btnGetChannelStat: TButton;
|
||||
btnAIPic: TButton;
|
||||
btnAddCommand: TButton;
|
||||
btnEditCommand: TButton;
|
||||
btnRmCommand: TButton;
|
||||
cbTextToSpeech: TCheckBox;
|
||||
procedure btnAddUserNameClick(Sender: TObject);
|
||||
procedure btnGetDateFollowClick(Sender: TObject);
|
||||
procedure btnGetAgeAccauntClick(Sender: TObject);
|
||||
procedure btnGetChannelStatClick(Sender: TObject);
|
||||
procedure btnGPTClick(Sender: TObject);
|
||||
procedure btnAIPicClick(Sender: TObject);
|
||||
procedure btnRandomUserNameClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
procedure TfrContruct.btnAddUserNameClick(Sender: TObject);
|
||||
begin
|
||||
mResponse.Lines.text := mResponse.Lines.text + '[USERNAME]';
|
||||
end;
|
||||
|
||||
procedure TfrContruct.btnAIPicClick(Sender: TObject);
|
||||
begin
|
||||
mResponse.Lines.text := mResponse.Lines.text + ' [Kandinsky]';
|
||||
end;
|
||||
|
||||
procedure TfrContruct.btnGetAgeAccauntClick(Sender: TObject);
|
||||
begin
|
||||
mResponse.Lines.text := mResponse.Lines.text + ' [AGE]';
|
||||
end;
|
||||
|
||||
procedure TfrContruct.btnGetChannelStatClick(Sender: TObject);
|
||||
begin
|
||||
mResponse.Lines.text := mResponse.Lines.text + ' [STAT]';
|
||||
end;
|
||||
|
||||
procedure TfrContruct.btnGetDateFollowClick(Sender: TObject);
|
||||
begin
|
||||
mResponse.Lines.text := mResponse.Lines.text + ' [FOLLOW]';
|
||||
end;
|
||||
|
||||
procedure TfrContruct.btnGPTClick(Sender: TObject);
|
||||
begin
|
||||
mResponse.Lines.text := mResponse.Lines.text + ' [AI]';
|
||||
end;
|
||||
|
||||
procedure TfrContruct.btnRandomUserNameClick(Sender: TObject);
|
||||
begin
|
||||
mResponse.Lines.text := mResponse.Lines.text + ' [RANDOMUSER]';
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,100 @@
|
||||
object frFontSettings: TfrFontSettings
|
||||
Size.Width = 249.000000000000000000
|
||||
Size.Height = 125.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object Label41: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
Size.Width = 100.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1056#1072#1079#1084#1077#1088' '#1096#1088#1080#1092#1090#1072
|
||||
TabOrder = 7
|
||||
end
|
||||
object sbFontSize: TSpinBox
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 1
|
||||
Cursor = crIBeam
|
||||
Value = 14.000000000000000000
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
end
|
||||
object ccbFontColor: TColorComboBox
|
||||
DropDownKind = Custom
|
||||
Color = claNull
|
||||
DisableFocusEffect = False
|
||||
ItemIndex = 147
|
||||
Position.X = 116.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 120.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 37
|
||||
end
|
||||
object Label49: TLabel
|
||||
Position.X = 116.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1062#1074#1077#1090' '#1096#1088#1080#1092#1090#1072
|
||||
TabOrder = 36
|
||||
end
|
||||
object cbFontStyleDefault: TComboBox
|
||||
Items.Strings = (
|
||||
'Arial'
|
||||
'Arial Cyr'
|
||||
'Arial Black'
|
||||
'Book antiqua'
|
||||
'Bookman old style'
|
||||
'Calibri'
|
||||
'Cambria'
|
||||
'Candara'
|
||||
'Century'
|
||||
'Century gothic'
|
||||
'Comic Sans Ms'
|
||||
'Consolas'
|
||||
'Constantia'
|
||||
'Corbel'
|
||||
'Courier'
|
||||
'Courier New'
|
||||
'Courier, monospace'
|
||||
'Cursive'
|
||||
'Franklin Gothic'
|
||||
'Gabriola'
|
||||
'Garamond'
|
||||
'Georgia'
|
||||
'Helvetica'
|
||||
'Impact'
|
||||
'Lucida console'
|
||||
'Lucida Sans Unicode'
|
||||
'Mistral (Mistral)'
|
||||
'monospace'
|
||||
'Monotype Corsiva'
|
||||
'MS Sans Serif'
|
||||
'MS Serif'
|
||||
'Palatino Linotype'
|
||||
'Roboto'
|
||||
'Sans-serif'
|
||||
'Segoe print'
|
||||
'Segoe script'
|
||||
'Sylfaen'
|
||||
'Tahoma'
|
||||
'Times New Roman'
|
||||
'Trebuchet ms'
|
||||
'Verdana')
|
||||
ItemIndex = 0
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 228.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 0
|
||||
end
|
||||
object Label46: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1057#1090#1080#1083#1100
|
||||
TabOrder = 40
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
unit fFontSettings;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.ListBox, FMX.Colors, FMX.Edit, FMX.EditBox, FMX.SpinBox,
|
||||
FMX.Controls.Presentation;
|
||||
|
||||
type
|
||||
TfrFontSettings = class(TFrame)
|
||||
Label41: TLabel;
|
||||
sbFontSize: TSpinBox;
|
||||
ccbFontColor: TColorComboBox;
|
||||
Label49: TLabel;
|
||||
cbFontStyleDefault: TComboBox;
|
||||
Label46: TLabel;
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,112 @@
|
||||
object frGroupsRequest: TfrGroupsRequest
|
||||
Align = Client
|
||||
Size.Width = 351.000000000000000000
|
||||
Size.Height = 219.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object lbRandomGroup: TListBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 121.000000000000000000
|
||||
Size.Height = 120.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 11
|
||||
DisableFocusEffect = True
|
||||
ItemHeight = 13.000000000000000000
|
||||
DefaultItemStyles.ItemStyle = ''
|
||||
DefaultItemStyles.GroupHeaderStyle = ''
|
||||
DefaultItemStyles.GroupFooterStyle = ''
|
||||
OnChange = lbRandomGroupChange
|
||||
Left = 208
|
||||
Top = 315
|
||||
Viewport.Width = 117.000000000000000000
|
||||
Viewport.Height = 116.000000000000000000
|
||||
end
|
||||
object lbRandomRespons: TListBox
|
||||
Position.X = 126.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 211.000000000000000000
|
||||
Size.Height = 120.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 13
|
||||
OnClick = lbRandomResponsClick
|
||||
DisableFocusEffect = True
|
||||
ItemHeight = 13.000000000000000000
|
||||
DefaultItemStyles.ItemStyle = ''
|
||||
DefaultItemStyles.GroupHeaderStyle = ''
|
||||
DefaultItemStyles.GroupFooterStyle = ''
|
||||
Left = 335
|
||||
Top = 315
|
||||
Viewport.Width = 207.000000000000000000
|
||||
Viewport.Height = 116.000000000000000000
|
||||
end
|
||||
object edtRandomGroup: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 12
|
||||
Text = 'GRP1'
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 161.000000000000000000
|
||||
Size.Width = 121.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Left = 208
|
||||
Top = 514
|
||||
end
|
||||
object edtRandomRespons: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 14
|
||||
Position.X = 126.000000000000000000
|
||||
Position.Y = 161.000000000000000000
|
||||
Size.Width = 211.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Left = 335
|
||||
Top = 514
|
||||
end
|
||||
object btnRandomAdd: TButton
|
||||
Position.X = 7.000000000000000000
|
||||
Position.Y = 190.000000000000000000
|
||||
TabOrder = 38
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnRandomAddClick
|
||||
end
|
||||
object btnRandomDel: TButton
|
||||
Position.X = 96.000000000000000000
|
||||
Position.Y = 190.000000000000000000
|
||||
Size.Width = 70.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 39
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnRandomDelClick
|
||||
end
|
||||
object btnRmGroup: TButton
|
||||
Position.X = 205.000000000000000000
|
||||
Position.Y = 190.000000000000000000
|
||||
Size.Width = 138.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 40
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100' '#1074#1089#1102' '#1075#1088#1091#1087#1087#1091
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnRmGroupClick
|
||||
end
|
||||
object Label4: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 110.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1043#1088#1091#1087#1087#1072
|
||||
TabOrder = 41
|
||||
end
|
||||
object Label5: TLabel
|
||||
Position.X = 126.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = #1042#1072#1088#1080#1072#1085#1090#1099' '#1086#1090#1074#1077#1090#1072
|
||||
TabOrder = 44
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,87 @@
|
||||
unit fGroupsRequest;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Controls.Presentation, FMX.Edit, FMX.Layouts, FMX.ListBox;
|
||||
|
||||
type
|
||||
TfrGroupsRequest = class(TFrame)
|
||||
lbRandomGroup: TListBox;
|
||||
lbRandomRespons: TListBox;
|
||||
edtRandomGroup: TEdit;
|
||||
edtRandomRespons: TEdit;
|
||||
btnRandomAdd: TButton;
|
||||
btnRandomDel: TButton;
|
||||
btnRmGroup: TButton;
|
||||
Label4: TLabel;
|
||||
Label5: TLabel;
|
||||
procedure btnRandomAddClick(Sender: TObject);
|
||||
procedure btnRandomDelClick(Sender: TObject);
|
||||
procedure btnRmGroupClick(Sender: TObject);
|
||||
procedure lbRandomGroupChange(Sender: TObject);
|
||||
procedure lbRandomResponsClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses ugeneral;
|
||||
|
||||
procedure TfrGroupsRequest.btnRandomAddClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i := lbRandomGroup.ItemIndex;
|
||||
DB.addGroupResponse(edtRandomGroup.text, edtRandomRespons.text);
|
||||
DB.getGroupName(lbRandomGroup.Items);
|
||||
if i <> -1 then
|
||||
begin
|
||||
DB.getGroupResponse(lbRandomGroup.Items[i], lbRandomRespons.Items);
|
||||
lbRandomGroup.ItemIndex := i;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrGroupsRequest.btnRandomDelClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i := lbRandomGroup.ItemIndex;
|
||||
if (edtRandomGroup.text = '') or (edtRandomRespons.text = '') then
|
||||
exit;
|
||||
DB.delGroupResponse(edtRandomGroup.text, edtRandomRespons.text);
|
||||
DB.getGroupResponse(lbRandomGroup.Items[i], lbRandomRespons.Items);
|
||||
lbRandomGroup.ItemIndex := i;
|
||||
end;
|
||||
|
||||
procedure TfrGroupsRequest.btnRmGroupClick(Sender: TObject);
|
||||
begin
|
||||
if lbRandomGroup.ItemIndex = -1 then
|
||||
exit;
|
||||
DB.delGroupName(lbRandomGroup.Items[lbRandomGroup.ItemIndex]);
|
||||
DB.getGroupName(lbRandomGroup.Items);
|
||||
lbRandomRespons.Items.Clear;
|
||||
end;
|
||||
|
||||
procedure TfrGroupsRequest.lbRandomGroupChange(Sender: TObject);
|
||||
begin
|
||||
DB.getGroupResponse(lbRandomGroup.Items[lbRandomGroup.ItemIndex],
|
||||
lbRandomRespons.Items);
|
||||
end;
|
||||
|
||||
procedure TfrGroupsRequest.lbRandomResponsClick(Sender: TObject);
|
||||
begin
|
||||
if (lbRandomGroup.ItemIndex = -1) or (lbRandomRespons.ItemIndex = -1) then
|
||||
exit;
|
||||
edtRandomGroup.text := lbRandomGroup.Items[lbRandomGroup.ItemIndex];
|
||||
edtRandomRespons.text := lbRandomRespons.Items[lbRandomRespons.ItemIndex];
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,92 @@
|
||||
object frLog: TfrLog
|
||||
Size.Width = 800.000000000000000000
|
||||
Size.Height = 535.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object Panel1: TPanel
|
||||
Align = Top
|
||||
Size.Width = 800.000000000000000000
|
||||
Size.Height = 33.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 0
|
||||
object btnClear: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TabOrder = 0
|
||||
Text = #1054#1095#1080#1089#1090#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnClearClick
|
||||
end
|
||||
object chkWARNING: TCheckBox
|
||||
Position.X = 160.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 121.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
Text = #1055#1088#1077#1076#1091#1087#1088#1077#1078#1076#1077#1085#1080#1103
|
||||
OnChange = chkWARNINGChange
|
||||
end
|
||||
object chkERROR: TCheckBox
|
||||
Position.X = 289.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 72.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 2
|
||||
Text = #1054#1096#1080#1073#1082#1080
|
||||
OnChange = chkWARNINGChange
|
||||
end
|
||||
object chkDEBUG: TCheckBox
|
||||
Position.X = 369.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TabOrder = 3
|
||||
Text = #1054#1090#1083#1072#1076#1082#1072
|
||||
OnChange = chkWARNINGChange
|
||||
end
|
||||
object chkINFO: TCheckBox
|
||||
Position.X = 96.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 56.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1048#1085#1092#1086
|
||||
OnChange = chkWARNINGChange
|
||||
end
|
||||
end
|
||||
object sgLog: TStringGrid
|
||||
Align = Client
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Size.Width = 800.000000000000000000
|
||||
Size.Height = 502.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
RowCount = 0
|
||||
Viewport.Width = 800.000000000000000000
|
||||
Viewport.Height = 502.000000000000000000
|
||||
object StringColumn5: TStringColumn
|
||||
Header = #1044#1072#1090#1072
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
object StringColumn1: TStringColumn
|
||||
Header = #1058#1080#1087
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
object StringColumn2: TStringColumn
|
||||
Header = #1052#1086#1076#1091#1083#1100
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 170.000000000000000000
|
||||
end
|
||||
object StringColumn3: TStringColumn
|
||||
Header = #1052#1077#1090#1086#1076
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 170.000000000000000000
|
||||
end
|
||||
object StringColumn4: TStringColumn
|
||||
Header = #1057#1086#1086#1073#1097#1077#1085#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 497.000000000000000000
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,94 @@
|
||||
unit fLog;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
System.Rtti, FMX.Grid.Style, System.Generics.Collections, FMX.Grid,
|
||||
FMX.ScrollBox,
|
||||
FMX.Controls.Presentation, uRecords;
|
||||
|
||||
type
|
||||
TfrLog = class(TFrame)
|
||||
Panel1: TPanel;
|
||||
btnClear: TButton;
|
||||
chkWARNING: TCheckBox;
|
||||
chkERROR: TCheckBox;
|
||||
chkDEBUG: TCheckBox;
|
||||
chkINFO: TCheckBox;
|
||||
sgLog: TStringGrid;
|
||||
StringColumn5: TStringColumn;
|
||||
StringColumn1: TStringColumn;
|
||||
StringColumn2: TStringColumn;
|
||||
StringColumn3: TStringColumn;
|
||||
StringColumn4: TStringColumn;
|
||||
procedure btnClearClick(Sender: TObject);
|
||||
procedure chkWARNINGChange(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
FLogList: TList<TRLog>;
|
||||
destructor Destroy; override;
|
||||
procedure UpdateGridFilters;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
{ TfrLog }
|
||||
|
||||
procedure TfrLog.chkWARNINGChange(Sender: TObject);
|
||||
begin
|
||||
UpdateGridFilters;
|
||||
end;
|
||||
|
||||
destructor TfrLog.Destroy;
|
||||
begin
|
||||
FLogList.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TfrLog.btnClearClick(Sender: TObject);
|
||||
begin
|
||||
FLogList.Clear;
|
||||
UpdateGridFilters;
|
||||
end;
|
||||
|
||||
procedure TfrLog.UpdateGridFilters;
|
||||
var
|
||||
ml: TRLog;
|
||||
NewRow: integer;
|
||||
begin
|
||||
sgLog.BeginUpdate;
|
||||
try
|
||||
sgLog.RowCount := 0;
|
||||
// Ïðîâåðêà íàëè÷èÿ âñåõ êîëîíîê
|
||||
if sgLog.ColumnCount < 5 then
|
||||
raise Exception.Create('Ãðèä äîëæåí ñîäåðæàòü 5 êîëîíîê.');
|
||||
for ml in FLogList do
|
||||
begin
|
||||
// Ïðîâåðêà ôèëüòðà
|
||||
if ((ml.rType = 'WARNING') and chkWARNING.IsChecked) or
|
||||
((ml.rType = 'ERROR') and chkERROR.IsChecked) or
|
||||
((ml.rType = 'DEBUG') and chkDEBUG.IsChecked) or
|
||||
((ml.rType = 'INFO') and chkINFO.IsChecked) then
|
||||
begin
|
||||
sgLog.RowCount := sgLog.RowCount + 1;
|
||||
NewRow := sgLog.RowCount - 1;
|
||||
// Çàïîëíåíèå äàííûõ ñ ïðîâåðêîé êîëîíîê
|
||||
sgLog.Cells[0, NewRow] := TimeToStr(ml.rTime); // Êîëîíêà 0
|
||||
sgLog.Cells[1, NewRow] := ml.rType; // Êîëîíêà 1
|
||||
sgLog.Cells[2, NewRow] := ml.rModule; // Êîëîíêà 2
|
||||
sgLog.Cells[3, NewRow] := ml.rMethod; // Êîëîíêà 3
|
||||
sgLog.Cells[4, NewRow] := ml.rMessage; // Êîëîíêà 4
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
sgLog.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,260 @@
|
||||
object frNotify: TfrNotify
|
||||
Size.Width = 919.000000000000000000
|
||||
Size.Height = 135.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object chEnNotify: TSwitch
|
||||
IsChecked = False
|
||||
Position.X = 13.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 49.000000000000000000
|
||||
Size.Height = 20.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label43: TLabel
|
||||
Position.X = 70.000000000000000000
|
||||
Position.Y = 10.000000000000000000
|
||||
Size.Width = 220.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1059#1074#1077#1076#1086#1084#1083#1103#1090#1100' '#1086' '#1089#1086#1086#1073#1097#1077#1085#1080#1103#1093' '#1086#1090' '#1074#1089#1077#1093
|
||||
TabOrder = 4
|
||||
end
|
||||
object tbNotifyVolume: TTrackBar
|
||||
CanParentFocus = True
|
||||
Orientation = Horizontal
|
||||
Position.X = 320.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TabOrder = 5
|
||||
Value = 100.000000000000000000
|
||||
end
|
||||
object edtNotifyFileName: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 6
|
||||
Position.X = 428.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 156.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnNotifyOpen: TButton
|
||||
Position.X = 592.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 7
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnNotifyCheck: TButton
|
||||
Position.X = 624.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 8
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object cbNotifyFileAgain1: TCheckBox
|
||||
Position.X = 656.000000000000000000
|
||||
Position.Y = 41.000000000000000000
|
||||
Size.Width = 255.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 29
|
||||
Text = #1048#1089#1087#1086#1083#1100#1079#1086#1074#1072#1090#1100' '#1092#1072#1081#1083' '#1086#1073#1097#1077#1075#1086' '#1086#1087#1086#1074#1077#1097#1077#1085#1080#1103
|
||||
end
|
||||
object btnNotifyCheckMod: TButton
|
||||
Position.X = 624.000000000000000000
|
||||
Position.Y = 38.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 26
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnNotifyOpenMod: TButton
|
||||
Position.X = 592.000000000000000000
|
||||
Position.Y = 38.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 24
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object edtNotifyFileNameMod: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 22
|
||||
Position.X = 428.000000000000000000
|
||||
Position.Y = 38.000000000000000000
|
||||
Size.Width = 156.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object tbNotifyVolumeMod: TTrackBar
|
||||
CanParentFocus = True
|
||||
Orientation = Horizontal
|
||||
Position.X = 320.000000000000000000
|
||||
Position.Y = 37.000000000000000000
|
||||
TabOrder = 20
|
||||
Value = 100.000000000000000000
|
||||
end
|
||||
object Label50: TLabel
|
||||
Position.X = 70.000000000000000000
|
||||
Position.Y = 35.000000000000000000
|
||||
Size.Width = 242.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1059#1074#1077#1076#1086#1084#1083#1103#1090#1100' '#1086' '#1089#1086#1086#1073#1097#1077#1085#1080#1103#1093' '#1086#1090' '#1084#1086#1076#1077#1088#1072#1090#1086#1088#1086#1074
|
||||
TabOrder = 16
|
||||
end
|
||||
object chEnNotifyMod: TSwitch
|
||||
IsChecked = False
|
||||
Position.X = 13.000000000000000000
|
||||
Position.Y = 36.000000000000000000
|
||||
Size.Width = 49.000000000000000000
|
||||
Size.Height = 20.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 12
|
||||
end
|
||||
object chEnNotifyVip: TSwitch
|
||||
IsChecked = False
|
||||
Position.X = 13.000000000000000000
|
||||
Position.Y = 64.000000000000000000
|
||||
Size.Width = 49.000000000000000000
|
||||
Size.Height = 20.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 10
|
||||
end
|
||||
object Label51: TLabel
|
||||
Position.X = 70.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
Size.Width = 220.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1059#1074#1077#1076#1086#1084#1083#1103#1090#1100' '#1086' '#1089#1086#1086#1073#1097#1077#1085#1080#1103#1093' '#1086#1090' '#1074#1080#1087#1086#1074
|
||||
TabOrder = 13
|
||||
end
|
||||
object tbNotifyVolumeVip: TTrackBar
|
||||
CanParentFocus = True
|
||||
Orientation = Horizontal
|
||||
Position.X = 320.000000000000000000
|
||||
Position.Y = 65.000000000000000000
|
||||
TabOrder = 15
|
||||
Value = 100.000000000000000000
|
||||
end
|
||||
object edtNotifyFileNameVip: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 18
|
||||
Position.X = 428.000000000000000000
|
||||
Position.Y = 66.000000000000000000
|
||||
Size.Width = 156.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnNotifyOpenVip: TButton
|
||||
Position.X = 592.000000000000000000
|
||||
Position.Y = 64.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 21
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnNotifyCheckVip: TButton
|
||||
Position.X = 624.000000000000000000
|
||||
Position.Y = 66.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 25
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object cbNotifyFileAgain2: TCheckBox
|
||||
Position.X = 656.000000000000000000
|
||||
Position.Y = 68.000000000000000000
|
||||
Size.Width = 255.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 28
|
||||
Text = #1048#1089#1087#1086#1083#1100#1079#1086#1074#1072#1090#1100' '#1092#1072#1081#1083' '#1086#1073#1097#1077#1075#1086' '#1086#1087#1086#1074#1077#1097#1077#1085#1080#1103
|
||||
end
|
||||
object cbNotifyFileAgain3: TCheckBox
|
||||
Position.X = 656.000000000000000000
|
||||
Position.Y = 97.000000000000000000
|
||||
Size.Width = 255.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 27
|
||||
Text = #1048#1089#1087#1086#1083#1100#1079#1086#1074#1072#1090#1100' '#1092#1072#1081#1083' '#1086#1073#1097#1077#1075#1086' '#1086#1087#1086#1074#1077#1097#1077#1085#1080#1103
|
||||
end
|
||||
object btnNotifyCheckSub: TButton
|
||||
Position.X = 624.000000000000000000
|
||||
Position.Y = 94.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 23
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnNotifyOpenSub: TButton
|
||||
Position.X = 592.000000000000000000
|
||||
Position.Y = 94.000000000000000000
|
||||
Size.Width = 24.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 19
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object edtNotifyFileNameSub: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 17
|
||||
Position.X = 428.000000000000000000
|
||||
Position.Y = 94.000000000000000000
|
||||
Size.Width = 156.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object tbNotifyVolumeSub: TTrackBar
|
||||
CanParentFocus = True
|
||||
Orientation = Horizontal
|
||||
Position.X = 320.000000000000000000
|
||||
Position.Y = 93.000000000000000000
|
||||
TabOrder = 14
|
||||
Value = 100.000000000000000000
|
||||
end
|
||||
object Label52: TLabel
|
||||
Position.X = 70.000000000000000000
|
||||
Position.Y = 91.000000000000000000
|
||||
Size.Width = 220.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1059#1074#1077#1076#1086#1084#1083#1103#1090#1100' '#1086' '#1089#1086#1086#1073#1097#1077#1085#1080#1103#1093' '#1086#1090' '#1089#1072#1073#1086#1074
|
||||
TabOrder = 11
|
||||
end
|
||||
object chEnNotifySub: TSwitch
|
||||
IsChecked = False
|
||||
Position.X = 13.000000000000000000
|
||||
Position.Y = 92.000000000000000000
|
||||
Size.Width = 49.000000000000000000
|
||||
Size.Height = 20.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 9
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Left = 448
|
||||
Top = 56
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,50 @@
|
||||
unit fNotify;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Edit, FMX.Controls.Presentation;
|
||||
|
||||
type
|
||||
TfrNotify = class(TFrame)
|
||||
chEnNotify: TSwitch;
|
||||
Label43: TLabel;
|
||||
tbNotifyVolume: TTrackBar;
|
||||
edtNotifyFileName: TEdit;
|
||||
btnNotifyOpen: TButton;
|
||||
btnNotifyCheck: TButton;
|
||||
cbNotifyFileAgain1: TCheckBox;
|
||||
btnNotifyCheckMod: TButton;
|
||||
btnNotifyOpenMod: TButton;
|
||||
edtNotifyFileNameMod: TEdit;
|
||||
tbNotifyVolumeMod: TTrackBar;
|
||||
Label50: TLabel;
|
||||
chEnNotifyMod: TSwitch;
|
||||
chEnNotifyVip: TSwitch;
|
||||
Label51: TLabel;
|
||||
tbNotifyVolumeVip: TTrackBar;
|
||||
edtNotifyFileNameVip: TEdit;
|
||||
btnNotifyOpenVip: TButton;
|
||||
btnNotifyCheckVip: TButton;
|
||||
cbNotifyFileAgain2: TCheckBox;
|
||||
cbNotifyFileAgain3: TCheckBox;
|
||||
btnNotifyCheckSub: TButton;
|
||||
btnNotifyOpenSub: TButton;
|
||||
edtNotifyFileNameSub: TEdit;
|
||||
tbNotifyVolumeSub: TTrackBar;
|
||||
Label52: TLabel;
|
||||
chEnNotifySub: TSwitch;
|
||||
OpenDialog1: TOpenDialog;
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,77 @@
|
||||
object frOBS: TfrOBS
|
||||
Size.Width = 689.000000000000000000
|
||||
Size.Height = 252.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object sgWebChats: TStringGrid
|
||||
Align = Bottom
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Position.Y = 63.000000000000000000
|
||||
Size.Width = 689.000000000000000000
|
||||
Size.Height = 189.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 0
|
||||
RowCount = 0
|
||||
Options = [ColumnResize, ColumnMove, ColLines, RowLines, Tabs, Header, HeaderClick, AutoDisplacement]
|
||||
OnCellDblClick = sgWebChatsCellDblClick
|
||||
Viewport.Width = 685.000000000000000000
|
||||
Viewport.Height = 164.000000000000000000
|
||||
object IntegerColumn1: TIntegerColumn
|
||||
Header = #1055#1086#1088#1090
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
object StringColumn1: TStringColumn
|
||||
Header = #1058#1080#1087
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
object StringColumn2: TStringColumn
|
||||
Header = #1057#1089#1099#1083#1082#1072' '#1076#1083#1103' OBS'
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 200.000000000000000000
|
||||
end
|
||||
end
|
||||
object btnCreateOBSChat: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TabOrder = 1
|
||||
Text = #1057#1086#1079#1076#1072#1090#1100' '#1095#1072#1090
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCreateOBSChatClick
|
||||
end
|
||||
object btnDeleteeChat: TButton
|
||||
Position.X = 601.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
TabOrder = 2
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnDeleteeChatClick
|
||||
end
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 38.000000000000000000
|
||||
Text = #1057#1086#1079#1076#1072#1085#1085#1099#1077' '#1095#1072#1090#1099':'
|
||||
TabOrder = 3
|
||||
end
|
||||
object btnCreateOBSNotify: TButton
|
||||
Position.X = 103.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 146.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1057#1086#1079#1076#1072#1090#1100' '#1086#1087#1086#1074#1077#1097#1077#1085#1080#1077
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCreateOBSNotifyClick
|
||||
end
|
||||
object btnCreateOBSKandinsky: TButton
|
||||
Position.X = 257.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 147.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 5
|
||||
Text = #1057#1086#1079#1076#1072#1090#1100' '#1050#1072#1085#1076#1080#1085#1089#1082#1080#1081
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnCreateOBSKandinskyClick
|
||||
end
|
||||
end
|
||||
+697
@@ -0,0 +1,697 @@
|
||||
unit fOBS;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, uCustomEmoties,
|
||||
System.Variants, uWebServerChat, fColorSettings, System.Generics.Collections,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
System.Rtti, FMX.Grid.Style, FMX.Grid, FMX.ScrollBox, FMX.Edit, FMX.Colors,
|
||||
FMX.ListBox, FMX.EditBox, FMX.SpinBox, FMX.Controls.Presentation, uRecords,
|
||||
System.Generics.Defaults, fFontSettings;
|
||||
|
||||
type
|
||||
TChatWebServers = record
|
||||
port: integer;
|
||||
MaxMsg: integer;
|
||||
TimeMsg: integer;
|
||||
Freez: boolean;
|
||||
StyleBorderColor: string;
|
||||
StyleBlockColor: string;
|
||||
StyleBlockBorderSize: integer;
|
||||
StyleBlockPadding: integer;
|
||||
FontStyleDefault: string;
|
||||
FontColor: string;
|
||||
BColor: string;
|
||||
FontSize: integer;
|
||||
WebServerChat: TTTW_Chat;
|
||||
end;
|
||||
|
||||
type
|
||||
TfrOBS = class(TFrame)
|
||||
sgWebChats: TStringGrid;
|
||||
btnCreateOBSChat: TButton;
|
||||
btnDeleteeChat: TButton;
|
||||
Label1: TLabel;
|
||||
IntegerColumn1: TIntegerColumn;
|
||||
StringColumn1: TStringColumn;
|
||||
StringColumn2: TStringColumn;
|
||||
btnCreateOBSNotify: TButton;
|
||||
btnCreateOBSKandinsky: TButton;
|
||||
procedure btnDeleteeChatClick(Sender: TObject);
|
||||
procedure btnCreateOBSKandinskyClick(Sender: TObject);
|
||||
procedure btnCreateOBSChatClick(Sender: TObject);
|
||||
procedure btnCreateOBSNotifyClick(Sender: TObject);
|
||||
procedure sgWebChatsCellDblClick(const Column: TColumn; const Row: integer);
|
||||
private
|
||||
{ Private declarations }
|
||||
|
||||
function checkBttv(aMsg: string): string;
|
||||
function ReplaceEmotesInMessage(const MessageText,
|
||||
EmotesString: string): string;
|
||||
function FindEmoteByID(const ID: string): TEmotes;
|
||||
function GetBadgesHTML(Badges: string): string;
|
||||
public
|
||||
{ Public declarations }
|
||||
listChats: TArray<TOBSChat>;
|
||||
listNotify: TArray<TOBSNotify>;
|
||||
listKandinsky: TArray<TOBSKandinsky>;
|
||||
|
||||
BTTV: TBTTV;
|
||||
m7tv: t7tv;
|
||||
ChatBadges: Tlist<TChatBadge>;
|
||||
ChatEmotes: Tlist<TEmotes>;
|
||||
ChatWebServers: Tlist<TChatWebServers>;
|
||||
procedure MsgToWebServer(const aRecord: TTwitchChatMessage);
|
||||
procedure CreateWebChat(chatSettings: TOBSChat);
|
||||
procedure UpdateGridFromArray;
|
||||
procedure AddChat(newRecord: TOBSChat);
|
||||
procedure EdtChat(newRecord: TOBSChat; oldPort: integer);
|
||||
procedure DelChat(aPort: integer);
|
||||
|
||||
procedure AddNotify(newRecord: TOBSNotify);
|
||||
procedure EdtNotify(newRecord: TOBSNotify; oldPort: integer);
|
||||
procedure DelNotify(aPort: integer);
|
||||
|
||||
procedure AddKandinsky(newRecord: TOBSKandinsky);
|
||||
procedure DelKandinsky(aPort: integer);
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses uGeneral, uCreateChat, uCreateNotify;
|
||||
|
||||
{ TfrOBS }
|
||||
|
||||
function TfrOBS.checkBttv(aMsg: string): string;
|
||||
var
|
||||
Words: tstringlist;
|
||||
i: integer;
|
||||
CurrentWord, Url: string;
|
||||
begin
|
||||
Words := tstringlist.Create;
|
||||
try
|
||||
// Ðàçáèâàåì ñòðîêó íà ñëîâà ïî ïðîáåëàì
|
||||
Words.Delimiter := ' ';
|
||||
Words.StrictDelimiter := True; // Èãíîðèðîâàòü ïîâòîðÿþùèåñÿ ïðîáåëû
|
||||
Words.DelimitedText := aMsg;
|
||||
|
||||
// Îáðàáîòêà ñëîâ
|
||||
for i := 0 to Words.Count - 1 do
|
||||
begin
|
||||
CurrentWord := Words[i];
|
||||
Url := BTTV.generateURL(CurrentWord);
|
||||
if Url = '' then
|
||||
Url := m7tv.generateURL(CurrentWord);
|
||||
if Url <> '' then
|
||||
Words[i] := Format('<img src="%s" width="18" height="18">', [Url]);
|
||||
end;
|
||||
|
||||
// Ñîáèðàåì ðåçóëüòàò
|
||||
result := Words.text;
|
||||
finally
|
||||
Words.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TfrOBS.FindEmoteByID(const ID: string): TEmotes;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
result.ID := '';
|
||||
if not Assigned(ChatEmotes) then
|
||||
exit;
|
||||
|
||||
for i := 0 to ChatEmotes.Count - 1 do
|
||||
if ChatEmotes[i].ID = ID then
|
||||
begin
|
||||
result := ChatEmotes[i];
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TfrOBS.ReplaceEmotesInMessage(const MessageText,
|
||||
EmotesString: string): string;
|
||||
type
|
||||
TEmotePosition = record
|
||||
StartPos: integer;
|
||||
EndPos: integer;
|
||||
ImageURL: string;
|
||||
end;
|
||||
var
|
||||
Positions: Tlist<TEmotePosition>;
|
||||
i, ColonPos: integer;
|
||||
Parts, EmoteData, Ranges: tstringlist;
|
||||
EmoteID, RangeStr: string;
|
||||
StartPos, EndPos: integer;
|
||||
Emote: TEmotes;
|
||||
begin
|
||||
result := MessageText;
|
||||
if EmotesString.IsEmpty then
|
||||
exit;
|
||||
|
||||
Parts := tstringlist.Create;
|
||||
EmoteData := tstringlist.Create;
|
||||
Ranges := tstringlist.Create;
|
||||
Positions := Tlist<TEmotePosition>.Create;
|
||||
try
|
||||
Parts.Delimiter := '/';
|
||||
Parts.StrictDelimiter := True;
|
||||
Parts.DelimitedText := EmotesString;
|
||||
|
||||
for i := 0 to Parts.Count - 1 do
|
||||
begin
|
||||
ColonPos := Pos(':', Parts[i]);
|
||||
if ColonPos = 0 then
|
||||
Continue;
|
||||
|
||||
EmoteID := Copy(Parts[i], 1, ColonPos - 1);
|
||||
RangeStr := Copy(Parts[i], ColonPos + 1, MaxInt);
|
||||
|
||||
Ranges.Clear;
|
||||
Ranges.Delimiter := ',';
|
||||
Ranges.StrictDelimiter := True;
|
||||
Ranges.DelimitedText := RangeStr;
|
||||
|
||||
Emote := FindEmoteByID(EmoteID);
|
||||
if Emote.ID = '' then
|
||||
Continue;
|
||||
|
||||
for var j := 0 to Ranges.Count - 1 do
|
||||
begin
|
||||
EmoteData.Clear;
|
||||
EmoteData.Delimiter := '-';
|
||||
EmoteData.StrictDelimiter := True;
|
||||
EmoteData.DelimitedText := Ranges[j];
|
||||
if EmoteData.Count <> 2 then
|
||||
Continue;
|
||||
|
||||
if TryStrToInt(EmoteData[0], StartPos) and
|
||||
TryStrToInt(EmoteData[1], EndPos) then
|
||||
begin
|
||||
var
|
||||
EmotePosition: TEmotePosition;
|
||||
EmotePosition.StartPos := StartPos;
|
||||
EmotePosition.EndPos := EndPos;
|
||||
EmotePosition.ImageURL := Emote.images.Url1x;
|
||||
|
||||
Positions.Add(EmotePosition);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
Positions.Sort(TComparer<TEmotePosition>.Construct(
|
||||
function(const Left, Right: TEmotePosition): integer
|
||||
begin
|
||||
result := Right.StartPos - Left.StartPos;
|
||||
end));
|
||||
|
||||
var
|
||||
SB := TStringBuilder.Create(MessageText);
|
||||
try
|
||||
for var Pos in Positions do
|
||||
begin
|
||||
if (Pos.StartPos < 0) or (Pos.EndPos >= SB.Length) or
|
||||
(Pos.StartPos > Pos.EndPos) then
|
||||
Continue;
|
||||
|
||||
var
|
||||
Replacement := Format('<img src="%s" width="18" height="18">',
|
||||
[Pos.ImageURL]);
|
||||
|
||||
SB.Remove(Pos.StartPos, Pos.EndPos - Pos.StartPos + 1);
|
||||
SB.Insert(Pos.StartPos, Replacement);
|
||||
end;
|
||||
result := SB.ToString;
|
||||
finally
|
||||
SB.Free;
|
||||
end;
|
||||
finally
|
||||
Parts.Free;
|
||||
EmoteData.Free;
|
||||
Ranges.Free;
|
||||
Positions.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TfrOBS.GetBadgesHTML(Badges: string): string;
|
||||
var
|
||||
BadgeList: TArray<string>;
|
||||
CodeParts: TArray<string>;
|
||||
CurrentCode, SetId, VersionId: string;
|
||||
Badge: TChatBadge;
|
||||
Version: TBadgeVersion;
|
||||
Found: boolean;
|
||||
begin
|
||||
// Ðàçáèâàåì ñòðîêó íà îòäåëüíûå áåéäæ-êîäû
|
||||
BadgeList := Badges.Split([',']);
|
||||
|
||||
for CurrentCode in BadgeList do
|
||||
begin
|
||||
// Ðàçäåëÿåì SetId è VersionId
|
||||
CodeParts := CurrentCode.Split(['/']);
|
||||
if Length(CodeParts) <> 2 then
|
||||
Continue;
|
||||
|
||||
SetId := CodeParts[0];
|
||||
VersionId := CodeParts[1];
|
||||
Found := false;
|
||||
|
||||
// Èùåì ñîîòâåòñòâóþùèé áåéäæ
|
||||
for Badge in ChatBadges do
|
||||
begin
|
||||
if Badge.SetId = SetId then
|
||||
begin
|
||||
// Èùåì íóæíóþ âåðñèþ
|
||||
for Version in Badge.Versions do
|
||||
begin
|
||||
if Version.ID = VersionId then
|
||||
begin
|
||||
// Ôîðìèðóåì HTML-òåã
|
||||
result := result +
|
||||
Format(' <img src="%s" width=18 height=18 alt="%s" title="%s">',
|
||||
[Version.ImageUrl1x, Version.Title, Version.Description]);
|
||||
Found := True;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if Found then
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Åñëè íå íàøëè - äîáàâëÿåì çàãëóøêó
|
||||
if not Found then
|
||||
result := result + ' <img src="placeholder.png" width=18 height=18>';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.MsgToWebServer(const aRecord: TTwitchChatMessage);
|
||||
var
|
||||
s: string;
|
||||
ms: TStyleChat;
|
||||
i: integer;
|
||||
begin
|
||||
s := checkBttv(aRecord.Message);
|
||||
if aRecord.Emotes <> '' then
|
||||
s := ReplaceEmotesInMessage(s, aRecord.Emotes);
|
||||
|
||||
ms.Nick := GetBadgesHTML(aRecord.Badges) + '<span class="nick" style="color:'
|
||||
+ aRecord.Color + '">' + aRecord.DisplayName + '</span>';
|
||||
ms.Context := '<span class="text">' + s + '</span>';
|
||||
|
||||
for i := 0 to ChatWebServers.Count - 1 do
|
||||
begin
|
||||
ms.FontColor := ChatWebServers[i].FontColor;
|
||||
ms.FontSize := ChatWebServers[i].FontSize;
|
||||
ms.FontFamily := '''' + ChatWebServers[i].FontStyleDefault + ''';';
|
||||
ms.FontFamily := StringReplace(ms.FontFamily, '.ttf', '', [rfReplaceAll]);
|
||||
ms.BlockColor := ChatWebServers[i].StyleBlockColor;
|
||||
ms.BlockPadding := ChatWebServers[i].StyleBlockPadding;
|
||||
ms.MaxMsgCount := ChatWebServers[i].MaxMsg;
|
||||
ms.TimeMsg := ChatWebServers[i].TimeMsg;
|
||||
ms.BorderSize := ChatWebServers[i].StyleBlockBorderSize;
|
||||
ms.BorderColor := ChatWebServers[i].StyleBorderColor;
|
||||
ms.BColor := ChatWebServers[i].BColor;
|
||||
ChatWebServers[i].WebServerChat.AddMessage(ms);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.AddChat(newRecord: TOBSChat);
|
||||
begin
|
||||
SetLength(listChats, Length(listChats) + 1);
|
||||
listChats[High(listChats)] := newRecord;
|
||||
UpdateGridFromArray;
|
||||
db.SaveRecordArray<TOBSChat>('listChats', listChats);
|
||||
CreateWebChat(newRecord);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.AddKandinsky(newRecord: TOBSKandinsky);
|
||||
begin
|
||||
SetLength(listKandinsky, Length(listKandinsky) + 1);
|
||||
listKandinsky[High(listKandinsky)] := newRecord;
|
||||
UpdateGridFromArray;
|
||||
db.SaveRecordArray<TOBSKandinsky>('listKandinsky', listKandinsky);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.AddNotify(newRecord: TOBSNotify);
|
||||
begin
|
||||
SetLength(listNotify, Length(listNotify) + 1);
|
||||
listNotify[High(listNotify)] := newRecord;
|
||||
UpdateGridFromArray;
|
||||
db.SaveRecordArray<TOBSNotify>('listNotify', listNotify);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.btnCreateOBSChatClick(Sender: TObject);
|
||||
var
|
||||
dport, i: integer;
|
||||
begin
|
||||
dport := 8080;
|
||||
for i := 0 to sgWebChats.RowCount - 1 do
|
||||
begin
|
||||
if strtoint(sgWebChats.Cells[0, i]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
fCreateChat.sbWebServerPort.Value := dport;
|
||||
fCreateChat.isEdit := false;
|
||||
fCreateChat.Show;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.btnCreateOBSKandinskyClick(Sender: TObject);
|
||||
var
|
||||
dport: integer;
|
||||
i: integer;
|
||||
rk: TOBSKandinsky;
|
||||
begin
|
||||
dport := 8080;
|
||||
for i := 0 to sgWebChats.RowCount - 1 do
|
||||
begin
|
||||
if strtoint(sgWebChats.Cells[0, i]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
rk.port := dport;
|
||||
AddKandinsky(rk);
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrOBS.btnCreateOBSNotifyClick(Sender: TObject);
|
||||
var
|
||||
dport, i: integer;
|
||||
begin
|
||||
dport := 8080;
|
||||
for i := 0 to sgWebChats.RowCount - 1 do
|
||||
begin
|
||||
if strtoint(sgWebChats.Cells[0, i]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
fCreateNotify.sbWebServerPort.Value := dport;
|
||||
fCreateNotify.isEdit := false;
|
||||
fCreateNotify.Show;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.btnDeleteeChatClick(Sender: TObject);
|
||||
begin
|
||||
if sgWebChats.Cells[1, sgWebChats.Row] = '×àò' then
|
||||
begin
|
||||
DelChat(strtoint(sgWebChats.Cells[0, sgWebChats.Row]));
|
||||
end;
|
||||
if sgWebChats.Cells[1, sgWebChats.Row] = 'Kandinsky' then
|
||||
begin
|
||||
DelKandinsky(strtoint(sgWebChats.Cells[0, sgWebChats.Row]));
|
||||
end;
|
||||
if sgWebChats.Cells[1, sgWebChats.Row] = 'Îïîâåùåíèå' then
|
||||
begin
|
||||
DelNotify(strtoint(sgWebChats.Cells[0, sgWebChats.Row]));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.CreateWebChat(chatSettings: TOBSChat);
|
||||
var
|
||||
ChatWebServer: TChatWebServers;
|
||||
fonts: tstringlist;
|
||||
f: TfrColorSettings;
|
||||
t: TfrFontSettings;
|
||||
procedure LoadFontList(const mySL: tstringlist);
|
||||
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
|
||||
mySL.Add(SearchRec.Name);
|
||||
Inc(n);
|
||||
end;
|
||||
until FindNext(SearchRec) <> 0;
|
||||
finally
|
||||
System.SysUtils.FindClose(SearchRec);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
fonts := tstringlist.Create;
|
||||
f := TfrColorSettings.Create(self);
|
||||
t := TfrFontSettings.Create(self);
|
||||
try
|
||||
LoadFontList(fonts);
|
||||
ChatWebServer.WebServerChat := TTTW_Chat.Create(fonts, chatSettings.port,
|
||||
f.ccbBColor.Items[chatSettings.ColorBackground]);
|
||||
ChatWebServer.port := chatSettings.port;
|
||||
ChatWebServer.MaxMsg := chatSettings.MaxCountMess;
|
||||
ChatWebServer.TimeMsg := chatSettings.TimeMess;
|
||||
ChatWebServer.Freez := chatSettings.Freez = 1;
|
||||
ChatWebServer.StyleBorderColor := f.ccbStyleBorderColor.Items
|
||||
[chatSettings.ColorBorder];
|
||||
ChatWebServer.StyleBlockColor := chatSettings.ColorBlock;
|
||||
ChatWebServer.StyleBlockBorderSize := chatSettings.SolidBorder;
|
||||
ChatWebServer.StyleBlockPadding := chatSettings.Paddings;
|
||||
ChatWebServer.FontStyleDefault := t.cbFontStyleDefault.Items
|
||||
[chatSettings.StyleFont];
|
||||
ChatWebServer.FontColor := t.ccbFontColor.Items[chatSettings.ColorFont];
|
||||
ChatWebServer.BColor := f.ccbBColor.Items[chatSettings.ColorBorder];;
|
||||
ChatWebServer.FontSize := chatSettings.SizeFont;
|
||||
ChatWebServers.Add(ChatWebServer);
|
||||
|
||||
ChatWebServers[ChatWebServers.Count - 1].WebServerChat.ActiveServer(True);
|
||||
ChatWebServers[ChatWebServers.Count - 1].WebServerChat.SetDeleteMode
|
||||
(not ChatWebServer.Freez, ChatWebServer.MaxMsg);
|
||||
|
||||
finally
|
||||
fonts.Free;
|
||||
f.Free;
|
||||
t.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.DelChat(aPort: integer);
|
||||
var
|
||||
i, j: integer;
|
||||
begin
|
||||
// Èùåì â îáðàòíîì ïîðÿäêå äëÿ áåçîïàñíîãî óäàëåíèÿ
|
||||
for i := High(listChats) downto 0 do
|
||||
begin
|
||||
if listChats[i].port = aPort then
|
||||
begin
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for j := i to High(listChats) - 1 do
|
||||
listChats[j] := listChats[j + 1];
|
||||
// Óìåíüøàåì ðàçìåð ìàññèâà
|
||||
SetLength(listChats, Length(listChats) - 1);
|
||||
// Âûõîäèì ïîñëå ïåðâîãî íàéäåííîãî ñîâïàäåíèÿ (ïðåäïîëàãàåì óíèêàëüíîñòü ïîðòîâ)
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
ChatWebServers[i].WebServerChat.ActiveServer(false);
|
||||
ChatWebServers[i].WebServerChat.Destroy;
|
||||
ChatWebServers.Delete(i);
|
||||
db.SaveRecordArray<TOBSChat>('listChats', listChats);
|
||||
UpdateGridFromArray;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.DelKandinsky(aPort: integer);
|
||||
var
|
||||
i, j: integer;
|
||||
begin
|
||||
// Èùåì â îáðàòíîì ïîðÿäêå äëÿ áåçîïàñíîãî óäàëåíèÿ
|
||||
for i := High(listKandinsky) downto 0 do
|
||||
begin
|
||||
if listKandinsky[i].port = aPort then
|
||||
begin
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for j := i to High(listKandinsky) - 1 do
|
||||
listKandinsky[j] := listKandinsky[j + 1];
|
||||
// Óìåíüøàåì ðàçìåð ìàññèâà
|
||||
SetLength(listKandinsky, Length(listKandinsky) - 1);
|
||||
// Âûõîäèì ïîñëå ïåðâîãî íàéäåííîãî ñîâïàäåíèÿ (ïðåäïîëàãàåì óíèêàëüíîñòü ïîðòîâ)
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
UpdateGridFromArray;
|
||||
db.SaveRecordArray<TOBSKandinsky>('listKandinsky', listKandinsky);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.DelNotify(aPort: integer);
|
||||
var
|
||||
i, j: integer;
|
||||
begin
|
||||
// Èùåì â îáðàòíîì ïîðÿäêå äëÿ áåçîïàñíîãî óäàëåíèÿ
|
||||
for i := High(listNotify) downto 0 do
|
||||
begin
|
||||
if listNotify[i].port = aPort then
|
||||
begin
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for j := i to High(listNotify) - 1 do
|
||||
listNotify[j] := listNotify[j + 1];
|
||||
// Óìåíüøàåì ðàçìåð ìàññèâà
|
||||
SetLength(listNotify, Length(listNotify) - 1);
|
||||
// Âûõîäèì ïîñëå ïåðâîãî íàéäåííîãî ñîâïàäåíèÿ (ïðåäïîëàãàåì óíèêàëüíîñòü ïîðòîâ)
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
UpdateGridFromArray;
|
||||
db.SaveRecordArray<TOBSNotify>('listNotify', listNotify);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.EdtChat(newRecord: TOBSChat; oldPort: integer);
|
||||
var
|
||||
i, j: integer;
|
||||
chatWeb: TChatWebServers; // Âðåìåííàÿ ïåðåìåííàÿ äëÿ çàïèñè
|
||||
f: TfrColorSettings;
|
||||
t: TfrFontSettings;
|
||||
begin
|
||||
f := TfrColorSettings.Create(self);
|
||||
t := TfrFontSettings.Create(self);
|
||||
try
|
||||
// Îáíîâëÿåì çàïèñü â listChats
|
||||
for i := 0 to High(listChats) do
|
||||
if listChats[i].port = oldPort then
|
||||
begin
|
||||
listChats[i] := newRecord;
|
||||
Break;
|
||||
end;
|
||||
|
||||
// Îáíîâëÿåì ñîîòâåòñòâóþùèé ñåðâåð â ChatWebServers
|
||||
for j := 0 to ChatWebServers.Count - 1 do
|
||||
begin
|
||||
// 1. Èçâëåêàåì çàïèñü âî âðåìåííóþ ïåðåìåííóþ
|
||||
chatWeb := ChatWebServers[j];
|
||||
|
||||
if chatWeb.port = oldPort then
|
||||
begin
|
||||
// 2. Ìîäèôèöèðóåì ïîëÿ çàïèñè
|
||||
chatWeb.MaxMsg := newRecord.MaxCountMess;
|
||||
chatWeb.TimeMsg := newRecord.TimeMess;
|
||||
chatWeb.Freez := newRecord.Freez = 1;
|
||||
chatWeb.StyleBorderColor := f.ccbStyleBorderColor.Items[newRecord.ColorBorder];
|
||||
chatWeb.StyleBlockColor := newRecord.ColorBlock;
|
||||
chatWeb.StyleBlockBorderSize := newRecord.SolidBorder;
|
||||
chatWeb.StyleBlockPadding := newRecord.Paddings;
|
||||
chatWeb.FontStyleDefault := t.cbFontStyleDefault.Items[newRecord.StyleFont];
|
||||
chatWeb.FontColor := t.ccbFontColor.Items[newRecord.ColorFont];
|
||||
chatWeb.FontSize := newRecord.SizeFont;
|
||||
chatWeb.BColor := f.ccbBColor.Items[newRecord.ColorBackground];
|
||||
chatWeb.WebServerChat.changeBackground(f.ccbBColor.Items[newRecord.ColorBackground]);
|
||||
chatWeb.WebServerChat.SetDeleteMode(not chatWeb.Freez, chatWeb.MaxMsg);
|
||||
|
||||
// 4. Âîçâðàùàåì ìîäèôèöèðîâàííóþ çàïèñü â ñïèñîê
|
||||
ChatWebServers[j] := chatWeb;
|
||||
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
UpdateGridFromArray;
|
||||
db.SaveRecordArray<TOBSChat>('listChats', listChats);
|
||||
finally
|
||||
f.Free;
|
||||
t.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.EdtNotify(newRecord: TOBSNotify; oldPort: integer);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := 0 to High(listNotify) do
|
||||
if listNotify[i].port = oldPort then
|
||||
begin
|
||||
listNotify[i] := newRecord;
|
||||
UpdateGridFromArray;
|
||||
db.SaveRecordArray<TOBSNotify>('listNotify', listNotify);
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.sgWebChatsCellDblClick(const Column: TColumn;
|
||||
const Row: integer);
|
||||
var
|
||||
myChatRec: TOBSChat;
|
||||
myNotifyRec: TOBSNotify;
|
||||
i: integer;
|
||||
begin
|
||||
if sgWebChats.Cells[1, Row] = 'Îïîâåùåíèå' then
|
||||
begin
|
||||
for i := 0 to High(listNotify) do
|
||||
if listNotify[i].port = (strtoint(sgWebChats.Cells[0, Row])) then
|
||||
begin
|
||||
myNotifyRec := listNotify[i];
|
||||
Break;
|
||||
end;
|
||||
|
||||
fCreateNotify.isEdit := True;
|
||||
fCreateNotify.setRecord(myNotifyRec);
|
||||
fCreateNotify.Show;
|
||||
end;
|
||||
if sgWebChats.Cells[1, Row] = '×àò' then
|
||||
begin
|
||||
for i := 0 to High(listChats) do
|
||||
if listChats[i].port = (strtoint(sgWebChats.Cells[0, Row])) then
|
||||
begin
|
||||
myChatRec := listChats[i];
|
||||
Break;
|
||||
end;
|
||||
fCreateChat.isEdit := True;
|
||||
fCreateChat.setRecord(myChatRec);
|
||||
fCreateChat.Show;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.UpdateGridFromArray;
|
||||
var
|
||||
i, rowIndex: integer;
|
||||
begin
|
||||
sgWebChats.BeginUpdate;
|
||||
try
|
||||
sgWebChats.RowCount := 0; // Ñáðàñûâàåì ñòðîêè
|
||||
|
||||
rowIndex := 0; // Îòäåëüíûé ñ÷åò÷èê äëÿ ñòðîê ñåòêè
|
||||
|
||||
// listChats
|
||||
for i := 0 to High(listChats) do
|
||||
begin
|
||||
sgWebChats.RowCount := rowIndex + 1;
|
||||
sgWebChats.Cells[0, rowIndex] := inttostr(listChats[i].port);
|
||||
sgWebChats.Cells[1, rowIndex] := '×àò';
|
||||
sgWebChats.Cells[2, rowIndex] := 'http://127.0.0.1:' +
|
||||
inttostr(listChats[i].port);
|
||||
Inc(rowIndex); // Óâåëè÷èâàåì ñ÷åò÷èê ñòðîê
|
||||
end;
|
||||
|
||||
// listNotify
|
||||
for i := 0 to High(listNotify) do
|
||||
begin
|
||||
sgWebChats.RowCount := rowIndex + 1;
|
||||
sgWebChats.Cells[0, rowIndex] := inttostr(listNotify[i].port);
|
||||
sgWebChats.Cells[1, rowIndex] := 'Îïîâåùåíèå';
|
||||
sgWebChats.Cells[2, rowIndex] := 'http://127.0.0.1:' +
|
||||
inttostr(listNotify[i].port);
|
||||
Inc(rowIndex); // Óâåëè÷èâàåì ñ÷åò÷èê ñòðîê
|
||||
end;
|
||||
|
||||
// listKandinsky
|
||||
for i := 0 to High(listKandinsky) do
|
||||
begin
|
||||
sgWebChats.RowCount := rowIndex + 1;
|
||||
sgWebChats.Cells[0, rowIndex] := inttostr(listKandinsky[i].port);
|
||||
sgWebChats.Cells[1, rowIndex] := 'Kandinsky';
|
||||
sgWebChats.Cells[2, rowIndex] := 'http://127.0.0.1:' +
|
||||
inttostr(listKandinsky[i].port);
|
||||
Inc(rowIndex); // Óâåëè÷èâàåì ñ÷åò÷èê ñòðîê
|
||||
end;
|
||||
finally
|
||||
sgWebChats.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,35 @@
|
||||
object frPlayerWeb: TfrPlayerWeb
|
||||
Size.Width = 207.000000000000000000
|
||||
Size.Height = 76.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object Label1: TLabel
|
||||
Align = Top
|
||||
Margins.Left = 10.000000000000000000
|
||||
Margins.Top = 10.000000000000000000
|
||||
Margins.Right = 10.000000000000000000
|
||||
Margins.Bottom = 10.000000000000000000
|
||||
Position.X = 10.000000000000000000
|
||||
Position.Y = 10.000000000000000000
|
||||
Size.Width = 187.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = #1057#1089#1099#1083#1082#1072' '#1076#1083#1103' OBS '#1044#1086#1082'-'#1087#1072#1085#1077#1083#1080
|
||||
TabOrder = 3
|
||||
end
|
||||
object Edit1: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
Align = Top
|
||||
TabOrder = 2
|
||||
ReadOnly = True
|
||||
Text = 'http://127.0.0.1:8088'
|
||||
Position.X = 10.000000000000000000
|
||||
Position.Y = 47.000000000000000000
|
||||
Margins.Left = 10.000000000000000000
|
||||
Margins.Top = 10.000000000000000000
|
||||
Margins.Right = 10.000000000000000000
|
||||
Margins.Bottom = 10.000000000000000000
|
||||
Size.Width = 187.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
unit fPlayerWeb;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants, FMX.Styles, IdHTTPWebBrokerBridge, IdGlobal, Web.HTTPApp,
|
||||
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Controls.Presentation, FMX.Layouts, FMX.ListBox, uPlayerThread,
|
||||
bass_simple, FMX.Memo.Types, FMX.ScrollBox, FMX.Memo, FMX.Edit;
|
||||
|
||||
type
|
||||
TfrPlayerWeb = class(TFrame)
|
||||
Label1: TLabel;
|
||||
Edit1: TEdit;
|
||||
|
||||
private
|
||||
mp: TBassSimple;
|
||||
Player: TPlayerThread;
|
||||
FServer: TIdHTTPWebBrokerBridge;
|
||||
procedure StartServer;
|
||||
public
|
||||
procedure init;
|
||||
destructor Destoy(Sender: TObject; var Action: TCloseAction);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
destructor TfrPlayerWeb.Destoy(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
FServer.Active := False;
|
||||
FServer.Bindings.Clear;
|
||||
Player.Free;
|
||||
mp.Free;
|
||||
end;
|
||||
|
||||
procedure TfrPlayerWeb.init;
|
||||
begin
|
||||
|
||||
FServer := TIdHTTPWebBrokerBridge.Create(Self);
|
||||
StartServer;
|
||||
end;
|
||||
|
||||
procedure TfrPlayerWeb.StartServer;
|
||||
begin
|
||||
if not FServer.Active then
|
||||
begin
|
||||
FServer.Bindings.Clear;
|
||||
FServer.DefaultPort := 8088;
|
||||
FServer.Active := True;
|
||||
end;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,361 @@
|
||||
object frSettings: TfrSettings
|
||||
Size.Width = 650.000000000000000000
|
||||
Size.Height = 398.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object GroupBox3: TGroupBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 9.000000000000000000
|
||||
Size.Width = 329.000000000000000000
|
||||
Size.Height = 304.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = 'Twitch'
|
||||
TabOrder = 0
|
||||
Top = 3
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
Size.Width = 305.000000000000000000
|
||||
Size.Height = 13.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1048#1084#1103' '#1073#1086#1090#1072' ('#1080#1084#1103' '#1072#1082#1082#1072#1091#1085#1090#1072')'
|
||||
Left = 11
|
||||
Top = 24
|
||||
end
|
||||
object Label2: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 74.000000000000000000
|
||||
Size.Width = 179.000000000000000000
|
||||
Size.Height = 13.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = 'API Token '#1041#1086#1090#1072
|
||||
Left = 11
|
||||
Top = 70
|
||||
end
|
||||
object Label3: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 226.000000000000000000
|
||||
Size.Width = 177.000000000000000000
|
||||
Size.Height = 13.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = #1050#1072#1085#1072#1083
|
||||
Left = 11
|
||||
Top = 162
|
||||
end
|
||||
object Label22: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 176.000000000000000000
|
||||
Size.Width = 177.000000000000000000
|
||||
Size.Height = 13.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = 'Client ID'
|
||||
Left = 11
|
||||
Top = 116
|
||||
end
|
||||
object edtBotName: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 0
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 45.000000000000000000
|
||||
Size.Width = 177.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
Left = 11
|
||||
Top = 43
|
||||
end
|
||||
object edtBotToken: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 1
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 92.000000000000000000
|
||||
Size.Width = 177.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
Left = 11
|
||||
Top = 89
|
||||
end
|
||||
object edtChannel: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 2
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 247.000000000000000000
|
||||
Size.Width = 177.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
Left = 11
|
||||
Top = 181
|
||||
end
|
||||
object btnGetToken: TButton
|
||||
Position.X = 193.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 128.000000000000000000
|
||||
Size.Height = 25.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 3
|
||||
Text = #1055#1086#1083#1091#1095#1080#1090#1100' Token'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnGetTokenClick
|
||||
Left = 207
|
||||
Top = 87
|
||||
end
|
||||
object edtBotClientID: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 5
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 197.000000000000000000
|
||||
Size.Width = 177.000000000000000000
|
||||
Size.Height = 21.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
Left = 11
|
||||
Top = 135
|
||||
end
|
||||
object btnGetClientID: TButton
|
||||
Position.X = 193.000000000000000000
|
||||
Position.Y = 193.000000000000000000
|
||||
Size.Width = 128.000000000000000000
|
||||
Size.Height = 25.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 6
|
||||
Text = #1055#1086#1083#1091#1095#1080#1090#1100' Client-ID'
|
||||
TextSettings.Trimming = None
|
||||
Visible = False
|
||||
Left = 207
|
||||
Top = 133
|
||||
end
|
||||
object btnOpenStream: TButton
|
||||
Position.X = 193.000000000000000000
|
||||
Position.Y = 246.000000000000000000
|
||||
Size.Width = 128.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 31
|
||||
Text = #1054#1090#1082#1088#1099#1090#1100' '#1089#1090#1088#1080#1084
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnOpenStreamClick
|
||||
end
|
||||
object btnGetTokenStreamer: TButton
|
||||
Position.X = 193.000000000000000000
|
||||
Position.Y = 146.000000000000000000
|
||||
Size.Width = 128.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 32
|
||||
Text = #1055#1086#1083#1091#1095#1080#1090#1100' Token'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnGetTokenStreamerClick
|
||||
end
|
||||
object edtBotTokenStreamer: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 34
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 146.000000000000000000
|
||||
Size.Width = 177.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
end
|
||||
object Label53: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 121.000000000000000000
|
||||
Size.Width = 179.000000000000000000
|
||||
Size.Height = 17.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = 'API Token '#1057#1090#1088#1080#1084#1077#1088#1072
|
||||
TabOrder = 38
|
||||
end
|
||||
object cbTTVAutoLogin: TCheckBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 276.000000000000000000
|
||||
Size.Width = 137.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1040#1074#1090#1086#1087#1086#1076#1082#1083#1102#1095#1077#1085#1080#1077
|
||||
OnExit = edtChannelExit
|
||||
end
|
||||
end
|
||||
object GroupBox22: TGroupBox
|
||||
Position.X = 345.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Size.Width = 288.000000000000000000
|
||||
Size.Height = 305.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Text = 'DonationAlerts'
|
||||
TabOrder = 1
|
||||
object btnDAGetCode: TButton
|
||||
Position.X = 200.000000000000000000
|
||||
Position.Y = 216.000000000000000000
|
||||
TabOrder = 40
|
||||
Text = #1055#1086#1083#1091#1095#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnDAGetCodeClick
|
||||
end
|
||||
object Label63: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 24.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = 'Client ID'
|
||||
TabOrder = 33
|
||||
end
|
||||
object edtDAClientID: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 35
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 49.000000000000000000
|
||||
Size.Width = 272.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
end
|
||||
object Label64: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 79.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = 'Client Secret'
|
||||
TabOrder = 34
|
||||
end
|
||||
object edtDAClientSecret: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 36
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 104.000000000000000000
|
||||
Size.Width = 272.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
end
|
||||
object Label65: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 134.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = 'Redirect URL'
|
||||
TabOrder = 38
|
||||
end
|
||||
object edtDARedirectURL: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 39
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 159.000000000000000000
|
||||
Size.Width = 272.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
OnExit = edtChannelExit
|
||||
end
|
||||
object edtDACode: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 41
|
||||
Password = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 214.000000000000000000
|
||||
Size.Width = 184.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object Label66: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 189.000000000000000000
|
||||
TextSettings.Trimming = None
|
||||
Text = 'Code'
|
||||
TabOrder = 42
|
||||
end
|
||||
object btnDAStart: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 244.000000000000000000
|
||||
Size.Width = 121.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 43
|
||||
Text = #1055#1086#1076#1082#1083#1102#1095#1080#1090#1100#1089#1103
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnDAStartClick
|
||||
end
|
||||
object btnGetDADef: TButton
|
||||
ImageIndex = 10
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 274.000000000000000000
|
||||
Size.Width = 209.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 46
|
||||
Text = #1055#1086#1083#1091#1095#1080#1090#1100' '#1076#1072#1085#1085#1099#1077' Donation Alerts'
|
||||
TextSettings.Trimming = None
|
||||
Visible = False
|
||||
end
|
||||
object cbDAAutoLogin: TCheckBox
|
||||
Position.X = 137.000000000000000000
|
||||
Position.Y = 246.000000000000000000
|
||||
Size.Width = 88.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1040#1074#1090#1086#1083#1086#1075#1080#1085
|
||||
end
|
||||
end
|
||||
object btnOpenRomaning: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 321.000000000000000000
|
||||
Size.Width = 185.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 2
|
||||
Text = #1054#1090#1082#1088#1099#1090#1100' '#1087#1072#1087#1082#1091' '#1089' '#1085#1072#1089#1090#1088#1086#1081#1082#1072#1084#1080
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnOpenRomaningClick
|
||||
end
|
||||
object btnImportSettings: TButton
|
||||
Position.X = 201.000000000000000000
|
||||
Position.Y = 321.000000000000000000
|
||||
Size.Width = 160.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 3
|
||||
Text = #1047#1072#1075#1088#1091#1079#1080#1090#1100' '#1089#1074#1086#1080' '#1085#1072#1089#1090#1088#1086#1081#1082#1080
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnImportSettingsClick
|
||||
end
|
||||
object btnExportSettings: TButton
|
||||
Position.X = 201.000000000000000000
|
||||
Position.Y = 351.000000000000000000
|
||||
Size.Width = 143.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1042#1099#1075#1088#1091#1079#1080#1090#1100' '#1085#1072#1089#1090#1088#1086#1081#1082#1080
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnExportSettingsClick
|
||||
end
|
||||
object btnMaster: TButton
|
||||
Position.X = 369.000000000000000000
|
||||
Position.Y = 321.000000000000000000
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 7
|
||||
Text = #1047#1072#1087#1091#1089#1090#1080#1090#1100' '#1084#1072#1089#1090#1077#1088' '#1085#1072#1089#1090#1088#1086#1081#1082#1080
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnMasterClick
|
||||
end
|
||||
object SaveDialog1: TSaveDialog
|
||||
Left = 513
|
||||
Top = 272
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Left = 312
|
||||
Top = 184
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,393 @@
|
||||
unit fSettings;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants, uQ,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
ShellAPI, System.IOUtils, uDataBase,
|
||||
FMX.Controls.Presentation, FMX.Edit, uTWAuth, uRecords, uAPIDA, uShowText,
|
||||
json, uWSDA, fLog;
|
||||
|
||||
type
|
||||
TfrSettings = class(TFrame)
|
||||
GroupBox3: TGroupBox;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label22: TLabel;
|
||||
edtBotName: TEdit;
|
||||
edtBotToken: TEdit;
|
||||
edtChannel: TEdit;
|
||||
btnGetToken: TButton;
|
||||
edtBotClientID: TEdit;
|
||||
btnGetClientID: TButton;
|
||||
btnOpenStream: TButton;
|
||||
btnGetTokenStreamer: TButton;
|
||||
edtBotTokenStreamer: TEdit;
|
||||
Label53: TLabel;
|
||||
GroupBox22: TGroupBox;
|
||||
btnDAGetCode: TButton;
|
||||
Label63: TLabel;
|
||||
edtDAClientID: TEdit;
|
||||
Label64: TLabel;
|
||||
edtDAClientSecret: TEdit;
|
||||
Label65: TLabel;
|
||||
edtDARedirectURL: TEdit;
|
||||
edtDACode: TEdit;
|
||||
Label66: TLabel;
|
||||
btnDAStart: TButton;
|
||||
btnGetDADef: TButton;
|
||||
cbDAAutoLogin: TCheckBox;
|
||||
cbTTVAutoLogin: TCheckBox;
|
||||
btnOpenRomaning: TButton;
|
||||
btnImportSettings: TButton;
|
||||
btnExportSettings: TButton;
|
||||
btnMaster: TButton;
|
||||
SaveDialog1: TSaveDialog;
|
||||
OpenDialog1: TOpenDialog;
|
||||
procedure btnGetTokenClick(Sender: TObject);
|
||||
procedure btnGetTokenStreamerClick(Sender: TObject);
|
||||
procedure btnOpenStreamClick(Sender: TObject);
|
||||
procedure btnDAGetCodeClick(Sender: TObject);
|
||||
procedure btnDAStartClick(Sender: TObject);
|
||||
procedure btnOpenRomaningClick(Sender: TObject);
|
||||
procedure btnImportSettingsClick(Sender: TObject);
|
||||
procedure btnExportSettingsClick(Sender: TObject);
|
||||
procedure btnMasterClick(Sender: TObject);
|
||||
procedure edtChannelExit(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
FAPIClient: TAPIClient;
|
||||
forbot: boolean;
|
||||
|
||||
procedure OnTTWToken(txt: string);
|
||||
procedure OnTokenDA(txt: string);
|
||||
procedure HandleWSStatus(AStatusText: string; AStatusCode: integer);
|
||||
procedure HandleWSDonate(aNick, aMessage, aSum: string);
|
||||
public
|
||||
{ Public declarations }
|
||||
FWSClient: TWSClient;
|
||||
destructor Destroy; override;
|
||||
procedure init();
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
procedure TfrSettings.btnDAGetCodeClick(Sender: TObject);
|
||||
var
|
||||
twa: TTTWAuth;
|
||||
Url: string;
|
||||
begin
|
||||
if (edtDAClientSecret.text = '') or (edtDAClientID.text = '') or
|
||||
(edtDARedirectURL.text = '') then
|
||||
exit;
|
||||
|
||||
Url := 'https://www.donationalerts.com/oauth/authorize?client_id=' +
|
||||
edtDAClientID.text +
|
||||
'&redirect_uri=http://localhost/da&response_type=code&scope=oauth-user-show+oauth-donation-subscribe';
|
||||
twa := TTTWAuth.Create;
|
||||
twa.OnToken := OnTokenDA;
|
||||
twa.StartServer(Url);
|
||||
// ttw_Auth áóäåò îñâîáîæäåí àâòîìàòè÷åñêè ïîñëå ïîëó÷åíèÿ òîêåíà (ñì. uTWAuth)
|
||||
end;
|
||||
|
||||
procedure TfrSettings.OnTokenDA(txt: string);
|
||||
begin
|
||||
edtDACode.text := txt;
|
||||
if cbDAAutoLogin.IsChecked then
|
||||
begin
|
||||
btnDAStartClick(self);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrSettings.btnDAStartClick(Sender: TObject);
|
||||
var
|
||||
UserInfo: TJSONObject;
|
||||
Data: TJSONObject;
|
||||
begin
|
||||
if btnDAStart.text = 'Ïîäêëþ÷èòüñÿ' then
|
||||
begin
|
||||
UserInfo := nil;
|
||||
try
|
||||
try
|
||||
if not Assigned(FAPIClient) then
|
||||
init;
|
||||
|
||||
if FAPIClient.Token = '' then
|
||||
begin
|
||||
try
|
||||
FAPIClient.Token := FAPIClient.GetAccessToken(
|
||||
edtDAClientID.text,
|
||||
edtDAClientSecret.text,
|
||||
edtDARedirectURL.text,
|
||||
edtDACode.text
|
||||
);
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
TTW_Bot.toLog('fSettings', 'btnDAStartClick', 'Îøèáêà ïîëó÷åíèÿ òîêåíà: ' + E.Message,2);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
FWSClient.APIClient := FAPIClient;
|
||||
|
||||
try
|
||||
UserInfo := FAPIClient.GetUserInfo;
|
||||
Data := UserInfo.GetValue<TJSONObject>('data');
|
||||
FWSClient.Wsstoken := Data.GetValue<string>('socket_connection_token');
|
||||
FWSClient.WSID := Data.GetValue<string>('id');
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
TTW_Bot.toLog( 'fSettings','btnDAStartClick', 'Îøèáêà ïîëó÷åíèÿ UserInfo: ' + E.Message,2);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
try
|
||||
FWSClient.Connect('wss://centrifugo.donationalerts.com/connection/websocket');
|
||||
FWSClient.Send(Format(
|
||||
'{"params":{"token":"%s"},"id":1}',
|
||||
[FWSClient.Wsstoken]
|
||||
));
|
||||
except
|
||||
on E: Exception do
|
||||
TTW_Bot.toLog( 'fSettings','btnDAStartClick', 'Îøèáêà ïîäêëþ÷åíèÿ ê WebSocket: ' + E.Message,2);
|
||||
end;
|
||||
|
||||
except
|
||||
on E: Exception do
|
||||
TTW_Bot.toLog('fSettings', 'btnDAStartClick', 'Íåèçâåñòíàÿ îøèáêà: ' + E.Message,2);
|
||||
end;
|
||||
finally
|
||||
UserInfo.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
try
|
||||
edtDACode.Text:='';
|
||||
if Assigned(FWSClient) then
|
||||
begin
|
||||
try
|
||||
FWSClient.Disconnect;
|
||||
except
|
||||
on E: Exception do
|
||||
TTW_Bot.toLog( 'fSettings', 'btnDAStartClick', 'Îøèáêà ïðè îòêëþ÷åíèè WS: ' + E.Message,2);
|
||||
end;
|
||||
FreeAndNil(FWSClient);
|
||||
end;
|
||||
|
||||
FreeAndNil(FAPIClient);
|
||||
finally
|
||||
btnDAStart.ImageIndex := 18;
|
||||
btnDAStart.text := 'Ïîäêëþ÷èòüñÿ';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrSettings.btnExportSettingsClick(Sender: TObject);
|
||||
var
|
||||
DestinationFile: string;
|
||||
begin
|
||||
SaveDialog1.FileName := TPath.GetFileName(myConst.DBPath);
|
||||
if SaveDialog1.Execute then
|
||||
begin
|
||||
DestinationFile := SaveDialog1.FileName;
|
||||
TFile.Copy(myConst.DBPath, DestinationFile, True);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrSettings.btnGetTokenClick(Sender: TObject);
|
||||
var
|
||||
s: string;
|
||||
sope: string;
|
||||
ttw_Auth: TTTWAuth;
|
||||
begin
|
||||
ttw_Auth := TTTWAuth.Create;
|
||||
ttw_Auth.OnToken := OnTTWToken;
|
||||
// ttw_Auth áóäåò îñâîáîæäåí àâòîìàòè÷åñêè ïîñëå ïîëó÷åíèÿ òîêåíà (ñì. uTWAuth)
|
||||
sope := 'moderator:manage:shoutouts' + '+moderator:manage:announcements' +
|
||||
'+moderator:manage:banned_users' + '+moderator:manage:warnings' +
|
||||
'+moderator:read:followers' + '+channel:manage:raids' +
|
||||
'+channel:manage:moderators' + '+channel:read:redemptions' + '+chat:read' +
|
||||
'+chat:edit+user:read:emotes';
|
||||
sope := StringReplace(sope, ':', '%3A', [rfReplaceAll]);
|
||||
|
||||
s := 'https://id.twitch.tv/oauth2/authorize?client_id=' + edtBotClientID.text
|
||||
+ '&redirect_uri=http://localhost&response_type=token&' + 'scope=' + sope;
|
||||
ttw_Auth.StartServer('');
|
||||
forbot := True;
|
||||
fShowText.Memo1.Lines.text := s;
|
||||
fShowText.Show;
|
||||
fShowText.Memo1.WordWrap := True;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrSettings.btnGetTokenStreamerClick(Sender: TObject);
|
||||
var
|
||||
sope: string;
|
||||
ttw_Auth: TTTWAuth;
|
||||
begin
|
||||
ttw_Auth := TTTWAuth.Create;
|
||||
ttw_Auth.OnToken := OnTTWToken;
|
||||
sope := 'channel:read:redemptions' + '+channel:manage:vips' +
|
||||
'+moderator:read:followers' + '+channel:read:subscriptions' +
|
||||
'+channel:manage:moderators' + '+channel:manage:redemptions';
|
||||
sope := StringReplace(sope, ':', '%3A', [rfReplaceAll]);
|
||||
ttw_Auth.StartServer('https://id.twitch.tv/oauth2/authorize?client_id=' +
|
||||
edtBotClientID.text + '&redirect_uri=http://localhost&response_type=token&'
|
||||
+ 'scope=' + sope);
|
||||
forbot := false;
|
||||
end;
|
||||
|
||||
procedure TfrSettings.btnImportSettingsClick(Sender: TObject);
|
||||
var
|
||||
SourceFile, DestinationDir, DestinationFile: string;
|
||||
begin
|
||||
if OpenDialog1.Execute then
|
||||
begin
|
||||
DB.Free;
|
||||
SourceFile := OpenDialog1.FileName;
|
||||
DestinationDir := myConst.DBPath;
|
||||
DestinationFile := myConst.DBPath;
|
||||
TFile.Copy(SourceFile, DestinationFile, True);
|
||||
DB := TSettingsDatabase.Create(myConst.DBPath);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrSettings.btnMasterClick(Sender: TObject);
|
||||
var
|
||||
qf: tfrmq;
|
||||
|
||||
begin
|
||||
qf := tfrmq.Create(nil);
|
||||
try
|
||||
qf.SetLabelText('Ââåäèòå íèê àêêàóíòà îò êîòîðîãî áóäåò ïèñàòü áîò:');
|
||||
if qf.ShowModal = mrOk then
|
||||
edtBotName.text := qf.GetEditText;
|
||||
qf.SetLabelText('Ââåäèòå íèê ñòðèìåðà ãäå áóäåò ðàáîòàòü áîò:');
|
||||
if qf.ShowModal = mrOk then
|
||||
edtChannel.text := qf.GetEditText;
|
||||
if btnGetClientID.Visible then
|
||||
begin
|
||||
edtBotClientID.text := appconst.TTV_ClientID;
|
||||
showmessage('Ïîÿâèòñÿ îêíî, òàì áóäåò ññûëêà. ' + #13 +
|
||||
'Ñêîïèðóé åå è îòêðîé â áðàóçåðå ãäå àâòîðèçîâàí áîò. ' + #13 +
|
||||
'Åñëè ïîíÿë - æìè ÎÊ');
|
||||
btnGetTokenClick(self);
|
||||
showmessage
|
||||
('Êîãäà ññûëêà ïðîïàäåò æìè "Ïîëó÷èòü Token" îêîëî ïîëÿ "API Token Ñòðèìåðà". '
|
||||
+ #13 + 'Åñëè ïîíÿë - æìè ÎÊ');
|
||||
end
|
||||
else
|
||||
begin
|
||||
showmessage('Íåò ôàéëà êëþ÷åé! ' + #13 +
|
||||
'Ââåäèòå ClientID âðó÷íóþ è ïðîäîëæèòå íàñòðîéêó áåç ìàñòåðà!');
|
||||
end;
|
||||
|
||||
finally
|
||||
qf.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrSettings.btnOpenRomaningClick(Sender: TObject);
|
||||
begin
|
||||
ShellExecute(0, 'open', pwidechar(ExtractFilePath(myConst.DBPath)),
|
||||
nil, nil, 1);
|
||||
end;
|
||||
|
||||
procedure TfrSettings.btnOpenStreamClick(Sender: TObject);
|
||||
begin
|
||||
ShellExecute(0, 'open', pwidechar('https://www.twitch.tv/' + edtChannel.text),
|
||||
nil, nil, 1);
|
||||
end;
|
||||
|
||||
destructor TfrSettings.Destroy;
|
||||
begin
|
||||
if Assigned(FWSClient) then
|
||||
begin
|
||||
try
|
||||
FWSClient.Disconnect; // åñëè åñòü ìåòîä îòêëþ÷åíèÿ
|
||||
except end;
|
||||
FreeAndNil(FWSClient);
|
||||
end;
|
||||
FreeAndNil(FAPIClient);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TfrSettings.edtChannelExit(Sender: TObject);
|
||||
begin
|
||||
if Sender is TEdit then
|
||||
DB.WriteSetting(TEdit(Sender).Name, TEdit(Sender).text);
|
||||
if Sender is TCheckBox then
|
||||
if TCheckBox(Sender).IsChecked then
|
||||
DB.WriteSetting(TCheckBox(Sender).Name, 'True')
|
||||
else
|
||||
DB.WriteSetting(TCheckBox(Sender).Name, 'False');
|
||||
end;
|
||||
|
||||
procedure TfrSettings.init;
|
||||
begin
|
||||
if not Assigned(FAPIClient) then
|
||||
FAPIClient := TAPIClient.Create;
|
||||
if not Assigned(FWSClient) then
|
||||
begin
|
||||
FWSClient := TWSClient.Create;
|
||||
FWSClient.OnStatus := HandleWSStatus;
|
||||
FWSClient.OnDonate := HandleWSDonate;
|
||||
FWSClient.OnLog := TTW_Bot.toLog;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrSettings.OnTTWToken(txt: string);
|
||||
begin
|
||||
fShowText.Close;
|
||||
if forbot then
|
||||
begin
|
||||
edtBotToken.text := txt;
|
||||
DB.WriteSetting('edtBotToken', txt);
|
||||
end
|
||||
else
|
||||
begin
|
||||
edtBotTokenStreamer.text := txt;
|
||||
DB.WriteSetting('edtBotTokenStreamer', txt);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrSettings.HandleWSDonate(aNick, aMessage, aSum: string);
|
||||
begin
|
||||
// fDonats.OnDADonate(aNick, aMessage, aSum);
|
||||
end;
|
||||
|
||||
procedure TfrSettings.HandleWSStatus(AStatusText: string; AStatusCode: integer);
|
||||
begin
|
||||
TTW_Bot.tolog('fSettings','HandleWSStatus',AStatusText,3);
|
||||
TTW_Bot.Label8.text := AStatusText;
|
||||
case AStatusCode of
|
||||
0:
|
||||
begin
|
||||
btnDAStart.ImageIndex := 1;
|
||||
btnDAStart.text := 'Îòêëþ÷èòüñÿ';
|
||||
end;
|
||||
else
|
||||
begin
|
||||
btnDAStart.ImageIndex := 18;
|
||||
btnDAStart.text := 'Ïîäêëþ÷èòüñÿ';
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,90 @@
|
||||
object frSimpleGrid: TfrSimpleGrid
|
||||
Size.Width = 339.000000000000000000
|
||||
Size.Height = 223.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object sg: TStringGrid
|
||||
Align = Top
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Size.Width = 339.000000000000000000
|
||||
Size.Height = 149.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 43
|
||||
RowCount = 0
|
||||
Options = [ColumnResize, ColumnMove, ColLines, RowLines, Tabs, Header, HeaderClick, AutoDisplacement]
|
||||
OnCellClick = sgCellClick
|
||||
Viewport.Width = 339.000000000000000000
|
||||
Viewport.Height = 149.000000000000000000
|
||||
object sgR1: TStringColumn
|
||||
Header = #1053#1072#1079#1074#1072#1085#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
end
|
||||
object sgR2: TStringColumn
|
||||
Header = #1060#1072#1081#1083
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 220.000000000000000000
|
||||
end
|
||||
end
|
||||
object edtName: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 40
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 155.000000000000000000
|
||||
Size.Width = 106.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object edtFileName: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 41
|
||||
Position.X = 122.000000000000000000
|
||||
Position.Y = 155.000000000000000000
|
||||
Size.Width = 174.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnOpen: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
Position.X = 304.000000000000000000
|
||||
Position.Y = 157.000000000000000000
|
||||
Size.Width = 27.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 42
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnOpenClick
|
||||
end
|
||||
object btnAdd: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 185.000000000000000000
|
||||
TabOrder = 38
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnAddClick
|
||||
end
|
||||
object btnDel: TButton
|
||||
Position.X = 184.000000000000000000
|
||||
Position.Y = 185.000000000000000000
|
||||
Size.Width = 70.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 39
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnDelClick
|
||||
end
|
||||
object btnEdt: TButton
|
||||
Position.X = 96.000000000000000000
|
||||
Position.Y = 185.000000000000000000
|
||||
TabOrder = 46
|
||||
Text = #1048#1079#1084#1077#1085#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnEdtClick
|
||||
end
|
||||
object od: TOpenDialog
|
||||
Left = 152
|
||||
Top = 96
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,143 @@
|
||||
unit fSimpleGrid;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
System.Rtti, FMX.Grid.Style, FMX.Edit, FMX.Grid, FMX.Controls.Presentation,
|
||||
FMX.ScrollBox, uRecords;
|
||||
|
||||
type
|
||||
TfrSimpleGrid = class(TFrame)
|
||||
sg: TStringGrid;
|
||||
sgR2: TStringColumn;
|
||||
sgR1: TStringColumn;
|
||||
edtName: TEdit;
|
||||
edtFileName: TEdit;
|
||||
btnOpen: TButton;
|
||||
btnAdd: TButton;
|
||||
btnDel: TButton;
|
||||
btnEdt: TButton;
|
||||
od: TOpenDialog;
|
||||
procedure btnAddClick(Sender: TObject);
|
||||
procedure btnDelClick(Sender: TObject);
|
||||
procedure sgCellClick(const Column: TColumn; const Row: Integer);
|
||||
procedure btnOpenClick(Sender: TObject);
|
||||
procedure btnEdtClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
FMyRecord: TArray<TListCommands>;
|
||||
FTableName: string;
|
||||
procedure SetMyArray(const Value: TArray<TListCommands>);
|
||||
procedure SetTableName(const Value: string);
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
procedure UpdateGrid;
|
||||
published
|
||||
property ObjectRecord: TArray<TListCommands> read FMyRecord
|
||||
write SetMyArray;
|
||||
property TableName: string read FTableName write SetTableName;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses ugeneral;
|
||||
|
||||
{ TfrSimpleGrid }
|
||||
|
||||
procedure TfrSimpleGrid.btnAddClick(Sender: TObject);
|
||||
var
|
||||
NewRec: TListCommands;
|
||||
begin
|
||||
if (edtName.Text = '') or (edtFileName.Text = '') then
|
||||
exit;
|
||||
NewRec.R1 := edtName.Text;
|
||||
NewRec.R2 := edtFileName.Text;
|
||||
SetLength(FMyRecord, Length(FMyRecord) + 1);
|
||||
FMyRecord[High(FMyRecord)] := NewRec;
|
||||
DB.SaveRecordArray<TListCommands>(FTableName, FMyRecord);
|
||||
edtName.Text := '';
|
||||
edtFileName.Text := '';
|
||||
UpdateGrid;
|
||||
end;
|
||||
|
||||
procedure TfrSimpleGrid.btnDelClick(Sender: TObject);
|
||||
var
|
||||
i, RowIndex: Integer;
|
||||
begin
|
||||
RowIndex := sg.Row;
|
||||
if (RowIndex < 0) or (RowIndex > High(FMyRecord)) then
|
||||
exit;
|
||||
for i := RowIndex to High(FMyRecord) - 1 do
|
||||
FMyRecord[i] := FMyRecord[i + 1];
|
||||
SetLength(FMyRecord, Length(FMyRecord) - 1);
|
||||
DB.SaveRecordArray<TListCommands>(FTableName, FMyRecord);
|
||||
UpdateGrid;
|
||||
end;
|
||||
|
||||
procedure TfrSimpleGrid.btnEdtClick(Sender: TObject);
|
||||
var RowIndex:integer;
|
||||
begin
|
||||
if (edtName.Text = '') or (edtFileName.Text = '') then
|
||||
exit;
|
||||
RowIndex := sg.Row;
|
||||
if (RowIndex < 0) or (RowIndex > High(FMyRecord)) then
|
||||
exit;
|
||||
FMyRecord[RowIndex].R1 := edtName.Text;
|
||||
FMyRecord[RowIndex].R2 := edtFileName.Text;
|
||||
DB.SaveRecordArray<TListCommands>(FTableName, FMyRecord);
|
||||
edtName.Text := '';
|
||||
edtFileName.Text := '';
|
||||
UpdateGrid;
|
||||
end;
|
||||
|
||||
procedure TfrSimpleGrid.btnOpenClick(Sender: TObject);
|
||||
var
|
||||
i, RowIndex: Integer;
|
||||
begin
|
||||
if od.Execute then
|
||||
edtFileName.Text := od.FileName;
|
||||
end;
|
||||
|
||||
procedure TfrSimpleGrid.SetMyArray(const Value: TArray<TListCommands>);
|
||||
begin
|
||||
FMyRecord := Value;
|
||||
end;
|
||||
|
||||
procedure TfrSimpleGrid.SetTableName(const Value: string);
|
||||
begin
|
||||
FTableName := Value;
|
||||
end;
|
||||
|
||||
procedure TfrSimpleGrid.sgCellClick(const Column: TColumn; const Row: Integer);
|
||||
begin
|
||||
edtName.Text := sg.Cells[0, Row];
|
||||
edtFileName.Text := sg.Cells[1, Row];
|
||||
end;
|
||||
|
||||
procedure TfrSimpleGrid.UpdateGrid;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
sg.BeginUpdate;
|
||||
try
|
||||
sg.RowCount := 0; // Ñáðàñûâàåì ñòðîêè (îñòàâëÿåì òîëüêî çàãîëîâêè)
|
||||
|
||||
for i := 0 to High(FMyRecord) do
|
||||
begin
|
||||
sg.RowCount := i + 1;
|
||||
sg.Cells[0, i] := FMyRecord[i].R1;
|
||||
sg.Cells[1, i] := FMyRecord[i].R2;
|
||||
end;
|
||||
finally
|
||||
sg.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,71 @@
|
||||
object frTTS: TfrTTS
|
||||
Size.Width = 314.000000000000000000
|
||||
Size.Height = 214.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Text = #1043#1086#1083#1086#1089
|
||||
TabOrder = 0
|
||||
end
|
||||
object cbVoices: TComboBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 161.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnUpdateVoices: TButton
|
||||
Position.X = 177.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 128.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 2
|
||||
Text = #1054#1073#1085#1086#1074#1080#1090#1100' '#1075#1086#1083#1086#1089#1072
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnUpdateVoicesClick
|
||||
end
|
||||
object Label2: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
Text = #1058#1077#1082#1089#1090' '#1076#1083#1103' '#1086#1079#1074#1091#1095#1082#1080
|
||||
TabOrder = 3
|
||||
end
|
||||
object edtText: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 4
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 161.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 118.000000000000000000
|
||||
Text = #1048#1089#1090#1086#1095#1085#1080#1082
|
||||
TabOrder = 5
|
||||
end
|
||||
object cbOutput: TComboBox
|
||||
Items.Strings = (
|
||||
#1069#1090#1086' '#1087#1088#1080#1083#1086#1078#1077#1085#1080#1077
|
||||
'SilentPlayer')
|
||||
ItemIndex = 0
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 143.000000000000000000
|
||||
Size.Width = 161.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 6
|
||||
end
|
||||
object btnSend: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 173.000000000000000000
|
||||
TabOrder = 7
|
||||
Text = #1054#1079#1074#1091#1095#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnSendClick
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
unit fTTS;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants, shellapi,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Edit, FMX.ListBox, FMX.Controls.Presentation, uTTS, bass_simple;
|
||||
|
||||
type
|
||||
TfrTTS = class(TFrame)
|
||||
Label1: TLabel;
|
||||
cbVoices: TComboBox;
|
||||
btnUpdateVoices: TButton;
|
||||
Label2: TLabel;
|
||||
edtText: TEdit;
|
||||
Label3: TLabel;
|
||||
btnSend: TButton;
|
||||
cbOutput: TComboBox;
|
||||
procedure btnUpdateVoicesClick(Sender: TObject);
|
||||
procedure btnSendClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
tts: TTTS;
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
uses ugeneral;
|
||||
|
||||
procedure TfrTTS.btnSendClick(Sender: TObject);
|
||||
var
|
||||
s, s1: string;
|
||||
|
||||
begin
|
||||
case cbOutput.ItemIndex of
|
||||
0:
|
||||
begin // this
|
||||
s := ExtractFilePath(ParamStr(0)) + 'piper\piper.exe';
|
||||
s1 := ExtractFilePath(ParamStr(0)) + 'piper\voices';
|
||||
if cbVoices.ItemIndex = -1 then
|
||||
exit;
|
||||
tts := TTTS.Create(s, s1);
|
||||
try
|
||||
tts.SetModel(cbVoices.Text);
|
||||
tts.TextToSpeech(edtText.Text, true);
|
||||
finally
|
||||
tts.Free;
|
||||
end;
|
||||
end;
|
||||
1:
|
||||
begin // SilentPlay
|
||||
ShellExecute(0, 'open', PChar(myConst.SilentPlay),
|
||||
PChar(Format('%s %s "%s"', ['2', cbVoices.Text, edtText.Text])), nil, 0);
|
||||
end;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrTTS.btnUpdateVoicesClick(Sender: TObject);
|
||||
var
|
||||
s, s1: string;
|
||||
List: TStringList;
|
||||
begin
|
||||
s := ExtractFilePath(ParamStr(0)) + 'piper\piper.exe';
|
||||
s1 := ExtractFilePath(ParamStr(0)) + 'piper\voices';
|
||||
|
||||
tts := TTTS.Create(s, s1);
|
||||
List := TStringList.Create;
|
||||
try
|
||||
cbVoices.Items.Clear;
|
||||
List := tts.GetModelsList;
|
||||
cbVoices.Items.Assign(List);
|
||||
finally
|
||||
tts.Free;
|
||||
List.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user