добавил режим изменения
This commit is contained in:
@@ -13,6 +13,7 @@ object frOBS: TfrOBS
|
||||
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
|
||||
|
||||
@@ -24,6 +24,7 @@ type
|
||||
procedure btnCreateOBSKandinskyClick(Sender: TObject);
|
||||
procedure btnCreateOBSChatClick(Sender: TObject);
|
||||
procedure btnCreateOBSNotifyClick(Sender: TObject);
|
||||
procedure sgWebChatsCellDblClick(const Column: TColumn; const Row: Integer);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
@@ -34,11 +35,11 @@ type
|
||||
|
||||
procedure UpdateGridFromArray;
|
||||
procedure AddChat(newRecord: TOBSChat);
|
||||
procedure EdtChat(aPort: Integer);
|
||||
procedure EdtChat(newRecord: TOBSChat);
|
||||
procedure DelChat(aPort: Integer);
|
||||
|
||||
procedure AddNotify(newRecord: TOBSNotify);
|
||||
procedure EdtNotify(aPort: Integer);
|
||||
procedure EdtNotify(newRecord: TOBSNotify);
|
||||
procedure DelNotify(aPort: Integer);
|
||||
|
||||
procedure AddKandinsky(newRecord: TOBSKandinsky);
|
||||
@@ -89,6 +90,7 @@ begin
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
fCreateChat.sbWebServerPort.Value := dport;
|
||||
fCreateChat.isEdit:=false;
|
||||
fCreateChat.Show;
|
||||
end;
|
||||
|
||||
@@ -120,6 +122,7 @@ begin
|
||||
dport := strtoint(sgWebChats.Cells[0, i]) + 1;
|
||||
end;
|
||||
fCreateNotify.sbWebServerPort.Value := dport;
|
||||
fCreateNotify.isEdit:=false;
|
||||
fCreateNotify.Show;
|
||||
end;
|
||||
|
||||
@@ -207,25 +210,13 @@ begin
|
||||
db.SaveRecordArray<TOBSNotify>('listNotify', listNotify);
|
||||
end;
|
||||
|
||||
procedure TfrOBS.EdtChat(aPort: Integer);
|
||||
procedure TfrOBS.EdtChat(newRecord: TOBSChat);
|
||||
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;
|
||||
rChat:= newRecord;
|
||||
|
||||
if TryStrToUInt('$' + rChat.ColorBlock, Cardinal(SavedColor)) then
|
||||
fCreateChat.frChatSettings1.cpStyleBlockColor.Color := SavedColor
|
||||
else
|
||||
@@ -246,25 +237,12 @@ begin
|
||||
fCreateChat.Show;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.EdtNotify(aPort: Integer);
|
||||
procedure TfrOBS.EdtNotify(newRecord: TOBSNotify);
|
||||
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;
|
||||
OBSNotify:=newRecord;
|
||||
with OBSNotify do
|
||||
begin
|
||||
fCreateNotify.edtESImage.Text := Picture;
|
||||
@@ -300,6 +278,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.sgWebChatsCellDblClick(const Column: TColumn;
|
||||
const Row: Integer);
|
||||
begin
|
||||
if sgWebChats.Cells[1,row] = 'Îïîâåùåíèå' then
|
||||
begin
|
||||
fCreateNotify.isEdit:=true;
|
||||
fCreateNotify.Show;
|
||||
end;
|
||||
if sgWebChats.Cells[1,row] = '×àò' then
|
||||
begin
|
||||
fCreateChat.isEdit:=true;
|
||||
fCreateChat.Show;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrOBS.UpdateGridFromArray;
|
||||
var
|
||||
i, rowIndex: Integer;
|
||||
|
||||
+11
-4
@@ -8,6 +8,7 @@ object fCreateChat: TfCreateChat
|
||||
FormFactor.Height = 480
|
||||
FormFactor.Devices = [Desktop]
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
DesignerMasterStyle = 0
|
||||
object GroupBox1: TGroupBox
|
||||
Position.X = 8.000000000000000000
|
||||
@@ -24,7 +25,7 @@ object fCreateChat: TfCreateChat
|
||||
Size.Height = 251.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbStyleBorderColor: TColorComboBox
|
||||
TabOrder = 33
|
||||
TabOrder = 32
|
||||
end
|
||||
inherited Label40: TLabel
|
||||
TabOrder = 8
|
||||
@@ -42,7 +43,7 @@ object fCreateChat: TfCreateChat
|
||||
TabOrder = 37
|
||||
end
|
||||
inherited sbStyleBlockPadding: TSpinBox
|
||||
TabOrder = 46
|
||||
TabOrder = 45
|
||||
end
|
||||
inherited Label1: TLabel
|
||||
TabOrder = 34
|
||||
@@ -69,6 +70,9 @@ object fCreateChat: TfCreateChat
|
||||
Size.Width = 240.000000000000000000
|
||||
Size.Height = 125.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited Label41: TLabel
|
||||
TabOrder = 6
|
||||
end
|
||||
inherited Label46: TLabel
|
||||
TabOrder = 39
|
||||
end
|
||||
@@ -134,7 +138,7 @@ object fCreateChat: TfCreateChat
|
||||
Size.Width = 112.000000000000000000
|
||||
Size.Height = 19.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 37
|
||||
TabOrder = 38
|
||||
Text = #1042#1077#1095#1085#1086
|
||||
end
|
||||
object sbWebServerPort: TSpinBox
|
||||
@@ -168,8 +172,11 @@ object fCreateChat: TfCreateChat
|
||||
TextSettings.Trimming = None
|
||||
end
|
||||
object btnCreateWebChat: TButton
|
||||
Position.X = 721.000000000000000000
|
||||
Position.X = 704.000000000000000000
|
||||
Position.Y = 257.000000000000000000
|
||||
Size.Width = 97.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 4
|
||||
Text = #1057#1086#1079#1076#1072#1090#1100' '#1095#1072#1090
|
||||
TextSettings.Trimming = None
|
||||
|
||||
@@ -28,11 +28,13 @@ type
|
||||
btnCreateWebChat: TButton;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure btnCreateWebChatClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
function GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
public
|
||||
{ Public declarations }
|
||||
isEdit:boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
@@ -144,9 +146,18 @@ procedure TfCreateChat.FormCreate(Sender: TObject);
|
||||
end;
|
||||
|
||||
begin
|
||||
isEdit:=false;
|
||||
LoadChatOBSSettings;
|
||||
LoadFontList;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfCreateChat.FormShow(Sender: TObject);
|
||||
begin
|
||||
if isEdit then
|
||||
btnCreateWebChat.Text:='Èçìåíèòü ÷àò'
|
||||
else
|
||||
btnCreateWebChat.Text:='Ñîçäàòü ÷àò';
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
+16
-9
@@ -8,6 +8,7 @@ object fCreateNotify: TfCreateNotify
|
||||
FormFactor.Height = 480
|
||||
FormFactor.Devices = [Desktop]
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
DesignerMasterStyle = 0
|
||||
object btnESImageOpen: TButton
|
||||
Hint = #1050#1072#1088#1090#1080#1085#1082#1080'|*.jpg; *.jpeg; *.gif; *.webp'
|
||||
@@ -73,6 +74,12 @@ object fCreateNotify: TfCreateNotify
|
||||
Size.Width = 311.000000000000000000
|
||||
Size.Height = 258.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbStyleBorderColor: TColorComboBox
|
||||
TabOrder = 36
|
||||
end
|
||||
inherited Label42: TLabel
|
||||
TabOrder = 37
|
||||
end
|
||||
inherited Label44: TLabel
|
||||
TabOrder = 38
|
||||
end
|
||||
@@ -139,7 +146,7 @@ object fCreateNotify: TfCreateNotify
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 135.000000000000000000
|
||||
Text = #1057#1086#1073#1099#1090#1080#1077
|
||||
TabOrder = 59
|
||||
TabOrder = 51
|
||||
end
|
||||
object cbEventsType: TComboBox
|
||||
Items.Strings = (
|
||||
@@ -153,17 +160,17 @@ object fCreateNotify: TfCreateNotify
|
||||
Size.Width = 192.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 60
|
||||
TabOrder = 52
|
||||
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 = 61
|
||||
TabOrder = 53
|
||||
end
|
||||
object edtIF: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 62
|
||||
TabOrder = 54
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 215.000000000000000000
|
||||
Size.Width = 192.000000000000000000
|
||||
@@ -217,6 +224,9 @@ object fCreateNotify: TfCreateNotify
|
||||
Size.Width = 241.000000000000000000
|
||||
Size.Height = 115.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited Label41: TLabel
|
||||
TabOrder = 6
|
||||
end
|
||||
inherited Label46: TLabel
|
||||
TabOrder = 39
|
||||
end
|
||||
@@ -239,11 +249,8 @@ object fCreateNotify: TfCreateNotify
|
||||
Size.Width = 241.000000000000000000
|
||||
Size.Height = 115.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
inherited ccbFontColor: TColorComboBox
|
||||
TabOrder = 37
|
||||
end
|
||||
inherited Label49: TLabel
|
||||
TabOrder = 36
|
||||
inherited Label41: TLabel
|
||||
TabOrder = 6
|
||||
end
|
||||
inherited Label46: TLabel
|
||||
TabOrder = 38
|
||||
|
||||
+46
-28
@@ -3,10 +3,11 @@ unit uCreateNotify;
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants,
|
||||
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, fFontSettings,
|
||||
fColorSettings, FMX.StdCtrls, FMX.Edit, FMX.Controls.Presentation,
|
||||
FMX.ListBox, FMX.EditBox, FMX.SpinBox, FMX.Colors,uRecords;
|
||||
FMX.ListBox, FMX.EditBox, FMX.SpinBox, FMX.Colors, uRecords;
|
||||
|
||||
type
|
||||
TfCreateNotify = class(TForm)
|
||||
@@ -36,11 +37,13 @@ type
|
||||
edtESMessage: TEdit;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure btnCreateEventClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
function GetColorFromColorPanel(aColor: TAlphaColor): string;
|
||||
public
|
||||
{ Public declarations }
|
||||
isEdit: boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
@@ -78,31 +81,34 @@ var
|
||||
begin
|
||||
with OBSNotify do
|
||||
begin
|
||||
Picture:=edtESImage.Text;
|
||||
Sound:=edtESSound.Text;
|
||||
Picture := edtESImage.Text;
|
||||
Sound := edtESSound.Text;
|
||||
|
||||
ColorBlock:= GetColorFromColorPanel(frColorSettings1.cpStyleBlockColor.Color);
|
||||
SolidBorder:=round(frColorSettings1.sbStyleBlockBorderSize.Value);
|
||||
Paddings:=round(frColorSettings1.sbStyleBlockPadding.Value);
|
||||
ColorBorder:=frColorSettings1.ccbStyleBorderColor.ItemIndex;
|
||||
ColorBackground:=frColorSettings1.ccbBColor.ItemIndex;
|
||||
ColorBlock := GetColorFromColorPanel
|
||||
(frColorSettings1.cpStyleBlockColor.Color);
|
||||
SolidBorder := round(frColorSettings1.sbStyleBlockBorderSize.Value);
|
||||
Paddings := round(frColorSettings1.sbStyleBlockPadding.Value);
|
||||
ColorBorder := frColorSettings1.ccbStyleBorderColor.ItemIndex;
|
||||
ColorBackground := frColorSettings1.ccbBColor.ItemIndex;
|
||||
|
||||
HeaderText:=edtESTitle.text;
|
||||
HeaderColorFont:=frFontSettings2.ccbFontColor.ItemIndex;
|
||||
HeaderSizeFont:=round(frFontSettings2.sbFontSize.Value);
|
||||
HeaderStyleFont:=frFontSettings2.cbFontStyleDefault.ItemIndex;
|
||||
HeaderText := edtESTitle.Text;
|
||||
HeaderColorFont := frFontSettings2.ccbFontColor.ItemIndex;
|
||||
HeaderSizeFont := round(frFontSettings2.sbFontSize.Value);
|
||||
HeaderStyleFont := frFontSettings2.cbFontStyleDefault.ItemIndex;
|
||||
|
||||
MessText:=edtESMessage.text;
|
||||
MessColorFont:=frFontSettings3.ccbFontColor.ItemIndex;
|
||||
MessSizeFont:=round(frFontSettings3.sbFontSize.Value);
|
||||
MessStyleFont:=frFontSettings3.cbFontStyleDefault.ItemIndex;
|
||||
MessText := edtESMessage.Text;
|
||||
MessColorFont := frFontSettings3.ccbFontColor.ItemIndex;
|
||||
MessSizeFont := round(frFontSettings3.sbFontSize.Value);
|
||||
MessStyleFont := frFontSettings3.cbFontStyleDefault.ItemIndex;
|
||||
|
||||
TimeMess:=round(sbTimeMsg.Value);
|
||||
TypeEvent:=cbEventsType.ItemIndex;
|
||||
TypeEdit:=edtIF.Text;
|
||||
Port:=round(sbWebServerPort.Value);
|
||||
TimeMess := round(sbTimeMsg.Value);
|
||||
TypeEvent := cbEventsType.ItemIndex;
|
||||
TypeEdit := edtIF.Text;
|
||||
Port := round(sbWebServerPort.Value);
|
||||
end;
|
||||
|
||||
if isEdit then
|
||||
TTW_Bot.frOBS1.EdtNotify(OBSNotify)
|
||||
else
|
||||
TTW_Bot.frOBS1.AddNotify(OBSNotify);
|
||||
close;
|
||||
end;
|
||||
@@ -114,6 +120,7 @@ var
|
||||
c: TComponent;
|
||||
ColorStr: string;
|
||||
begin
|
||||
isEdit := false;
|
||||
for i := 0 to frColorSettings1.ComponentCount - 1 do
|
||||
begin
|
||||
c := frColorSettings1.Components[i];
|
||||
@@ -129,7 +136,7 @@ begin
|
||||
end;
|
||||
if c is TSpinBox then
|
||||
begin
|
||||
TSpinBox(c).text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
TSpinBox(c).Text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
end;
|
||||
if c is TColorPanel then
|
||||
begin
|
||||
@@ -142,7 +149,7 @@ begin
|
||||
if c is TEdit then
|
||||
begin
|
||||
if TEdit(c).Name <> 'edtPortServer' then
|
||||
TEdit(c).text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
TEdit(c).Text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
end;
|
||||
if c is TCheckBox then
|
||||
begin
|
||||
@@ -164,7 +171,7 @@ begin
|
||||
end;
|
||||
if c is TSpinBox then
|
||||
begin
|
||||
TSpinBox(c).text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
TSpinBox(c).Text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
end;
|
||||
if c is TColorPanel then
|
||||
begin
|
||||
@@ -177,7 +184,7 @@ begin
|
||||
if c is TEdit then
|
||||
begin
|
||||
if TEdit(c).Name <> 'edtPortServer' then
|
||||
TEdit(c).text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
TEdit(c).Text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
end;
|
||||
if c is TCheckBox then
|
||||
begin
|
||||
@@ -200,7 +207,7 @@ begin
|
||||
end;
|
||||
if c is TSpinBox then
|
||||
begin
|
||||
TSpinBox(c).text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
TSpinBox(c).Text := DB.ReadSetting(TSpinBox(c).Name, '1');
|
||||
end;
|
||||
if c is TColorPanel then
|
||||
begin
|
||||
@@ -213,7 +220,7 @@ begin
|
||||
if c is TEdit then
|
||||
begin
|
||||
if TEdit(c).Name <> 'edtPortServer' then
|
||||
TEdit(c).text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
TEdit(c).Text := DB.ReadSetting(TEdit(c).Name, '0');
|
||||
end;
|
||||
if c is TCheckBox then
|
||||
begin
|
||||
@@ -241,7 +248,18 @@ begin
|
||||
until FindNext(SearchRec) <> 0;
|
||||
ChDir('..');
|
||||
|
||||
end;
|
||||
|
||||
procedure TfCreateNotify.FormShow(Sender: TObject);
|
||||
begin
|
||||
if isEdit then
|
||||
begin
|
||||
btnCreateEvent.Text:='Èçìåíèòü îïîâåùåíèå';
|
||||
end
|
||||
else
|
||||
begin
|
||||
btnCreateEvent.Text:='Ñîçäàòü îïîâåùåíèå';
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user