починил редактирование интеграций

This commit is contained in:
PC1\PTyTb
2025-08-08 00:57:37 +03:00
parent f125d23fcc
commit 7d9eaaac4e
4 changed files with 138 additions and 92 deletions
+47 -68
View File
@@ -35,11 +35,11 @@ type
procedure UpdateGridFromArray; procedure UpdateGridFromArray;
procedure AddChat(newRecord: TOBSChat); procedure AddChat(newRecord: TOBSChat);
procedure EdtChat(newRecord: TOBSChat); procedure EdtChat(newRecord: TOBSChat; oldPort: Integer);
procedure DelChat(aPort: Integer); procedure DelChat(aPort: Integer);
procedure AddNotify(newRecord: TOBSNotify); procedure AddNotify(newRecord: TOBSNotify);
procedure EdtNotify(newRecord: TOBSNotify); procedure EdtNotify(newRecord: TOBSNotify; oldPort: Integer);
procedure DelNotify(aPort: Integer); procedure DelNotify(aPort: Integer);
procedure AddKandinsky(newRecord: TOBSKandinsky); procedure AddKandinsky(newRecord: TOBSKandinsky);
@@ -90,7 +90,7 @@ begin
dport := strtoint(sgWebChats.Cells[0, i]) + 1; dport := strtoint(sgWebChats.Cells[0, i]) + 1;
end; end;
fCreateChat.sbWebServerPort.Value := dport; fCreateChat.sbWebServerPort.Value := dport;
fCreateChat.isEdit:=false; fCreateChat.isEdit := false;
fCreateChat.Show; fCreateChat.Show;
end; end;
@@ -122,7 +122,7 @@ begin
dport := strtoint(sgWebChats.Cells[0, i]) + 1; dport := strtoint(sgWebChats.Cells[0, i]) + 1;
end; end;
fCreateNotify.sbWebServerPort.Value := dport; fCreateNotify.sbWebServerPort.Value := dport;
fCreateNotify.isEdit:=false; fCreateNotify.isEdit := false;
fCreateNotify.Show; fCreateNotify.Show;
end; end;
@@ -175,7 +175,7 @@ begin
if listKandinsky[i].port = aPort then if listKandinsky[i].port = aPort then
begin begin
// Ñäâèãàåì ýëåìåíòû ìàññèâà // Ñäâèãàåì ýëåìåíòû ìàññèâà
for j := i to High(listKandinsky) - 1 do for j := i to High(listKandinsky) do
listKandinsky[j] := listKandinsky[j + 1]; listKandinsky[j] := listKandinsky[j + 1];
// Óìåíüøàåì ðàçìåð ìàññèâà // Óìåíüøàåì ðàçìåð ìàññèâà
SetLength(listKandinsky, Length(listKandinsky) - 1); SetLength(listKandinsky, Length(listKandinsky) - 1);
@@ -197,7 +197,7 @@ begin
if listNotify[i].port = aPort then if listNotify[i].port = aPort then
begin begin
// Ñäâèãàåì ýëåìåíòû ìàññèâà // Ñäâèãàåì ýëåìåíòû ìàññèâà
for j := i to High(listNotify) - 1 do for j := i to High(listNotify) do
listNotify[j] := listNotify[j + 1]; listNotify[j] := listNotify[j + 1];
// Óìåíüøàåì ðàçìåð ìàññèâà // Óìåíüøàåì ðàçìåð ìàññèâà
SetLength(listNotify, Length(listNotify) - 1); SetLength(listNotify, Length(listNotify) - 1);
@@ -210,85 +210,64 @@ begin
db.SaveRecordArray<TOBSNotify>('listNotify', listNotify); db.SaveRecordArray<TOBSNotify>('listNotify', listNotify);
end; end;
procedure TfrOBS.EdtChat(newRecord: TOBSChat); procedure TfrOBS.EdtChat(newRecord: TOBSChat; oldPort: Integer);
var var
rChat: TOBSChat; i: Integer;
SavedColor: TAlphaColor;
begin begin
rChat:= newRecord; for i := 0 to High(listChats) do
if listChats[i].port = oldPort then
if TryStrToUInt('$' + rChat.ColorBlock, Cardinal(SavedColor)) then begin
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := SavedColor listChats[i] := newRecord;
else UpdateGridFromArray;
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := TAlphaColorRec.Black; db.SaveRecordArray<TOBSChat>('listChats', listChats);
fCreateChat.frChatSettings1.ccbStyleBorderColor.ItemIndex := Break;
rChat.ColorBorder; end;
fCreateChat.frChatSettings1.ccbBColor.ItemIndex := rChat.ColorBackground;
fCreateChat.frChatSettings1.sbStyleBlockBorderSize.Value := rChat.SolidBorder;
fCreateChat.frChatSettings1.sbStyleBlockPadding.Value := rChat.Paddings;
fCreateChat.frFontSettings1.ccbFontColor.ItemIndex := rChat.ColorFont;
fCreateChat.frFontSettings1.sbFontSize.Value := rChat.SizeFont;
fCreateChat.frFontSettings1.cbFontStyleDefault.ItemIndex := rChat.StyleFont;
fCreateChat.sbTimeMsg.Value := rChat.TimeMess;
fCreateChat.sbMaxMsg.Value := rChat.MaxCountMess;
fCreateChat.sbWebServerPort.Value := rChat.port;
fCreateChat.Show;
end; end;
procedure TfrOBS.EdtNotify(newRecord: TOBSNotify); procedure TfrOBS.EdtNotify(newRecord: TOBSNotify; oldPort: Integer);
var var
OBSNotify: TOBSNotify; i: Integer;
SavedColor: TAlphaColor;
begin begin
OBSNotify:=newRecord; for i := 0 to High(listNotify) do
with OBSNotify do if listNotify[i].port = oldPort then
begin begin
fCreateNotify.edtESImage.Text := Picture; listNotify[i] := newRecord;
fCreateNotify.edtESSound.Text := Sound; UpdateGridFromArray;
db.SaveRecordArray<TOBSNotify>('listNotify', listNotify);
if TryStrToUInt('$' + ColorBlock, Cardinal(SavedColor)) then Break;
fCreateNotify.frColorSettings1.cpStyleBlockColor.Color := SavedColor
else
fCreateNotify.frColorSettings1.cpStyleBlockColor.Color :=
TAlphaColorRec.Black;
// fCreateNotify. ColorBlock:= GetColorFromColorPanel(frColorSettings1.cpStyleBlockColor.Color);
fCreateNotify.frColorSettings1.sbStyleBlockBorderSize.Value := SolidBorder;
fCreateNotify.frColorSettings1.sbStyleBlockPadding.Value := Paddings;
fCreateNotify.frColorSettings1.ccbStyleBorderColor.ItemIndex := ColorBorder;
fCreateNotify.frColorSettings1.ccbBColor.ItemIndex := ColorBackground;
fCreateNotify.edtESTitle.Text := HeaderText;
fCreateNotify.frFontSettings2.ccbFontColor.ItemIndex := HeaderColorFont;
fCreateNotify.frFontSettings2.sbFontSize.Value := HeaderSizeFont;
fCreateNotify.frFontSettings2.cbFontStyleDefault.ItemIndex :=
HeaderStyleFont;
fCreateNotify.edtESMessage.Text := MessText;
fCreateNotify.frFontSettings3.ccbFontColor.ItemIndex := MessColorFont;
fCreateNotify.frFontSettings3.sbFontSize.Value := MessSizeFont;
fCreateNotify.frFontSettings3.cbFontStyleDefault.ItemIndex := MessStyleFont;
fCreateNotify.sbTimeMsg.Value := TimeMess;
fCreateNotify.cbEventsType.ItemIndex := TypeEvent;
fCreateNotify.edtIF.Text := TypeEdit;
fCreateNotify.sbWebServerPort.Value := port;
end; end;
end; end;
procedure TfrOBS.sgWebChatsCellDblClick(const Column: TColumn; procedure TfrOBS.sgWebChatsCellDblClick(const Column: TColumn;
const Row: Integer); const Row: Integer);
var
myChatRec: TOBSChat;
myNotifyRec: TOBSNotify;
i: Integer;
begin begin
if sgWebChats.Cells[1,row] = 'Îïîâåùåíèå' then if sgWebChats.Cells[1, Row] = 'Îïîâåùåíèå' then
begin begin
fCreateNotify.isEdit:=true; 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; fCreateNotify.Show;
end; end;
if sgWebChats.Cells[1,row] = '×àò' then if sgWebChats.Cells[1, Row] = '×àò' then
begin begin
fCreateChat.isEdit:=true; 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; fCreateChat.Show;
end; end;
end; end;
+1 -1
View File
@@ -138,7 +138,7 @@ object fCreateChat: TfCreateChat
Size.Width = 112.000000000000000000 Size.Width = 112.000000000000000000
Size.Height = 19.000000000000000000 Size.Height = 19.000000000000000000
Size.PlatformDefault = False Size.PlatformDefault = False
TabOrder = 38 TabOrder = 37
Text = #1042#1077#1095#1085#1086 Text = #1042#1077#1095#1085#1086
end end
object sbWebServerPort: TSpinBox object sbWebServerPort: TSpinBox
+36 -9
View File
@@ -34,7 +34,9 @@ type
function GetColorFromColorPanel(aColor: TAlphaColor): string; function GetColorFromColorPanel(aColor: TAlphaColor): string;
public public
{ Public declarations } { Public declarations }
isEdit:boolean; isEdit: boolean;
oldPort: integer;
procedure setRecord(aRec: TOBSChat);
end; end;
var var
@@ -66,6 +68,28 @@ begin
result := Format('rgba(%d, %d, %d, %.2f)', [r, G, B, A], FS); result := Format('rgba(%d, %d, %d, %.2f)', [r, G, B, A], FS);
end; end;
procedure TfCreateChat.setRecord(aRec: TOBSChat);
var
SavedColor: TAlphaColor;
begin
if TryStrToUInt('$' + aRec.ColorBlock, Cardinal(SavedColor)) then
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := SavedColor
else
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := TAlphaColorRec.Black;
fCreateChat.frChatSettings1.ccbStyleBorderColor.ItemIndex := aRec.ColorBorder;
fCreateChat.frChatSettings1.ccbBColor.ItemIndex := aRec.ColorBackground;
fCreateChat.frChatSettings1.sbStyleBlockBorderSize.Value := aRec.SolidBorder;
fCreateChat.frChatSettings1.sbStyleBlockPadding.Value := aRec.Paddings;
fCreateChat.frFontSettings1.ccbFontColor.ItemIndex := aRec.ColorFont;
fCreateChat.frFontSettings1.sbFontSize.Value := aRec.SizeFont;
fCreateChat.frFontSettings1.cbFontStyleDefault.ItemIndex := aRec.StyleFont;
fCreateChat.sbTimeMsg.Value := aRec.TimeMess;
fCreateChat.sbMaxMsg.Value := aRec.MaxCountMess;
fCreateChat.sbWebServerPort.Value := aRec.port;
end;
procedure TfCreateChat.btnCreateWebChatClick(Sender: TObject); procedure TfCreateChat.btnCreateWebChatClick(Sender: TObject);
var var
OBSChat: TOBSChat; OBSChat: TOBSChat;
@@ -83,8 +107,11 @@ begin
OBSChat.MaxCountMess := round(sbMaxMsg.Value); OBSChat.MaxCountMess := round(sbMaxMsg.Value);
OBSChat.TimeMess := round(sbTimeMsg.Value); OBSChat.TimeMess := round(sbTimeMsg.Value);
OBSChat.Port := round(sbWebServerPort.Value); OBSChat.port := round(sbWebServerPort.Value);
if isEdit then
TTW_Bot.frOBS1.EdtChat(OBSChat, oldPort)
else
TTW_Bot.frOBS1.AddChat(OBSChat); TTW_Bot.frOBS1.AddChat(OBSChat);
close; close;
end; end;
@@ -93,7 +120,7 @@ procedure TfCreateChat.FormCreate(Sender: TObject);
procedure LoadFontList; procedure LoadFontList;
var var
SearchRec: TSearchRec; SearchRec: TSearchRec;
n: Integer; n: integer;
begin begin
if not DirectoryExists(myConst.fontsPath) then if not DirectoryExists(myConst.fontsPath) then
CreateDir(myConst.fontsPath); CreateDir(myConst.fontsPath);
@@ -117,7 +144,7 @@ procedure TfCreateChat.FormCreate(Sender: TObject);
procedure LoadChatOBSSettings; procedure LoadChatOBSSettings;
var var
I: Integer; I: integer;
c: TComponent; c: TComponent;
ColorStr: string; ColorStr: string;
SavedColor: TAlphaColor; SavedColor: TAlphaColor;
@@ -146,7 +173,7 @@ procedure TfCreateChat.FormCreate(Sender: TObject);
end; end;
begin begin
isEdit:=false; isEdit := false;
LoadChatOBSSettings; LoadChatOBSSettings;
LoadFontList; LoadFontList;
@@ -154,10 +181,10 @@ end;
procedure TfCreateChat.FormShow(Sender: TObject); procedure TfCreateChat.FormShow(Sender: TObject);
begin begin
if isEdit then if isEdit then
btnCreateWebChat.Text:='Èçìåíèòü ÷àò' btnCreateWebChat.text := 'Èçìåíèòü ÷àò'
else else
btnCreateWebChat.Text:='Ñîçäàòü ÷àò'; btnCreateWebChat.text := 'Ñîçäàòü ÷àò';
end; end;
end. end.
+45 -5
View File
@@ -44,6 +44,8 @@ type
public public
{ Public declarations } { Public declarations }
isEdit: boolean; isEdit: boolean;
oldPort: integer;
procedure setRecord(aRec: TOBSNotify);
end; end;
var var
@@ -75,6 +77,44 @@ begin
result := Format('rgba(%d, %d, %d, %.2f)', [r, G, B, A], FS); result := Format('rgba(%d, %d, %d, %.2f)', [r, G, B, A], FS);
end; end;
procedure TfCreateNotify.setRecord(aRec: TOBSNotify);
var
SavedColor: TAlphaColor;
begin
with aRec do
begin
fCreateNotify.edtESImage.Text := Picture;
fCreateNotify.edtESSound.Text := Sound;
if TryStrToUInt('$' + ColorBlock, Cardinal(SavedColor)) then
fCreateNotify.frColorSettings1.cpStyleBlockColor.Color := SavedColor
else
fCreateNotify.frColorSettings1.cpStyleBlockColor.Color :=
TAlphaColorRec.Black;
fCreateNotify.frColorSettings1.sbStyleBlockBorderSize.Value := SolidBorder;
fCreateNotify.frColorSettings1.sbStyleBlockPadding.Value := Paddings;
fCreateNotify.frColorSettings1.ccbStyleBorderColor.ItemIndex := ColorBorder;
fCreateNotify.frColorSettings1.ccbBColor.ItemIndex := ColorBackground;
fCreateNotify.edtESTitle.Text := HeaderText;
fCreateNotify.frFontSettings2.ccbFontColor.ItemIndex := HeaderColorFont;
fCreateNotify.frFontSettings2.sbFontSize.Value := HeaderSizeFont;
fCreateNotify.frFontSettings2.cbFontStyleDefault.ItemIndex :=
HeaderStyleFont;
fCreateNotify.edtESMessage.Text := MessText;
fCreateNotify.frFontSettings3.ccbFontColor.ItemIndex := MessColorFont;
fCreateNotify.frFontSettings3.sbFontSize.Value := MessSizeFont;
fCreateNotify.frFontSettings3.cbFontStyleDefault.ItemIndex := MessStyleFont;
fCreateNotify.sbTimeMsg.Value := TimeMess;
fCreateNotify.cbEventsType.ItemIndex := TypeEvent;
fCreateNotify.edtIF.Text := TypeEdit;
fCreateNotify.sbWebServerPort.Value := port;
end;
end;
procedure TfCreateNotify.btnCreateEventClick(Sender: TObject); procedure TfCreateNotify.btnCreateEventClick(Sender: TObject);
var var
OBSNotify: TOBSNotify; OBSNotify: TOBSNotify;
@@ -104,10 +144,10 @@ begin
TimeMess := round(sbTimeMsg.Value); TimeMess := round(sbTimeMsg.Value);
TypeEvent := cbEventsType.ItemIndex; TypeEvent := cbEventsType.ItemIndex;
TypeEdit := edtIF.Text; TypeEdit := edtIF.Text;
Port := round(sbWebServerPort.Value); port := round(sbWebServerPort.Value);
end; end;
if isEdit then if isEdit then
TTW_Bot.frOBS1.EdtNotify(OBSNotify) TTW_Bot.frOBS1.EdtNotify(OBSNotify, oldPort)
else else
TTW_Bot.frOBS1.AddNotify(OBSNotify); TTW_Bot.frOBS1.AddNotify(OBSNotify);
close; close;
@@ -115,7 +155,7 @@ end;
procedure TfCreateNotify.FormCreate(Sender: TObject); procedure TfCreateNotify.FormCreate(Sender: TObject);
var var
i: Integer; i: integer;
SavedColor: TAlphaColor; SavedColor: TAlphaColor;
c: TComponent; c: TComponent;
ColorStr: string; ColorStr: string;
@@ -254,11 +294,11 @@ procedure TfCreateNotify.FormShow(Sender: TObject);
begin begin
if isEdit then if isEdit then
begin begin
btnCreateEvent.Text:='Èçìåíèòü îïîâåùåíèå'; btnCreateEvent.Text := 'Èçìåíèòü îïîâåùåíèå';
end end
else else
begin begin
btnCreateEvent.Text:='Ñîçäàòü îïîâåùåíèå'; btnCreateEvent.Text := 'Ñîçäàòü îïîâåùåíèå';
end; end;
end; end;