добавил режим изменения
This commit is contained in:
+48
-30
@@ -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,32 +81,35 @@ 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;
|
||||
|
||||
TTW_Bot.frOBS1.AddNotify(OBSNotify);
|
||||
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,14 +149,14 @@ 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
|
||||
TCheckBox(c).IsChecked := DB.ReadSetting(TCheckBox(c).Name) = '1';
|
||||
end;
|
||||
end;
|
||||
for i := 0 to frFontSettings2.ComponentCount - 1 do
|
||||
for i := 0 to frFontSettings2.ComponentCount - 1 do
|
||||
begin
|
||||
c := frFontSettings2.Components[i];
|
||||
if c is TComboBox then
|
||||
@@ -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