-
Notifications
You must be signed in to change notification settings - Fork 0
/
uFrmStatistic.pas
179 lines (155 loc) · 5.36 KB
/
uFrmStatistic.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
unit uFrmStatistic;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
TeeProcs, TeEngine, Chart, ComCtrls, ExtCtrls, StdCtrls,
uStatisticsBase, uStatisticsMessPer, uStatisticsHeader;
type
TfrmStatistic = class(TForm)
pnlButtons: TPanel;
p2: TPanel;
Splitter1: TSplitter;
pcResult: TPageControl;
tsText: TTabSheet;
tsGrafik: TTabSheet;
Chart1: TChart;
mmResult: TMemo;
btnExit: TButton;
btnMake: TButton;
p1: TPanel;
lbStatisticlist: TListBox;
pOptions: TPanel;
lFrom: TLabel;
lTo: TLabel;
lParam: TLabel;
chkRank: TCheckBox;
dtpFrom: TDateTimePicker;
dtpTo: TDateTimePicker;
edParam: TEdit;
procedure btnExitClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure lbStatisticlistClick(Sender: TObject);
procedure btnMakeClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
frmStatistic: TfrmStatistic;
implementation
uses uMain, VirtualTrees, uDBBase, uDBHamsterMails, uDBHamsterNews, uDBMbox, uStatistiken;
{$R *.DFM}
procedure TfrmStatistic.btnExitClick(Sender: TObject);
begin
Close
end;
procedure TfrmStatistic.FormCreate(Sender: TObject);
procedure AddInList( StatClass : tStatisticBaseClass);
begin
with StatClass.Create(nil, nil) do try
lbStatisticList.items.AddObject(GetShowOptions.Caption, TObject(StatClass));
finally free end
end;
begin
AddInList(tStatMesPerMonth); //'Messages per month'
AddInList(tStatMesPerWeekDay); //'Messages per day'
AddInList(tStatMesPerDay); //'Messages per weekday'
AddInList(tStatMesPerHour); //'Messages per hour'
AddInList(tStatNone); //'-'
AddInList(tStatHeaderFrom); //'Header: From'
AddInList(tStatHeaderFromName); //'Header: From (grouped, name)'
AddInList(tStatHeaderFromDomain); //'Header: From (grouped, domain)'
AddInList(tStatNone); //'-'
AddInList(tStatHeaderSubject); //'Header: Subject (Re:/was: skipped)'
AddInList(tStatNone); //'-'
AddInList(tStatHeaderMessageID); //'Message-ID (grouped)'
AddInList(tStatNone); //'-'
AddInList(tStatHeaderXNewsreader); //'Header: Newsreader'
AddInList(tStatHeaderXNewsreaderMsg); //'Header: Newsreader (grouped, per msg.)'
AddInList(tStatHeaderXNewsreaderUsr); //'Header: Newsreader (grouped, per user)'
AddInList(tStatNone); //'-'
AddInList(tStatHeaderOther); //'Header: (others)'
AddInList(tStatHeaderRegExp); //'Header: (regex)'
AddInList(tStatNone); //'-'
AddInList(tStatPathRelay); //'Path: Relayers (Top 100)'
AddInList(tStatPathMyFeeds); //'Path: My Feeds'
AddInList(tStatPathFeedsOf); //'Path: Feeds of ...'
AddInList(tStatNone); //'-'
AddInList(tStatDauJones); //'Fun: DAU Jones ;-)'
AddInList(tStatDauJonesName); //'Fun: DAU Jones ;-) (grouped, name)'
dtpFrom.DateTime := now-30; dtpFrom.MaxDate := now;
dtpTo.DateTime := now; dtpTo.MaxDate := now;
lParam.caption := 'Param: ';
end;
procedure TfrmStatistic.lbStatisticlistClick(Sender: TObject);
var
temStatShow : tStatShow;
stati : tStatisticBaseClass;
begin
if lbStatisticList.ItemIndex<0 then exit;
stati := tStatisticBaseClass(lbStatisticList.items.Objects[lbStatisticList.itemIndex]);
with stati.create(nil, nil) do try
temStatShow := GetShowOptions
finally free end;
with temStatShow do begin
chkRank.visible := ssoRanking in Options;
dtpFrom.visible := ssoBDate in Options;
lFrom.visible := ssoBDate in Options;
dtpTo.visible := ssoEDate in Options;
lTo.visible := ssoEDate in Options;
lParam.visible := ssoEdParam in Options;
edParam.visible := ssoEdParam in Options;
edParam.Text := DefParam;
lParam.Caption := 'Param: ' + ParamCapt;
end;
end;
procedure TfrmStatistic.btnMakeClick(Sender: TObject);
var
temStatOptions : tStatOptions;
temGroups : tGroupList;
stati : tStatisticBaseClass;
Data: pTreeData;
Node: PVirtualNode;
i : integeR;
begin
SetLength(temGroups, 0);
if lbStatisticList.ItemIndex<0 then exit;
btnMake.Enabled := false;
btnExit.Enabled := false;
pOptions.Enabled := false;
try
Application.ProcessMessages;
with temStatOptions do begin
Ranking := chkRank.checked;
BeginDate := dtpFrom.DateTime;
EndDate := dtpTo.DateTime;
Param := edParam.text;
end;
//Create Group-List:
i := 0;
Node := frmMainGoldFindWindow.vstGroupTree.GetFirstSelected;
while (Node<>nil) do begin
inc(i);
SetLength(temGroups, i);
Data := frmMainGoldFindWindow.vstGroupTree.GetNodeData(Node);
temGroups[i-1].Path := Data^.Path;
temGroups[i-1].Name := Data^.Caption;
temGroups[i-1].DB := Data^.DB;
Node := frmMainGoldFindWindow.vstGroupTree.GetNextSelected(Node);
end;
SetLength(temGroups, i);
stati := tStatisticBaseClass(lbStatisticList.items.Objects[lbStatisticList.itemIndex]);
//TODO: Wenn ich das Form einbaue: Progress
with stati.create(nil, nil) do try
SetOptions(temStatOptions);
MakeStatistic(temGroups);
mmResult.Text := GetResultAsText;
finally free end
finally
btnMake.Enabled := true;
btnExit.Enabled := true;
pOptions.Enabled := True
end;
end;
end.