-
Notifications
You must be signed in to change notification settings - Fork 0
/
castle_setup_main.pas
104 lines (94 loc) · 3.41 KB
/
castle_setup_main.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
unit castle_setup_main;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
castle_setup;
type
TfrmCastle_setup_main = class(TFrameSetup)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
cbHTML: TCheckBox;
eRefTime: TEdit;
eRefUsers: TEdit;
cbHTMLTime: TCheckBox;
eMCount: TEdit;
cbPlaySounds: TCheckBox;
ePriv: TEdit;
eMaxLogCount: TEdit;
eMaxLogDays: TEdit;
cbNewMail: TCheckBox;
procedure cbHTMLClick(Sender: TObject);
private
{ Private declarations }
public
procedure InitParams; override;
procedure SaveParams; override;
end;
implementation
uses
castle_interface,
castle_utils;
{$R *.dfm}
procedure TfrmCastle_setup_main.InitParams;
begin
eRefTime.Text := Config.Value_Str['RefreshChatTime'];
eRefUsers.Text := Config.Value_Str['RefreshUsersTime'];
ePriv.Text := Config.Value_Str['RefreshPrivateTime'];
eMCount.Text := Config.Value_Str['MaxMessagesCount'];
cbHTML.Checked := Config.Value_Bool['SaveLogToHTML'];
cbHTMLTime.Checked := Config.Value_Bool['AddTimeInHtmlLog'];
cbPlaySounds.Checked := Config.Value_Bool['PlaySounds'];
eMaxLogCount.Text := Config.Value_Str['MaxLogMessages'];
eMaxLogDays.Text := Config.Value_Str['MaxLogDays'];
cbNewMail.Checked := Config.Value_Bool['ShowNewMail'];
end;
procedure TfrmCastle_setup_main.SaveParams;
begin
if (StrToIntDef(eRefTime.Text, 10) > 9) and (StrToIntDef(eRefTime.Text, 10) < 321) then
if (StrToIntDef(eRefUsers.Text, 10) > 9) and (StrToIntDef(eRefUsers.Text, 10) < 321) then
if (StrToIntDef(eMCount.Text, 10) > 9) and (StrToIntDef(eMCount.Text, 10) < 321) then
if (StrToIntDef(ePriv.Text, 10) > 59) and (StrToIntDef(ePriv.Text, 10) < 1201) then
if (StrToIntDef(eMaxLogDays.Text, 14) > 1) and (StrToIntDef(eMaxLogDays.Text, 14) < 357) then
if (StrToIntDef(eMaxLogCount.Text, 40) > 1) and (StrToIntDef(eMaxLogCount.Text, 14) < 100000) then
begin
Config.Value_Str['RefreshChatTime'] := eRefTime.Text;
Config.Value_Str['RefreshUsersTime'] := eRefUsers.Text;
Config.Value_Str['RefreshPrivateTime'] := ePriv.Text;
Config.Value_Str['MaxMessagesCount'] := eMCount.Text;
Config.Value_Bool['SaveLogToHTML'] := cbHTML.Checked;
Config.Value_Bool['AddTimeInHtmlLog'] := cbHTMLTime.Checked;
Config.Value_Bool['PlaySounds'] := cbPlaySounds.Checked;
Config.Value_Str['MaxLogMessages'] := eMaxLogCount.Text;
Config.Value_Str['MaxLogDays'] := eMaxLogDays.Text;
Config.Value_Bool['ShowNewMail'] := cbNewMail.Checked;
end else
EMsg('Ìàêñèìàëüíîå êîëè÷åñòâî ñîîáùåíèé â ëîãå äîëæíî áûòü îò 50 äî 99999') else
EMsg('Ìàêñèìàëüíàÿ äàòà ñîîáùåíèÿ â ëîãå äîëæíà áûòü îò 1 äî 356') else
EMsg('Âðåìÿ îáíîâëåíèÿ ëè÷íûõ ñîîáùåíèé äîëæíî áûòü â ïðåäåëå îò 60 äî 1200') else
EMsg('Êîëè÷åñòâî ñîîáùåíèé äîëæíî áûòü â ïðåäåëå îò 10 äî 100') else
EMsg('Âðåìÿ îáíîâëåíèÿ ïîëüçîâàòåëåé äîëæíî áûòü â ïðåäåëå îò 10 äî 320') else
EMsg('Âðåìÿ îáíîâëåíèÿ ÷àòà äîëæíî áûòü â ïðåäåëå îò 10 äî 320');
end;
procedure TfrmCastle_setup_main.cbHTMLClick(Sender: TObject);
begin
cbHTMLTime.Enabled := TCheckBox(Sender).Checked;
cbHTMLTime.Checked := TCheckBox(Sender).Checked;
end;
end.