1 | unit UInfoWindow;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
7 | Dialogs, ComCtrls, StdCtrls, ExtCtrls;
|
---|
8 |
|
---|
9 | type
|
---|
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 |
|
---|
29 | var
|
---|
30 | InfoWindow: TInfoWindow;
|
---|
31 |
|
---|
32 | implementation
|
---|
33 |
|
---|
34 | uses UMainWindow, USunriseChatCore, DateUtils, ULocalization, Math;
|
---|
35 |
|
---|
36 | {$R *.dfm}
|
---|
37 |
|
---|
38 | procedure TInfoWindow.Button1Click(Sender: TObject);
|
---|
39 | begin
|
---|
40 | Close;
|
---|
41 | end;
|
---|
42 |
|
---|
43 | procedure TInfoWindow.FormShow(Sender: TObject);
|
---|
44 | begin
|
---|
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;
|
---|
60 | end;
|
---|
61 |
|
---|
62 | procedure TInfoWindow.Button2Click(Sender: TObject);
|
---|
63 | var
|
---|
64 | I: Integer;
|
---|
65 | Node: TListItem;
|
---|
66 | Col: TListColumn;
|
---|
67 | TextStatus: string;
|
---|
68 | LinesCount: Integer;
|
---|
69 | begin
|
---|
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;
|
---|
130 | end;
|
---|
131 |
|
---|
132 | procedure TInfoWindow.Timer1Timer(Sender: TObject);
|
---|
133 | begin
|
---|
134 | Button2Click(Self);
|
---|
135 | end;
|
---|
136 |
|
---|
137 | procedure TInfoWindow.FormCreate(Sender: TObject);
|
---|
138 | begin
|
---|
139 | if MainWindow.OnTop then FormStyle:= fsStayOnTop else FormStyle:= fsNormal;
|
---|
140 | CheckBox1.Checked:= MainWindow.AutoChangeInfoWindowHeight;
|
---|
141 | end;
|
---|
142 |
|
---|
143 | procedure TInfoWindow.CheckBox1Click(Sender: TObject);
|
---|
144 | begin
|
---|
145 | MainWindow.AutoChangeInfoWindowHeight:= CheckBox1.Checked;
|
---|
146 | end;
|
---|
147 |
|
---|
148 | end.
|
---|