source: branches/2/UInfoWindow.pas

Last change on this file was 1, checked in by george, 17 years ago

Přidáno: Verze 2.10 do vývojové větve 2.

  • Property svn:executable set to *
File size: 4.2 KB
Line 
1unit UInfoWindow;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, ComCtrls, StdCtrls, ExtCtrls;
8
9type
10 TInfoWindow = class(TForm)
11 Timer1: TTimer;
12 Panel1: TPanel;
13 Button2: TButton;
14 Button1: TButton;
15 ListView1: TListView;
16 CheckBox1: TCheckBox;
17 procedure Button1Click(Sender: TObject);
18 procedure FormShow(Sender: TObject);
19 procedure Button2Click(Sender: TObject);
20 procedure Timer1Timer(Sender: TObject);
21 procedure FormCreate(Sender: TObject);
22 procedure CheckBox1Click(Sender: TObject);
23 private
24 { Private declarations }
25 public
26 { Public declarations }
27 end;
28
29var
30 InfoWindow: TInfoWindow;
31
32implementation
33
34uses UMainWindow, USunriseChatCore, DateUtils, ULocalization, Math;
35
36{$R *.dfm}
37
38procedure TInfoWindow.Button1Click(Sender: TObject);
39begin
40 Close;
41end;
42
43procedure TInfoWindow.FormShow(Sender: TObject);
44begin
45 Button2Click(Self);
46 with Localization do begin
47 ListView1.Columns[0].Caption:= Item('Name');
48 ListView1.Columns[1].Caption:= Item('LoggedUser');
49 ListView1.Columns[2].Caption:= Item('UserDescription');
50 ListView1.Columns[3].Caption:= Item('ComputerName');
51 ListView1.Columns[4].Caption:= Item('IPAddress');
52 ListView1.Columns[5].Caption:= Item('Status');
53 ListView1.Columns[6].Caption:= Item('PresenceTime');
54 ListView1.Columns[7].Caption:= Item('ApplicationName');
55 ListView1.Columns[8].Caption:= Item('OSIndication');
56 Button1.Caption:= Item('Ok');
57 Button2.Caption:= Item('Restore');
58 InfoWindow.Caption:= Item('Information');
59 end;
60end;
61
62procedure TInfoWindow.Button2Click(Sender: TObject);
63var
64 I: Integer;
65 Node: TListItem;
66 Col: TListColumn;
67 TextStatus: string;
68 LinesCount: Integer;
69begin
70 ListView1.Items.BeginUpdate;
71 ListView1.Items.Clear;
72 if MainWindow.ServiceFunction then
73 with Localization, ListView1.Columns do begin
74 if Count<10 then begin
75 Col:= Add;
76 Col.Caption:= Item('CoreVersion');
77 Col.Width:= 60;
78 Col:= Add;
79 Col.Caption:= Item('TransferErrorCount');
80 Col.Width:= 80;
81 Col:= Add;
82 Col.Caption:= Item('PacketSequenceNumber');
83 Col.Width:= 80;
84 Col:= Add;
85 Col.Caption:= Item('IdleTime');
86 Col.Width:= 60;
87 Col:= Add;
88 Col.Caption:= Item('LocalTime');
89 Col.Width:= 80;
90 //Width:= 690+300+60;
91 end;
92 end else begin
93 for I:= ListView1.Columns.Count-1 downto 9 do
94 ListView1.Columns.Delete(I);
95 //Width:= 690;
96 end;
97 with MainWindow, SunriseChatCore do
98 for I:= 0 to High(UserList) do with UserList[I] do begin
99 Node:= InfoWindow.ListView1.Items.Add;
100 Node.Caption:= Nick;
101 with Node.SubItems do begin
102 Add(OSUser);
103 Add(DetailInfo);
104 Add(HostName);
105 Add(IP);
106 TextStatus:= Status;
107 if Status = usAway then TextStatus:= Localization.Item('AwayMode');;
108 if Status = usWritting then TextStatus:= Localization.Item('WrittingMode');;
109 Add(TextStatus);
110 Add(TimeToStr((LocalSystemTime-UpTime)+(Now-UserInfoTime)));
111 Add(Client+' '+ClientVersion);
112 Add(OSVersion);
113 if ServiceFunction then begin
114 Add(CoreVersion);
115 Add(IntToStr(ErrorCount));
116 Add(IntToStr(Sequence));
117 Add(TimeToStr(Delay));
118 Add(TimeToStr(LocalSystemTime+(Now-UserInfoTime)));
119 end;
120 end;
121 end;
122 ListView1.Items.EndUpdate;
123 if CheckBox1.Checked then begin
124 // Change window height across list item count
125 LinesCount := ListView1.Items.Count;
126 if LinesCount < 5 then LinesCount := 4;
127 Height := Height + (LinesCount*15 - ListView1.Height) + 36;
128 if Height > (Screen.Height-50) then Height:= (Screen.Height-50);
129 end;
130end;
131
132procedure TInfoWindow.Timer1Timer(Sender: TObject);
133begin
134 Button2Click(Self);
135end;
136
137procedure TInfoWindow.FormCreate(Sender: TObject);
138begin
139 if MainWindow.OnTop then FormStyle:= fsStayOnTop else FormStyle:= fsNormal;
140 CheckBox1.Checked:= MainWindow.AutoChangeInfoWindowHeight;
141end;
142
143procedure TInfoWindow.CheckBox1Click(Sender: TObject);
144begin
145 MainWindow.AutoChangeInfoWindowHeight:= CheckBox1.Checked;
146end;
147
148end.
Note: See TracBrowser for help on using the repository browser.