Diffstat (limited to 'noncore/settings/sysinfo/load.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/load.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/load.cpp b/noncore/settings/sysinfo/load.cpp index 0fcfa6b..900b3d3 100644 --- a/noncore/settings/sysinfo/load.cpp +++ b/noncore/settings/sysinfo/load.cpp | |||
@@ -10,49 +10,54 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | |||
23 | #include <qfile.h> | ||
22 | #include <qlayout.h> | 24 | #include <qlayout.h> |
23 | #include <qlabel.h> | 25 | #include <qlabel.h> |
24 | #include <qpainter.h> | 26 | #include <qpainter.h> |
25 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
26 | #include <qtimer.h> | ||
27 | #include <qfile.h> | ||
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qtimer.h> | ||
30 | #include <qwhatsthis.h> | ||
31 | |||
29 | #include "load.h" | 32 | #include "load.h" |
30 | 33 | ||
31 | LoadInfo::LoadInfo( QWidget *parent, const char *name, WFlags f ) | 34 | LoadInfo::LoadInfo( QWidget *parent, const char *name, WFlags f ) |
32 | : QWidget( parent, name, f ) | 35 | : QWidget( parent, name, f ) |
33 | { | 36 | { |
34 | QVBoxLayout *vb = new QVBoxLayout( this, 6 ); | 37 | QVBoxLayout *vb = new QVBoxLayout( this, 6 ); |
35 | 38 | ||
36 | QString cpuInfo = getCpuInfo(); | 39 | QString cpuInfo = getCpuInfo(); |
37 | if ( !cpuInfo.isNull() ) | 40 | if ( !cpuInfo.isNull() ) |
38 | vb->addWidget( new QLabel( cpuInfo, this ) ); | 41 | vb->addWidget( new QLabel( cpuInfo, this ) ); |
39 | vb->addWidget( new Load( this ), 100 ); | 42 | vb->addWidget( new Load( this ), 100 ); |
40 | QLabel *l = new QLabel( this ); | 43 | QLabel *l = new QLabel( this ); |
41 | l->setPixmap( makeLabel( red, tr("Application CPU usage (%)") ) ); | 44 | l->setPixmap( makeLabel( red, tr("Application CPU usage (%)") ) ); |
42 | vb->addWidget( l, 1 ); | 45 | vb->addWidget( l, 1 ); |
43 | l = new QLabel( this ); | 46 | l = new QLabel( this ); |
44 | l->setPixmap( makeLabel( green, tr("System CPU usage (%)") ) ); | 47 | l->setPixmap( makeLabel( green, tr("System CPU usage (%)") ) ); |
45 | vb->addWidget( l, 1 ); | 48 | vb->addWidget( l, 1 ); |
46 | vb->addStretch(50); | 49 | vb->addStretch(50); |
50 | |||
51 | QWhatsThis::add( this, tr( "This page shows how much this device's processor is being used." ) ); | ||
47 | } | 52 | } |
48 | 53 | ||
49 | QPixmap LoadInfo::makeLabel( const QColor &col, const QString &text ) | 54 | QPixmap LoadInfo::makeLabel( const QColor &col, const QString &text ) |
50 | { | 55 | { |
51 | int h = fontMetrics().height(); | 56 | int h = fontMetrics().height(); |
52 | QPixmap pm( 20 + fontMetrics().width( text ), h ); | 57 | QPixmap pm( 20 + fontMetrics().width( text ), h ); |
53 | QPainter p( &pm ); | 58 | QPainter p( &pm ); |
54 | p.fillRect( pm.rect(), colorGroup().background() ); | 59 | p.fillRect( pm.rect(), colorGroup().background() ); |
55 | p.fillRect( 0, h/2-4, 18, h/2+3, black ); | 60 | p.fillRect( 0, h/2-4, 18, h/2+3, black ); |
56 | p.setPen( col ); | 61 | p.setPen( col ); |
57 | p.drawLine( 2, h/2, 15, h/2 ); | 62 | p.drawLine( 2, h/2, 15, h/2 ); |
58 | p.setPen( colorGroup().text() ); | 63 | p.setPen( colorGroup().text() ); |