Добавил режим редактирования интеграций, но нужно в форму передать режим редактирования что бы не создавать, а изменять
This commit is contained in:
@@ -34,13 +34,15 @@ type
|
||||
|
||||
procedure UpdateGridFromArray;
|
||||
procedure AddChat(newRecord: TOBSChat);
|
||||
procedure DelChat(aPort: integer);
|
||||
procedure EdtChat(aPort: Integer);
|
||||
procedure DelChat(aPort: Integer);
|
||||
|
||||
procedure AddNotify(newRecord: TOBSNotify);
|
||||
procedure DelNotify(aPort: integer);
|
||||
procedure EdtNotify(aPort: Integer);
|
||||
procedure DelNotify(aPort: Integer);
|
||||
|
||||
procedure AddKandinsky(newRecord: TOBSKandinsky);
|
||||
procedure DelKandinsky(aPort: integer);
|
||||
procedure DelKandinsky(aPort: Integer);
|
||||
|
||||
end;
|
||||
|
||||
@@ -78,29 +80,29 @@ end;
|
||||
|
||||
procedure TfrOBS.btnCreateOBSChatClick(Sender: TObject);
|
||||
var
|
||||
dport, i: integer;
|
||||
dport, i: Integer;
|
||||
begin
|
||||
dport := 8080;
|
||||
for I := 0 to sgWebChats.RowCount - 1 do
|
||||
for i := 0 to sgWebChats.RowCount - 1 do
|
||||
begin
|
||||
if strtoint(sgWebChats.Cells[0, I]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, I]) + 1;
|
||||
if strtoint(sgWebChats.Cells[0, i]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
fCreateChat.sbWebServerPort.Value:=dport;
|
||||
fCreateChat.sbWebServerPort.Value := dport;
|
||||
fCreateChat.Show;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.btnCreateOBSKandinskyClick(Sender: TObject);
|
||||
var
|
||||
dport: integer;
|
||||
I: integer;
|
||||
dport: Integer;
|
||||
i: Integer;
|
||||
rk: TOBSKandinsky;
|
||||
begin
|
||||
dport := 8080;
|
||||
for I := 0 to sgWebChats.RowCount - 1 do
|
||||
for i := 0 to sgWebChats.RowCount - 1 do
|
||||
begin
|
||||
if strtoint(sgWebChats.Cells[0, I]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, I]) + 1;
|
||||
if strtoint(sgWebChats.Cells[0, i]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
rk.port := dport;
|
||||
AddKandinsky(rk);
|
||||
@@ -109,15 +111,15 @@ end;
|
||||
|
||||
procedure TfrOBS.btnCreateOBSNotifyClick(Sender: TObject);
|
||||
var
|
||||
dport, i: integer;
|
||||
dport, i: Integer;
|
||||
begin
|
||||
dport := 8080;
|
||||
for I := 0 to sgWebChats.RowCount - 1 do
|
||||
for i := 0 to sgWebChats.RowCount - 1 do
|
||||
begin
|
||||
if strtoint(sgWebChats.Cells[0, I]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, I]) + 1;
|
||||
if strtoint(sgWebChats.Cells[0, i]) >= dport then
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
fCreateNotify.sbWebServerPort.Value:=dport;
|
||||
fCreateNotify.sbWebServerPort.Value := dport;
|
||||
fCreateNotify.Show;
|
||||
end;
|
||||
|
||||
@@ -137,17 +139,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.DelChat(aPort: integer);
|
||||
procedure TfrOBS.DelChat(aPort: Integer);
|
||||
var
|
||||
I, j: integer;
|
||||
i, j: Integer;
|
||||
begin
|
||||
// Èùåì â îáðàòíîì ïîðÿäêå äëÿ áåçîïàñíîãî óäàëåíèÿ
|
||||
for I := High(listChats) downto 0 do
|
||||
for i := High(listChats) downto 0 do
|
||||
begin
|
||||
if listChats[I].port = aPort then
|
||||
if listChats[i].port = aPort then
|
||||
begin
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for j := I to High(listChats) - 1 do
|
||||
for j := i to High(listChats) - 1 do
|
||||
listChats[j] := listChats[j + 1];
|
||||
// Óìåíüøàåì ðàçìåð ìàññèâà
|
||||
SetLength(listChats, Length(listChats) - 1);
|
||||
@@ -160,17 +162,17 @@ begin
|
||||
UpdateGridFromArray;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.DelKandinsky(aPort: integer);
|
||||
procedure TfrOBS.DelKandinsky(aPort: Integer);
|
||||
var
|
||||
I, j: integer;
|
||||
i, j: Integer;
|
||||
begin
|
||||
// Èùåì â îáðàòíîì ïîðÿäêå äëÿ áåçîïàñíîãî óäàëåíèÿ
|
||||
for I := High(listKandinsky) downto 0 do
|
||||
for i := High(listKandinsky) downto 0 do
|
||||
begin
|
||||
if listKandinsky[I].port = aPort then
|
||||
if listKandinsky[i].port = aPort then
|
||||
begin
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for j := I to High(listKandinsky) - 1 do
|
||||
for j := i to High(listKandinsky) - 1 do
|
||||
listKandinsky[j] := listKandinsky[j + 1];
|
||||
// Óìåíüøàåì ðàçìåð ìàññèâà
|
||||
SetLength(listKandinsky, Length(listKandinsky) - 1);
|
||||
@@ -182,17 +184,17 @@ begin
|
||||
db.SaveRecordArray<TOBSKandinsky>('listKandinsky', listKandinsky);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.DelNotify(aPort: integer);
|
||||
procedure TfrOBS.DelNotify(aPort: Integer);
|
||||
var
|
||||
I, j: integer;
|
||||
i, j: Integer;
|
||||
begin
|
||||
// Èùåì â îáðàòíîì ïîðÿäêå äëÿ áåçîïàñíîãî óäàëåíèÿ
|
||||
for I := High(listNotify) downto 0 do
|
||||
for i := High(listNotify) downto 0 do
|
||||
begin
|
||||
if listNotify[I].port = aPort then
|
||||
if listNotify[i].port = aPort then
|
||||
begin
|
||||
// Ñäâèãàåì ýëåìåíòû ìàññèâà
|
||||
for j := I to High(listNotify) - 1 do
|
||||
for j := i to High(listNotify) - 1 do
|
||||
listNotify[j] := listNotify[j + 1];
|
||||
// Óìåíüøàåì ðàçìåð ìàññèâà
|
||||
SetLength(listNotify, Length(listNotify) - 1);
|
||||
@@ -205,9 +207,102 @@ begin
|
||||
db.SaveRecordArray<TOBSNotify>('listNotify', listNotify);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.EdtChat(aPort: Integer);
|
||||
var
|
||||
rChat: TOBSChat;
|
||||
i: Integer;
|
||||
f: boolean;
|
||||
SavedColor: TAlphaColor;
|
||||
begin
|
||||
f := false;
|
||||
for i := 0 to High(listChats) - 1 do
|
||||
begin
|
||||
if listChats[i].port = aPort then
|
||||
begin
|
||||
rChat := listChats[i];
|
||||
f := true;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if not f then
|
||||
exit;
|
||||
if TryStrToUInt('$' + rChat.ColorBlock, Cardinal(SavedColor)) then
|
||||
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := SavedColor
|
||||
else
|
||||
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := TAlphaColorRec.Black;
|
||||
fCreateChat.frChatSettings1.ccbStyleBorderColor.ItemIndex :=
|
||||
rChat.ColorBorder;
|
||||
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;
|
||||
|
||||
procedure TfrOBS.EdtNotify(aPort: Integer);
|
||||
var
|
||||
OBSNotify: TOBSNotify;
|
||||
i: Integer;
|
||||
SavedColor: TAlphaColor;
|
||||
f: boolean;
|
||||
begin
|
||||
f := false;
|
||||
for i := 0 to High(listNotify) - 1 do
|
||||
begin
|
||||
if listNotify[i].port = aPort then
|
||||
begin
|
||||
OBSNotify := listNotify[i];
|
||||
f := true;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if not f then
|
||||
exit;
|
||||
with OBSNotify 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. 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;
|
||||
|
||||
procedure TfrOBS.UpdateGridFromArray;
|
||||
var
|
||||
I, rowIndex: integer;
|
||||
i, rowIndex: Integer;
|
||||
begin
|
||||
sgWebChats.BeginUpdate;
|
||||
try
|
||||
@@ -216,32 +311,35 @@ begin
|
||||
rowIndex := 0; // Îòäåëüíûé ñ÷åò÷èê äëÿ ñòðîê ñåòêè
|
||||
|
||||
// listChats
|
||||
for I := 0 to High(listChats) do
|
||||
for i := 0 to High(listChats) do
|
||||
begin
|
||||
sgWebChats.RowCount := rowIndex + 1;
|
||||
sgWebChats.Cells[0, rowIndex] := inttostr(listChats[I].port);
|
||||
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);
|
||||
sgWebChats.Cells[2, rowIndex] := 'http://127.0.0.1:' +
|
||||
inttostr(listChats[i].port);
|
||||
Inc(rowIndex); // Óâåëè÷èâàåì ñ÷åò÷èê ñòðîê
|
||||
end;
|
||||
|
||||
// listNotify
|
||||
for I := 0 to High(listNotify) do
|
||||
for i := 0 to High(listNotify) do
|
||||
begin
|
||||
sgWebChats.RowCount := rowIndex + 1;
|
||||
sgWebChats.Cells[0, rowIndex] := inttostr(listNotify[I].port);
|
||||
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);
|
||||
sgWebChats.Cells[2, rowIndex] := 'http://127.0.0.1:' +
|
||||
inttostr(listNotify[i].port);
|
||||
Inc(rowIndex); // Óâåëè÷èâàåì ñ÷åò÷èê ñòðîê
|
||||
end;
|
||||
|
||||
// listKandinsky
|
||||
for I := 0 to High(listKandinsky) do
|
||||
for i := 0 to High(listKandinsky) do
|
||||
begin
|
||||
sgWebChats.RowCount := rowIndex + 1;
|
||||
sgWebChats.Cells[0, rowIndex] := inttostr(listKandinsky[I].port);
|
||||
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);
|
||||
sgWebChats.Cells[2, rowIndex] := 'http://127.0.0.1:' +
|
||||
inttostr(listKandinsky[i].port);
|
||||
Inc(rowIndex); // Óâåëè÷èâàåì ñ÷åò÷èê ñòðîê
|
||||
end;
|
||||
finally
|
||||
|
||||
+5
-5
@@ -139,7 +139,7 @@ object fCreateNotify: TfCreateNotify
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 135.000000000000000000
|
||||
Text = #1057#1086#1073#1099#1090#1080#1077
|
||||
TabOrder = 60
|
||||
TabOrder = 59
|
||||
end
|
||||
object cbEventsType: TComboBox
|
||||
Items.Strings = (
|
||||
@@ -153,17 +153,17 @@ object fCreateNotify: TfCreateNotify
|
||||
Size.Width = 192.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 61
|
||||
TabOrder = 60
|
||||
end
|
||||
object Label3: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 190.000000000000000000
|
||||
Text = #1059#1089#1083#1086#1074#1080#1077' '#1089#1091#1084#1084#1099
|
||||
TabOrder = 62
|
||||
TabOrder = 61
|
||||
end
|
||||
object edtIF: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 63
|
||||
TabOrder = 62
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 215.000000000000000000
|
||||
Size.Width = 192.000000000000000000
|
||||
@@ -204,7 +204,7 @@ object fCreateNotify: TfCreateNotify
|
||||
object edtESTitle: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
Align = Top
|
||||
TabOrder = 38
|
||||
TabOrder = 37
|
||||
Text = '[NICK] '#1085#1072#1095#1072#1083' '#1086#1090#1089#1083#1077#1078#1080#1074#1072#1090#1100' '#1074#1072#1089
|
||||
Position.X = 10.000000000000000000
|
||||
Position.Y = 20.000000000000000000
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ begin
|
||||
TimeMess:=round(sbTimeMsg.Value);
|
||||
TypeEvent:=cbEventsType.ItemIndex;
|
||||
TypeEdit:=edtIF.Text;
|
||||
Port:=round(sbWebServerPort.Value);;
|
||||
Port:=round(sbWebServerPort.Value);
|
||||
end;
|
||||
|
||||
TTW_Bot.frOBS1.AddNotify(OBSNotify);
|
||||
|
||||
Reference in New Issue
Block a user