1/*
2 * kPPP: A pppd front end for the KDE project
3 *
4 * $Id$
5 *
6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu
8 *
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
19 *
20 * You should have received a copy of the GNU Library General Public
21 * License along with this program; if not, write to the Free
22 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24
25#ifndef PPPSTATDLG_H
26#define PPPSTATDLG_H
27
28#include <qdialog.h>
29#include <qevent.h>
30#include <qpixmap.h>
31//Added by qt3to4:
32#include <QLabel>
33#include <QCloseEvent>
34
35class QLabel;
36class Q3GroupBox;
37class QLineEdit;
38class QTimer;
39class QPushButton;
40
41const int MAX_GRAPH_WIDTH = 600;
42const int GRAPH_UPDATE_TIME = 1000;
43
44class PPPStats;
45
46class PPPStatsDlg : public QWidget {
47
48 Q_OBJECT
49
50public:
51
52 PPPStatsDlg(QWidget *parent, const char *name,QWidget *main,
53 PPPStats *st);
54 ~PPPStatsDlg();
55
56protected:
57
58 void closeEvent( QCloseEvent *e );
59 bool event( QEvent *e );
60
61public slots:
62
63 void timeclick();
64 void cancel();
65 void take_stats();
66 void stop_stats();
67 void paintIcon(int);
68 void updateGraph();
69
70public:
71
72 void update_data();
73 void toCurrentDesktop();
74
75private:
76 void paintGraph();
77 PPPStats *stats;
78
79 QLabel *pixmap_l;
80 QWidget *main;
81 QPushButton *cancelbutton;
82
83 QLabel *labela1[5];
84 QLabel *labela2[5];
85 QLabel *labelb1[5];
86 QLabel *labelb2[5];
87
88 QLabel *ip_address_label1;
89 QLineEdit *ip_address_label2;
90 QLabel *ip_address_label3;
91 QLineEdit *ip_address_label4;
92
93 QLabel *modem_pic_label;
94 QPixmap modem_pixmap;
95 QPixmap modem_left_pixmap;
96 QPixmap modem_right_pixmap;
97 QPixmap modem_both_pixmap;
98 QPixmap big_modem_both_pixmap;
99 QPixmap big_modem_left_pixmap;
100 QPixmap big_modem_right_pixmap;
101 QPixmap big_modem_none_pixmap;
102
103 int ibytes_last;
104 int obytes_last;
105 bool need_to_paint;
106
107 QString ibytes_string;
108 QString ipackets_string;
109 QString compressedin_string;
110 QString uncompressedin_string;
111 QString errorin_string;
112 QString obytes_string;
113 QString opackets_string;
114 QString compressed_string;
115 QString packetsunc_string;
116 QString packetsoutunc_string;
117 Q3GroupBox *box;
118
119 // graph widget
120 QLabel *graph;
121 int bin[MAX_GRAPH_WIDTH];
122 int bout[MAX_GRAPH_WIDTH];
123 int bin_last;
124 int bout_last;
125 int ringIdx;
126 int max;
127 QTimer *graphTimer;
128 QColor bg, text, in, out;
129};
130
131#endif // PPPSTATDLG_H
132