author | drw <drw> | 2002-11-17 02:14:03 (UTC) |
---|---|---|
committer | drw <drw> | 2002-11-17 02:14:03 (UTC) |
commit | 9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2 (patch) (unidiff) | |
tree | f84b36548fa91496c0c100c96a3fa1512ec8b108 /noncore/settings/sysinfo | |
parent | 5a1f5ba99dfb754f1be4500dd55dca42b36413b8 (diff) | |
download | opie-9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2.zip opie-9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2.tar.gz opie-9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2.tar.bz2 |
Start of What's This for Sysinfo, plus some code tweaks
-rw-r--r-- | noncore/settings/sysinfo/load.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/sysinfo/memory.cpp | 10 | ||||
-rw-r--r-- | noncore/settings/sysinfo/opie-sysinfo.control | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/storage.cpp | 37 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/versioninfo.cpp | 13 |
6 files changed, 51 insertions, 22 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 | |||
@@ -1,94 +1,99 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
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() ); |
59 | p.drawText( 20, fontMetrics().ascent(), text ); | 64 | p.drawText( 20, fontMetrics().ascent(), text ); |
60 | 65 | ||
61 | return pm; | 66 | return pm; |
62 | } | 67 | } |
63 | 68 | ||
64 | QString LoadInfo::getCpuInfo() | 69 | QString LoadInfo::getCpuInfo() |
65 | { | 70 | { |
66 | bool haveInfo = FALSE; | 71 | bool haveInfo = FALSE; |
67 | QString info = tr("Type: "); | 72 | QString info = tr("Type: "); |
68 | QFile f( "/proc/cpuinfo" ); | 73 | QFile f( "/proc/cpuinfo" ); |
69 | if ( f.open( IO_ReadOnly ) ) { | 74 | if ( f.open( IO_ReadOnly ) ) { |
70 | QTextStream ts( &f ); | 75 | QTextStream ts( &f ); |
71 | 76 | ||
72 | while ( !ts.atEnd() ) { | 77 | while ( !ts.atEnd() ) { |
73 | QString s = ts.readLine(); | 78 | QString s = ts.readLine(); |
74 | if ( s.find( "model name" ) == 0 ) { | 79 | if ( s.find( "model name" ) == 0 ) { |
75 | info += s.mid( s.find( ':' ) + 2 ); | 80 | info += s.mid( s.find( ':' ) + 2 ); |
76 | haveInfo = TRUE; | 81 | haveInfo = TRUE; |
77 | } else if ( s.find( "cpu MHz" ) == 0 ) { | 82 | } else if ( s.find( "cpu MHz" ) == 0 ) { |
78 | double mhz = s.mid( s.find( ':' ) + 2 ).toDouble(); | 83 | double mhz = s.mid( s.find( ':' ) + 2 ).toDouble(); |
79 | info += " " + QString::number( mhz, 'f', 0 ); | 84 | info += " " + QString::number( mhz, 'f', 0 ); |
80 | info += "MHz"; | 85 | info += "MHz"; |
81 | break; | 86 | break; |
82 | } else if ( s.find( "Processor" ) == 0 ) { | 87 | } else if ( s.find( "Processor" ) == 0 ) { |
83 | info += s.mid( s.find( ':' ) + 2 ); | 88 | info += s.mid( s.find( ':' ) + 2 ); |
84 | haveInfo = TRUE; | 89 | haveInfo = TRUE; |
85 | break; | 90 | break; |
86 | #ifdef __MIPSEL__ | 91 | #ifdef __MIPSEL__ |
87 | } else if ( s.find( "cpu model" ) == 0 ) { | 92 | } else if ( s.find( "cpu model" ) == 0 ) { |
88 | info += " " + s.mid( s.find( ':' ) + 2 ); | 93 | info += " " + s.mid( s.find( ':' ) + 2 ); |
89 | break; | 94 | break; |
90 | } else if ( s.find( "cpu" ) == 0 ) { | 95 | } else if ( s.find( "cpu" ) == 0 ) { |
91 | info += s.mid( s.find( ':' ) + 2 ); | 96 | info += s.mid( s.find( ':' ) + 2 ); |
92 | haveInfo = TRUE; | 97 | haveInfo = TRUE; |
93 | #endif | 98 | #endif |
94 | } | 99 | } |
diff --git a/noncore/settings/sysinfo/memory.cpp b/noncore/settings/sysinfo/memory.cpp index 781f0df..30d42d5 100644 --- a/noncore/settings/sysinfo/memory.cpp +++ b/noncore/settings/sysinfo/memory.cpp | |||
@@ -1,94 +1,98 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
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 <qlabel.h> | 21 | #include <qlabel.h> |
22 | #include <qtimer.h> | ||
23 | #include <qfile.h> | 22 | #include <qfile.h> |
24 | #include <qtextstream.h> | ||
25 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qtextstream.h> | ||
25 | #include <qtimer.h> | ||
26 | #include <qwhatsthis.h> | ||
27 | |||
26 | #include "graph.h" | 28 | #include "graph.h" |
27 | #include "memory.h" | 29 | #include "memory.h" |
28 | 30 | ||
29 | MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags f ) | 31 | MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags f ) |
30 | : QWidget( parent, name, f ) | 32 | : QWidget( parent, name, WStyle_ContextHelp ) |
31 | { | 33 | { |
32 | QVBoxLayout *vb = new QVBoxLayout( this, 5 ); | 34 | QVBoxLayout *vb = new QVBoxLayout( this, 5 ); |
33 | 35 | ||
34 | totalMem = new QLabel( this ); | 36 | totalMem = new QLabel( this ); |
35 | vb->addWidget( totalMem ); | 37 | vb->addWidget( totalMem ); |
36 | 38 | ||
37 | data = new GraphData(); | 39 | data = new GraphData(); |
38 | // graph = new PieGraph( this ); | 40 | // graph = new PieGraph( this ); |
39 | graph = new BarGraph( this ); | 41 | graph = new BarGraph( this ); |
40 | graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 42 | graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
41 | vb->addWidget( graph, 1 ); | 43 | vb->addWidget( graph, 1 ); |
42 | graph->setData( data ); | 44 | graph->setData( data ); |
43 | 45 | ||
44 | legend = new GraphLegend( this ); | 46 | legend = new GraphLegend( this ); |
45 | vb->addWidget( legend ); | 47 | vb->addWidget( legend ); |
46 | legend->setData( data ); | 48 | legend->setData( data ); |
47 | 49 | ||
48 | vb->addStretch( 1 ); | 50 | vb->addStretch( 1 ); |
49 | updateData(); | 51 | updateData(); |
50 | 52 | ||
51 | QTimer *t = new QTimer( this ); | 53 | QTimer *t = new QTimer( this ); |
52 | connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); | 54 | connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); |
53 | t->start( 5000 ); | 55 | t->start( 5000 ); |
56 | |||
57 | QWhatsThis::add( this, tr( "This page shows how memory (i.e. RAM) is being allocated on your handheld device.\nMemory is categorized as follows:\n\n1. Used - memory used to by Opie and any running applications.\n2. Buffers - temporary storage used to improve performance\n3. Cached - information that has recently been used, but has not been freed yet.\n4. Free - memory not currently used by Opie or any running applications." ) ); | ||
54 | } | 58 | } |
55 | 59 | ||
56 | MemoryInfo::~MemoryInfo() | 60 | MemoryInfo::~MemoryInfo() |
57 | { | 61 | { |
58 | delete data; | 62 | delete data; |
59 | } | 63 | } |
60 | 64 | ||
61 | void MemoryInfo::updateData() | 65 | void MemoryInfo::updateData() |
62 | { | 66 | { |
63 | QFile file( "/proc/meminfo" ); | 67 | QFile file( "/proc/meminfo" ); |
64 | 68 | ||
65 | if ( file.open( IO_ReadOnly ) ) { | 69 | if ( file.open( IO_ReadOnly ) ) { |
66 | QTextStream t( &file ); | 70 | QTextStream t( &file ); |
67 | QString dummy = t.readLine();// title | 71 | QString dummy = t.readLine();// title |
68 | t >> dummy; | 72 | t >> dummy; |
69 | int total, used, memfree, shared, buffers, cached; | 73 | int total, used, memfree, shared, buffers, cached; |
70 | t >> total; | 74 | t >> total; |
71 | total /= 1000; | 75 | total /= 1000; |
72 | t >> used; | 76 | t >> used; |
73 | used /= 1000; | 77 | used /= 1000; |
74 | t >> memfree; | 78 | t >> memfree; |
75 | memfree /= 1000; | 79 | memfree /= 1000; |
76 | t >> shared; | 80 | t >> shared; |
77 | shared /= 1000; | 81 | shared /= 1000; |
78 | t >> buffers; | 82 | t >> buffers; |
79 | buffers /= 1000; | 83 | buffers /= 1000; |
80 | t >> cached; | 84 | t >> cached; |
81 | cached /= 1000; | 85 | cached /= 1000; |
82 | int realUsed = total - ( buffers + cached + memfree ); | 86 | int realUsed = total - ( buffers + cached + memfree ); |
83 | data->clear(); | 87 | data->clear(); |
84 | data->addItem( tr("Used (%1 kB)").arg(realUsed), realUsed ); | 88 | data->addItem( tr("Used (%1 kB)").arg(realUsed), realUsed ); |
85 | data->addItem( tr("Buffers (%1 kB)").arg(buffers), buffers ); | 89 | data->addItem( tr("Buffers (%1 kB)").arg(buffers), buffers ); |
86 | data->addItem( tr("Cached (%1 kB)").arg(cached), cached ); | 90 | data->addItem( tr("Cached (%1 kB)").arg(cached), cached ); |
87 | data->addItem( tr("Free (%1 kB)").arg(memfree), memfree ); | 91 | data->addItem( tr("Free (%1 kB)").arg(memfree), memfree ); |
88 | totalMem->setText( tr( "Total Memory: %1 kB" ).arg( total ) ); | 92 | totalMem->setText( tr( "Total Memory: %1 kB" ).arg( total ) ); |
89 | graph->repaint( FALSE ); | 93 | graph->repaint( FALSE ); |
90 | legend->update(); | 94 | legend->update(); |
91 | } | 95 | } |
92 | } | 96 | } |
93 | 97 | ||
94 | 98 | ||
diff --git a/noncore/settings/sysinfo/opie-sysinfo.control b/noncore/settings/sysinfo/opie-sysinfo.control index 796f734..4a6855d 100644 --- a/noncore/settings/sysinfo/opie-sysinfo.control +++ b/noncore/settings/sysinfo/opie-sysinfo.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/sysinfo | 1 | Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/sysinfo |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Dan Williams <wiliamsdr@acm.org> | 4 | Maintainer: Dan Williams <williamsdr@acm.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) |
8 | Description: System Information dialog | 8 | Description: System Information dialog |
9 | For the Opie environment. | 9 | For the Opie environment. |
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp index b369ff1..c33663e 100644 --- a/noncore/settings/sysinfo/storage.cpp +++ b/noncore/settings/sysinfo/storage.cpp | |||
@@ -1,72 +1,73 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
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 | // additions copyright 2002 by L.J. Potter | 20 | // additions copyright 2002 by L.J. Potter |
21 | #include <qlabel.h> | 21 | #include <qlabel.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qlayout.h> | 24 | #include <qwhatsthis.h> |
25 | |||
25 | #include "graph.h" | 26 | #include "graph.h" |
26 | #include "storage.h" | 27 | #include "storage.h" |
27 | 28 | ||
28 | #include <stdio.h> | 29 | #include <stdio.h> |
29 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 30 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
30 | #include <sys/vfs.h> | 31 | #include <sys/vfs.h> |
31 | #include <mntent.h> | 32 | #include <mntent.h> |
32 | #endif | 33 | #endif |
33 | 34 | ||
34 | StorageInfo::StorageInfo( QWidget *parent, const char *name ) | 35 | StorageInfo::StorageInfo( QWidget *parent, const char *name ) |
35 | : QWidget( parent, name ) | 36 | : QWidget( parent, name ) |
36 | { | 37 | { |
37 | vb = 0; | 38 | vb = 0; |
38 | disks.setAutoDelete(TRUE); | 39 | disks.setAutoDelete(TRUE); |
39 | lines.setAutoDelete(TRUE); | 40 | lines.setAutoDelete(TRUE); |
40 | updateMounts(); | 41 | updateMounts(); |
41 | startTimer( 5000 ); | 42 | startTimer( 5000 ); |
42 | } | 43 | } |
43 | 44 | ||
44 | void StorageInfo::timerEvent(QTimerEvent*) | 45 | void StorageInfo::timerEvent(QTimerEvent*) |
45 | { | 46 | { |
46 | updateMounts(); | 47 | updateMounts(); |
47 | } | 48 | } |
48 | 49 | ||
49 | static bool isCF(const QString& m) | 50 | static bool isCF(const QString& m) |
50 | { | 51 | { |
51 | FILE* f = fopen("/var/run/stab", "r"); | 52 | FILE* f = fopen("/var/run/stab", "r"); |
52 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); | 53 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); |
53 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); | 54 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); |
54 | if ( f ) { | 55 | if ( f ) { |
55 | char line[1024]; | 56 | char line[1024]; |
56 | char devtype[80]; | 57 | char devtype[80]; |
57 | char devname[80]; | 58 | char devname[80]; |
58 | while ( fgets( line, 1024, f ) ) { | 59 | while ( fgets( line, 1024, f ) ) { |
59 | // 0 ide ide-cs 0 hda 3 0 | 60 | // 0 ide ide-cs 0 hda 3 0 |
60 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) { | 61 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) { |
61 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { | 62 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { |
62 | fclose(f); | 63 | fclose(f); |
63 | return TRUE; | 64 | return TRUE; |
64 | } | 65 | } |
65 | } | 66 | } |
66 | } | 67 | } |
67 | fclose(f); | 68 | fclose(f); |
68 | } | 69 | } |
69 | return FALSE; | 70 | return FALSE; |
70 | } | 71 | } |
71 | 72 | ||
72 | void StorageInfo::updateMounts() | 73 | void StorageInfo::updateMounts() |
@@ -78,119 +79,135 @@ void StorageInfo::updateMounts() | |||
78 | QStringList curfs; | 79 | QStringList curfs; |
79 | QStringList mountList; | 80 | QStringList mountList; |
80 | QStringList fsT; | 81 | QStringList fsT; |
81 | bool rebuild = FALSE; | 82 | bool rebuild = FALSE; |
82 | int n=0; | 83 | int n=0; |
83 | if ( mntfp ) { | 84 | if ( mntfp ) { |
84 | while ( (me = getmntent( mntfp )) != 0 ) { | 85 | while ( (me = getmntent( mntfp )) != 0 ) { |
85 | QString fs = me->mnt_fsname; | 86 | QString fs = me->mnt_fsname; |
86 | qDebug(fs+" "+(QString)me->mnt_type); | 87 | qDebug(fs+" "+(QString)me->mnt_type); |
87 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" | 88 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" |
88 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" | 89 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" |
89 | || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") { | 90 | || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") { |
90 | n++; | 91 | n++; |
91 | curdisks.append(fs); | 92 | curdisks.append(fs); |
92 | QString d = me->mnt_dir; | 93 | QString d = me->mnt_dir; |
93 | curfs.append(d); | 94 | curfs.append(d); |
94 | QString mount = me->mnt_dir; | 95 | QString mount = me->mnt_dir; |
95 | mountList.append(mount); | 96 | mountList.append(mount); |
96 | QString t = me->mnt_type; | 97 | QString t = me->mnt_type; |
97 | fsT.append(t); | 98 | fsT.append(t); |
98 | if ( !disks.find(d) ) | 99 | if ( !disks.find(d) ) |
99 | rebuild = TRUE; | 100 | rebuild = TRUE; |
100 | } | 101 | } |
101 | } | 102 | } |
102 | endmntent( mntfp ); | 103 | endmntent( mntfp ); |
103 | } | 104 | } |
104 | if ( rebuild || n != (int)disks.count() ) { | 105 | if ( rebuild || n != (int)disks.count() ) { |
105 | disks.clear(); | 106 | disks.clear(); |
106 | lines.clear(); | 107 | lines.clear(); |
107 | delete vb; | 108 | delete vb; |
108 | vb = new QVBoxLayout( this, n > 3 ? 1 : 5 ); | 109 | vb = new QVBoxLayout( this, n > 3 ? 1 : 5 ); |
109 | bool frst=TRUE; | 110 | bool frst=TRUE; |
110 | QStringList::ConstIterator it=curdisks.begin(); | 111 | QStringList::ConstIterator it=curdisks.begin(); |
111 | QStringList::ConstIterator fsit=curfs.begin(); | 112 | QStringList::ConstIterator fsit=curfs.begin(); |
112 | QStringList::ConstIterator fsmount=mountList.begin(); | 113 | QStringList::ConstIterator fsmount=mountList.begin(); |
113 | QStringList::ConstIterator fsTit=fsT.begin(); | 114 | QStringList::ConstIterator fsTit=fsT.begin(); |
114 | 115 | ||
115 | for (; it!=curdisks.end(); ++it, ++fsit) { | 116 | for (; it!=curdisks.end(); ++it, ++fsit) { |
116 | if ( !frst ) { | 117 | if ( !frst ) { |
117 | QFrame *f = new QFrame( this ); | 118 | QFrame *f = new QFrame( this ); |
118 | vb->addWidget(f); | 119 | vb->addWidget(f); |
119 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 120 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
120 | lines.append(f); | 121 | lines.append(f); |
121 | f->show(); | 122 | f->show(); |
122 | } frst=FALSE; | 123 | } frst=FALSE; |
123 | QString humanname=*it; | 124 | QString humanname=*it; |
124 | // qDebug(humanname); | 125 | // qDebug(humanname); |
125 | if ( isCF(humanname) ) | 126 | if ( isCF(humanname) ) |
126 | humanname = tr("CF Card: "+*fsmount+" "+*fsTit+" "); | 127 | humanname = tr( "CF Card: " ); |
127 | else if ( humanname == "/dev/hda1" ) | 128 | else if ( humanname == "/dev/hda1" ) |
128 | humanname = tr("Hard Disk "+*fsmount+" "+*fsTit+" "); | 129 | humanname = tr( "Hard Disk " ); |
129 | else if ( humanname.left(9) == "/dev/mmcd" ) | 130 | else if ( humanname.left(9) == "/dev/mmcd" ) |
130 | humanname = tr("SD Card "+*fsmount+" "+*fsTit+" "); | 131 | humanname = tr( "SD Card " ); |
131 | else if ( humanname.left(7) == "/dev/hd" ) | 132 | else if ( humanname.left(7) == "/dev/hd" ) |
132 | humanname = tr("Hard Disk") + " " + humanname.mid(7)+" "+*fsmount+" "+*fsTit+" "; | 133 | humanname = tr( "Hard Disk /dev/hd " ); |
133 | else if ( humanname.left(7) == "/dev/sd" ) | 134 | else if ( humanname.left(7) == "/dev/sd" ) |
134 | humanname = tr("SCSI Hard Disk") + " " + humanname.mid(7)+" "+*fsmount+" "+*fsTit+" "; | 135 | humanname = tr( "SCSI Hard Disk /dev/sd " ); |
135 | else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) | 136 | else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) |
136 | humanname = tr("Int. Storage "+*fsmount+" "+*fsTit+"\n"); | 137 | humanname = tr( "Int. Storage " ); |
137 | else if ( humanname.left(14) == "/dev/mtdblock/" ) | 138 | else if ( humanname.left(14) == "/dev/mtdblock/" ) |
138 | humanname = tr("Int. Storage") + " " + humanname.mid(14)+" "+*fsmount+" "+*fsTit+" "; | 139 | humanname = tr( "Int. Storage /dev/mtdblock/ " ); |
139 | else if ( humanname.left(13) == "/dev/mtdblock" ) | 140 | else if ( humanname.left(13) == "/dev/mtdblock" ) |
140 | humanname = tr("Int. Storage") + " " + humanname.mid(13)+" "+*fsmount+" "+*fsTit+" "; | 141 | humanname = tr( "Int. Storage /dev/mtdblock " ); |
141 | else if ( humanname.left(9) == "/dev/root" ) | 142 | else if ( humanname.left(9) == "/dev/root" ) |
142 | humanname = tr("Int. Storage "+*fsmount+" "+*fsTit+" "); | 143 | humanname = tr( "Int. Storage " ); |
143 | // etc. | 144 | // etc. |
145 | humanname.append( *fsmount ); | ||
146 | humanname.append( " " ); | ||
147 | humanname.append( *fsTit ); | ||
148 | humanname.append( " " ); | ||
149 | |||
144 | MountInfo* mi = new MountInfo( *fsit, humanname, this ); | 150 | MountInfo* mi = new MountInfo( *fsit, humanname, this ); |
145 | vb->addWidget(mi); | 151 | vb->addWidget(mi); |
146 | disks.insert(*fsit,mi); | 152 | disks.insert(*fsit,mi); |
147 | mi->show(); | 153 | mi->show(); |
148 | fsmount++;fsTit++; | 154 | fsmount++;fsTit++; |
155 | QString tempstr = humanname.left( 2 ); | ||
156 | if ( tempstr == tr( "CF" ) ) | ||
157 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) ); | ||
158 | else if ( tempstr == tr( "Ha" ) ) | ||
159 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); | ||
160 | else if ( tempstr == tr( "SD" ) ) | ||
161 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); | ||
162 | else if ( tempstr == tr( "SC" ) ) | ||
163 | QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); | ||
164 | else if ( tempstr == tr( "In" ) ) | ||
165 | QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the built-in memory (i.e. Flash memory) on this handheld device." ) ); | ||
149 | } | 166 | } |
150 | vb->addStretch(); | 167 | vb->addStretch(); |
151 | } else { | 168 | } else { |
152 | // just update them | 169 | // just update them |
153 | for (QDictIterator<MountInfo> i(disks); i.current(); ++i) | 170 | for (QDictIterator<MountInfo> i(disks); i.current(); ++i) |
154 | i.current()->updateData(); | 171 | i.current()->updateData(); |
155 | } | 172 | } |
156 | #endif | 173 | #endif |
157 | } | 174 | } |
158 | 175 | ||
159 | 176 | ||
160 | MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name ) | 177 | MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name ) |
161 | : QWidget( parent, name ), title(ttl) | 178 | : QWidget( parent, name ), title(ttl) |
162 | { | 179 | { |
163 | qDebug("new path is "+path); | 180 | qDebug("new path is "+path); |
164 | fs = new FileSystem( path ); | 181 | fs = new FileSystem( path ); |
165 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); | 182 | QVBoxLayout *vb = new QVBoxLayout( this, 3 ); |
166 | 183 | ||
167 | totalSize = new QLabel( this ); | 184 | totalSize = new QLabel( this ); |
168 | vb->addWidget( totalSize ); | 185 | vb->addWidget( totalSize ); |
169 | 186 | ||
170 | data = new GraphData(); | 187 | data = new GraphData(); |
171 | graph = new BarGraph( this ); | 188 | graph = new BarGraph( this ); |
172 | graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 189 | graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
173 | vb->addWidget( graph, 1 ); | 190 | vb->addWidget( graph, 1 ); |
174 | graph->setData( data ); | 191 | graph->setData( data ); |
175 | 192 | ||
176 | legend = new GraphLegend( this ); | 193 | legend = new GraphLegend( this ); |
177 | legend->setOrientation(Horizontal); | 194 | legend->setOrientation(Horizontal); |
178 | vb->addWidget( legend ); | 195 | vb->addWidget( legend ); |
179 | legend->setData( data ); | 196 | legend->setData( data ); |
180 | 197 | ||
181 | updateData(); | 198 | updateData(); |
182 | } | 199 | } |
183 | 200 | ||
184 | MountInfo::~MountInfo() | 201 | MountInfo::~MountInfo() |
185 | { | 202 | { |
186 | delete data; | 203 | delete data; |
187 | delete fs; | 204 | delete fs; |
188 | } | 205 | } |
189 | 206 | ||
190 | void MountInfo::updateData() | 207 | void MountInfo::updateData() |
191 | { | 208 | { |
192 | fs->update(); | 209 | fs->update(); |
193 | 210 | ||
194 | long mult = fs->blockSize() / 1024; | 211 | long mult = fs->blockSize() / 1024; |
195 | long div = 1024 / fs->blockSize(); | 212 | long div = 1024 / fs->blockSize(); |
196 | if ( !mult ) mult = 1; | 213 | if ( !mult ) mult = 1; |
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp index f727443..6d2a64f 100644 --- a/noncore/settings/sysinfo/sysinfo.cpp +++ b/noncore/settings/sysinfo/sysinfo.cpp | |||
@@ -1,70 +1,70 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
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 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> | 21 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> |
22 | ** | 22 | ** |
23 | **********************************************************************/ | 23 | **********************************************************************/ |
24 | 24 | ||
25 | #include "memory.h" | 25 | #include "memory.h" |
26 | #include "load.h" | 26 | #include "load.h" |
27 | #include "storage.h" | 27 | #include "storage.h" |
28 | #include "processinfo.h" | 28 | #include "processinfo.h" |
29 | #include "modulesinfo.h" | 29 | #include "modulesinfo.h" |
30 | #include "versioninfo.h" | 30 | #include "versioninfo.h" |
31 | #include "sysinfo.h" | 31 | #include "sysinfo.h" |
32 | 32 | ||
33 | #include <opie/otabwidget.h> | 33 | #include <opie/otabwidget.h> |
34 | 34 | ||
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | 37 | ||
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | 39 | ||
40 | SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f ) | 40 | SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f ) |
41 | : QWidget( parent, name, f ) | 41 | : QWidget( parent, name, WStyle_ContextHelp ) |
42 | { | 42 | { |
43 | setIcon( Resource::loadPixmap( "system_icon" ) ); | 43 | setIcon( Resource::loadPixmap( "system_icon" ) ); |
44 | setCaption( tr("System Info") ); | 44 | setCaption( tr("System Info") ); |
45 | 45 | ||
46 | resize( 220, 180 ); | 46 | resize( 220, 180 ); |
47 | 47 | ||
48 | Config config( "qpe" ); | 48 | Config config( "qpe" ); |
49 | config.setGroup( "Appearance" ); | 49 | config.setGroup( "Appearance" ); |
50 | bool advanced = config.readBoolEntry( "Advanced", TRUE ); | 50 | bool advanced = config.readBoolEntry( "Advanced", TRUE ); |
51 | 51 | ||
52 | QVBoxLayout *lay = new QVBoxLayout( this ); | 52 | QVBoxLayout *lay = new QVBoxLayout( this ); |
53 | OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); | 53 | OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); |
54 | lay->addWidget( tab ); | 54 | lay->addWidget( tab ); |
55 | tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") ); | 55 | tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") ); |
56 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 56 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
57 | tab->addTab( new StorageInfo( tab ), "sysinfo/storagetabicon.png", tr("Storage") ); | 57 | tab->addTab( new StorageInfo( tab ), "sysinfo/storagetabicon.png", tr("Storage") ); |
58 | #endif | 58 | #endif |
59 | tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon.png", tr("CPU") ); | 59 | tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon.png", tr("CPU") ); |
60 | if ( advanced ) | 60 | if ( advanced ) |
61 | { | 61 | { |
62 | tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon.png", tr("Process") ); | 62 | tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon.png", tr("Process") ); |
63 | tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon.png", tr("Modules") ); | 63 | tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon.png", tr("Modules") ); |
64 | } | 64 | } |
65 | tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") ); | 65 | tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") ); |
66 | 66 | ||
67 | tab->setCurrentTab( tr( "Memory" ) ); | 67 | tab->setCurrentTab( tr( "Memory" ) ); |
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp index a8db207..79e7fea 100644 --- a/noncore/settings/sysinfo/versioninfo.cpp +++ b/noncore/settings/sysinfo/versioninfo.cpp | |||
@@ -1,130 +1,133 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
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 <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/version.h> | 22 | #include <qpe/version.h> |
23 | 23 | ||
24 | 24 | #include <qfile.h> | |
25 | #include <qimage.h> | ||
25 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | ||
26 | #include <qpixmap.h> | 28 | #include <qpixmap.h> |
27 | #include <qpainter.h> | 29 | #include <qpainter.h> |
28 | #include <qimage.h> | ||
29 | #include <qtimer.h> | ||
30 | #include <qfile.h> | ||
31 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
32 | #include <qlayout.h> | 31 | #include <qtimer.h> |
32 | #include <qwhatsthis.h> | ||
33 | |||
33 | #include "versioninfo.h" | 34 | #include "versioninfo.h" |
34 | 35 | ||
35 | #include <opie/odevice.h> | 36 | #include <opie/odevice.h> |
37 | |||
36 | using namespace Opie; | 38 | using namespace Opie; |
37 | 39 | ||
38 | VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) | 40 | VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) |
39 | : QWidget( parent, name, f ) | 41 | : QWidget( parent, name, f ) |
40 | { | 42 | { |
41 | setMinimumSize( 200, 150 ); | 43 | setMinimumSize( 200, 150 ); |
42 | 44 | ||
43 | QVBoxLayout *vb = new QVBoxLayout( this, 4 ); | 45 | QVBoxLayout *vb = new QVBoxLayout( this, 4 ); |
44 | 46 | ||
45 | QString kernelVersionString; | 47 | QString kernelVersionString; |
46 | QFile file( "/proc/version" ); | 48 | QFile file( "/proc/version" ); |
47 | if ( file.open( IO_ReadOnly ) ) { | 49 | if ( file.open( IO_ReadOnly ) ) { |
48 | QTextStream t( &file ); | 50 | QTextStream t( &file ); |
49 | QString v; | 51 | QString v; |
50 | t >> v; t >> v; t >> v; | 52 | t >> v; t >> v; t >> v; |
51 | v = v.left( 20 ); | 53 | v = v.left( 20 ); |
52 | kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>"; | 54 | kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>"; |
53 | t >> v; | 55 | t >> v; |
54 | kernelVersionString += tr( "Compiled by: " ) + v; | 56 | kernelVersionString += tr( "Compiled by: " ) + v; |
55 | file.close(); | 57 | file.close(); |
56 | } | 58 | } |
57 | 59 | ||
58 | QString palmtopVersionString; | 60 | QString palmtopVersionString; |
59 | palmtopVersionString = tr( "<b>Opie</b><p>Version: " ) + QPE_VERSION + "<p>"; | 61 | palmtopVersionString = tr( "<b>Opie</b><p>Version: " ) + QPE_VERSION + "<p>"; |
60 | #ifdef QPE_VENDOR | 62 | #ifdef QPE_VENDOR |
61 | QString builder = QPE_VENDOR; | 63 | QString builder = QPE_VENDOR; |
62 | #else | 64 | #else |
63 | QString builder = "Unknown"; | 65 | QString builder = "Unknown"; |
64 | #endif | 66 | #endif |
65 | palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>"; | 67 | palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>"; |
66 | palmtopVersionString += tr( "Built on: " ) + __DATE__; | 68 | palmtopVersionString += tr( "Built on: " ) + __DATE__; |
67 | 69 | ||
68 | 70 | ||
69 | QHBoxLayout *hb1 = new QHBoxLayout( vb ); | 71 | QHBoxLayout *hb1 = new QHBoxLayout( vb ); |
70 | hb1->setSpacing( 2 ); | 72 | hb1->setSpacing( 2 ); |
71 | 73 | ||
72 | QLabel *palmtopLogo = new QLabel( this ); | 74 | QLabel *palmtopLogo = new QLabel( this ); |
73 | QImage logo1 = Resource::loadImage( "logo/opielogo" ); | 75 | QImage logo1 = Resource::loadImage( "logo/opielogo" ); |
74 | logo1 = logo1.smoothScale( 50, 55 ); | 76 | logo1 = logo1.smoothScale( 50, 55 ); |
75 | QPixmap logo1Pixmap; | 77 | QPixmap logo1Pixmap; |
76 | logo1Pixmap.convertFromImage( logo1 ); | 78 | logo1Pixmap.convertFromImage( logo1 ); |
77 | palmtopLogo->setPixmap( logo1Pixmap ); | 79 | palmtopLogo->setPixmap( logo1Pixmap ); |
78 | palmtopLogo->setFixedSize( 60, 60 ); | 80 | palmtopLogo->setFixedSize( 60, 60 ); |
79 | hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); | 81 | hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); |
80 | 82 | ||
81 | QLabel *palmtopVersion = new QLabel( this ); | 83 | QLabel *palmtopVersion = new QLabel( this ); |
82 | palmtopVersion->setText( palmtopVersionString ); | 84 | palmtopVersion->setText( palmtopVersionString ); |
83 | hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); | 85 | hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); |
84 | 86 | ||
85 | 87 | ||
86 | QHBoxLayout *hb2 = new QHBoxLayout( vb ); | 88 | QHBoxLayout *hb2 = new QHBoxLayout( vb ); |
87 | hb1->setSpacing( 2 ); | 89 | hb1->setSpacing( 2 ); |
88 | 90 | ||
89 | QLabel *linuxLogo = new QLabel( this ); | 91 | QLabel *linuxLogo = new QLabel( this ); |
90 | QImage logo2 = Resource::loadImage( "logo/tux-logo" ); | 92 | QImage logo2 = Resource::loadImage( "logo/tux-logo" ); |
91 | logo2 = logo2.smoothScale( 55, 60 ); | 93 | logo2 = logo2.smoothScale( 55, 60 ); |
92 | QPixmap logo2Pixmap; | 94 | QPixmap logo2Pixmap; |
93 | logo2Pixmap.convertFromImage( logo2 ); | 95 | logo2Pixmap.convertFromImage( logo2 ); |
94 | linuxLogo->setPixmap( logo2Pixmap ); | 96 | linuxLogo->setPixmap( logo2Pixmap ); |
95 | linuxLogo->setFixedSize( 60, 60 ); | 97 | linuxLogo->setFixedSize( 60, 60 ); |
96 | hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); | 98 | hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); |
97 | 99 | ||
98 | QLabel *kernelVersion = new QLabel( this ); | 100 | QLabel *kernelVersion = new QLabel( this ); |
99 | kernelVersion->setText( kernelVersionString ); | 101 | kernelVersion->setText( kernelVersionString ); |
100 | hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); | 102 | hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); |
101 | 103 | ||
102 | 104 | ||
103 | QHBoxLayout *hb3 = new QHBoxLayout( vb ); | 105 | QHBoxLayout *hb3 = new QHBoxLayout( vb ); |
104 | hb3->setSpacing( 2 ); | 106 | hb3->setSpacing( 2 ); |
105 | 107 | ||
106 | QLabel *palmtopLogo3 = new QLabel( this ); | 108 | QLabel *palmtopLogo3 = new QLabel( this ); |
107 | QImage logo3 = Resource::loadImage( "SystemInfo" ); | 109 | QImage logo3 = Resource::loadImage( "SystemInfo" ); |
108 | logo3 = logo3.smoothScale( 50, 55 ); | 110 | logo3 = logo3.smoothScale( 50, 55 ); |
109 | QPixmap logo3Pixmap; | 111 | QPixmap logo3Pixmap; |
110 | logo3Pixmap.convertFromImage( logo3 ); | 112 | logo3Pixmap.convertFromImage( logo3 ); |
111 | palmtopLogo3->setPixmap( logo3Pixmap ); | 113 | palmtopLogo3->setPixmap( logo3Pixmap ); |
112 | palmtopLogo3->setFixedSize( 60, 60 ); | 114 | palmtopLogo3->setFixedSize( 60, 60 ); |
113 | hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); | 115 | hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); |
114 | 116 | ||
115 | // QString systemString = tr( "<b>System</b><p>System: ") + ODevice::inst()->systemString() | 117 | // QString systemString = tr( "<b>System</b><p>System: ") + ODevice::inst()->systemString() |
116 | QString systemString = "<b>"+ ODevice::inst()->systemString()+"</b>" | 118 | QString systemString = "<b>"+ ODevice::inst()->systemString()+"</b>" |
117 | +tr("<p>Version: " ) + ODevice::inst()->systemVersionString() | 119 | +tr("<p>Version: " ) + ODevice::inst()->systemVersionString() |
118 | +tr("<p>Model: ") + ODevice::inst()->modelString() | 120 | +tr("<p>Model: ") + ODevice::inst()->modelString() |
119 | +tr("<p>Vendor: ") + ODevice::inst()->vendorString(); | 121 | +tr("<p>Vendor: ") + ODevice::inst()->vendorString(); |
120 | 122 | ||
121 | QLabel *systemVersion = new QLabel( this ); | 123 | QLabel *systemVersion = new QLabel( this ); |
122 | systemVersion->setText( systemString ); | 124 | systemVersion->setText( systemString ); |
123 | hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); | 125 | hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); |
124 | 126 | ||
127 | QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); | ||
125 | } | 128 | } |
126 | 129 | ||
127 | VersionInfo::~VersionInfo() | 130 | VersionInfo::~VersionInfo() |
128 | { | 131 | { |
129 | } | 132 | } |
130 | 133 | ||