summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/storage.cpp198
-rw-r--r--noncore/settings/sysinfo/storage.h44
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp2
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp23
4 files changed, 95 insertions, 172 deletions
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp
index eb157ef..c4474d5 100644
--- a/noncore/settings/sysinfo/storage.cpp
+++ b/noncore/settings/sysinfo/storage.cpp
@@ -1,263 +1,187 @@
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
22#include <qpe/storage.h>
23
21#include <qlabel.h> 24#include <qlabel.h>
22#include <qlayout.h> 25#include <qlayout.h>
23#include <qscrollview.h> 26#include <qscrollview.h>
24#include <qtimer.h> 27#include <qtimer.h>
25#include <qwhatsthis.h> 28#include <qwhatsthis.h>
26 29
27#include "graph.h" 30#include "graph.h"
28#include "storage.h" 31#include "storage.h"
29 32
30#include <stdio.h> 33#include <stdio.h>
31 #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 34 #if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
32#include <sys/vfs.h> 35#include <sys/vfs.h>
33#include <mntent.h> 36#include <mntent.h>
34 #endif 37 #endif
35 38
36StorageInfo::StorageInfo( QWidget *parent, const char *name ) 39FileSysInfo::FileSysInfo( QWidget *parent, const char *name )
37 : QWidget( parent, name ) 40 : QWidget( parent, name )
38{ 41{
39 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 42 QVBoxLayout *tmpvb = new QVBoxLayout( this );
40 QScrollView *sv = new QScrollView( this ); 43 QScrollView *sv = new QScrollView( this );
41 tmpvb->addWidget( sv, 0, 0 ); 44 tmpvb->addWidget( sv, 0, 0 );
42 sv->setResizePolicy( QScrollView::AutoOneFit ); 45 sv->setResizePolicy( QScrollView::AutoOneFit );
43 sv->setFrameStyle( QFrame::NoFrame ); 46 sv->setFrameStyle( QFrame::NoFrame );
44 container = new QWidget( sv->viewport() ); 47 container = new QWidget( sv->viewport() );
45 sv->addChild( container ); 48 sv->addChild( container );
46 vb = 0x0; 49 vb = 0x0;
47 50
48 disks.setAutoDelete(TRUE); 51 storage = new StorageInfo( this );
52 connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) );
53
49 lines.setAutoDelete(TRUE); 54 lines.setAutoDelete(TRUE);
55
56 rebuildDisks = TRUE;
50 updateMounts(); 57 updateMounts();
51 startTimer( 5000 ); 58 startTimer( 5000 );
52} 59}
53 60
54void StorageInfo::timerEvent(QTimerEvent*) 61void FileSysInfo::timerEvent(QTimerEvent*)
55{ 62{
56 updateMounts(); 63 updateMounts();
57} 64}
58 65
59static bool isCF(const QString& m) 66void FileSysInfo::updateMounts()
60{
61 FILE* f = fopen("/var/run/stab", "r");
62 if (!f) f = fopen("/var/state/pcmcia/stab", "r");
63 if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
64 if ( f ) {
65 char line[1024];
66 char devtype[80];
67 char devname[80];
68 while ( fgets( line, 1024, f ) ) {
69 // 0 ide ide-cs 0 hda 3 0
70 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) {
71 if ( QString(devtype) == "ide" && m.find(devname)>0 ) {
72 fclose(f);
73 return TRUE;
74 }
75 }
76 }
77 fclose(f);
78 }
79 return FALSE;
80}
81
82void StorageInfo::updateMounts()
83{ 67{
84#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 68 storage->update();
85 struct mntent *me; 69
86 FILE *mntfp = setmntent( "/etc/mtab", "r" ); 70 if ( rebuildDisks )
87 QStringList curdisks; 71 {
88 QStringList curfs; 72 // Cannot auto delete QDict<MountInfo> disks because it seems to delete
89 QStringList mountList; 73 // the filesystem object as well causing a segfault
90 QStringList fsT; 74 MountInfo *mi;
91 bool rebuild = FALSE; 75 for ( QDictIterator<MountInfo> delit(disks); delit.current(); ++delit )
92 int n=0; 76 {
93 if ( mntfp ) { 77 mi = delit.current();
94 while ( (me = getmntent( mntfp )) != 0 ) { 78 mi->fs = 0x0;
95 QString fs = me->mnt_fsname; 79 delete mi;
96 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
97 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd"
98 || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs"
99 || fs.left(5) == "tmpfs" ) {
100 n++;
101 curdisks.append(fs);
102 QString d = me->mnt_dir;
103 curfs.append(d);
104 QString mount = me->mnt_dir;
105 mountList.append(mount);
106 QString t = me->mnt_type;
107 fsT.append(t);
108 if ( !disks.find(d) )
109 rebuild = TRUE;
110 }
111 } 80 }
112 endmntent( mntfp );
113 }
114 if ( rebuild || n != (int)disks.count() ) {
115 disks.clear(); 81 disks.clear();
116 lines.clear(); 82 lines.clear();
83
117 delete vb; 84 delete vb;
118 vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ ); 85 vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ );
119 bool frst=TRUE;
120 QStringList::ConstIterator it = curdisks.begin();
121 QStringList::ConstIterator fsit = curfs.begin();
122 QStringList::ConstIterator fsmount = mountList.begin();
123 QStringList::ConstIterator fsTit = fsT.begin();
124 86
125 for (; it!=curdisks.end(); ++it, ++fsit) { 87 bool frst=TRUE;
126 if ( !frst ) { 88
89 FileSystem *fs;
90 for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it )
91 {
92 fs = it.current();
93
94 if ( !frst )
95 {
127 QFrame *f = new QFrame( container ); 96 QFrame *f = new QFrame( container );
128 vb->addWidget(f); 97 vb->addWidget(f);
129 f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 98 f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
130 lines.append(f); 99 lines.append(f);
131 f->show(); 100 f->show();
132 } frst=FALSE; 101 }
133 QString humanname=*it; 102 frst = FALSE;
134 if ( isCF(humanname) ) 103
135 humanname = tr( "CF Card: " ); 104 MountInfo *mi = new MountInfo( fs, container );
136 else if ( humanname == "/dev/hda1" ) 105 vb->addWidget( mi );
137 humanname = tr( "Hard Disk " ); 106 disks.insert( fs->path(), mi );
138
139 else if ( humanname.left(9) == "/dev/mmcd" )
140 humanname = tr( "SD Card " );
141
142 else if ( humanname.left(7) == "/dev/hd" )
143 humanname = tr( "Hard Disk /dev/hd " );
144
145 else if ( humanname.left(7) == "/dev/sd" )
146 humanname = tr( "SCSI Hard Disk /dev/sd " );
147
148 else if ( humanname == "/dev/mtdblock1"
149 || humanname.left(13) == "/dev/mtdblock"
150 || humanname.left(9) == "/dev/root")
151 humanname = tr( "Int. Storage " );
152
153 else if ( humanname.left(5) == "tmpfs" )
154 humanname = tr( "RAM disk" );
155 // etc.
156 humanname.append( *fsmount );
157 humanname.append( " " );
158 humanname.append( *fsTit );
159 humanname.append( " " );
160
161 MountInfo* mi = new MountInfo( *fsit, humanname, container );
162 vb->addWidget(mi);
163 disks.insert(*fsit,mi);
164 mi->show(); 107 mi->show();
165 fsmount++;fsTit++; 108 QString tempstr = fs->name().left( 2 );
166 QString tempstr = humanname.left( 2 );
167 if ( tempstr == tr( "CF" ) ) 109 if ( tempstr == tr( "CF" ) )
168 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) ); 110 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) );
169 else if ( tempstr == tr( "Ha" ) ) 111 else if ( tempstr == tr( "Ha" ) )
170 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); 112 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
171 else if ( tempstr == tr( "SD" ) ) 113 else if ( tempstr == tr( "SD" ) )
172 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); 114 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) );
173 else if ( tempstr == tr( "SC" ) ) 115 else if ( tempstr == tr( "SC" ) )
174 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); 116 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
175 else if ( tempstr == tr( "In" ) ) 117 else if ( tempstr == tr( "In" ) )
176 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." ) ); 118 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." ) );
177 else if ( tempstr == tr( "RA" ) ) 119 else if ( tempstr == tr( "RA" ) )
178 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) ); 120 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) );
179 } 121 }
180 vb->addStretch(); 122 vb->addStretch();
181 } else { 123 }
182 // just update them 124 else
125 {
183 for (QDictIterator<MountInfo> i(disks); i.current(); ++i) 126 for (QDictIterator<MountInfo> i(disks); i.current(); ++i)
184 i.current()->updateData(); 127 i.current()->updateData();
185 } 128 }
186#endif 129
130 rebuildDisks = FALSE;
187} 131}
188 132
133void FileSysInfo::disksChanged()
134{
135 rebuildDisks = TRUE;
136}
189 137
190MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name ) 138MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name )
191 : QWidget( parent, name ), title(ttl) 139 : QWidget( parent, name )
192{ 140{
193 fs = new FileSystem( path );
194 QVBoxLayout *vb = new QVBoxLayout( this, 3 ); 141 QVBoxLayout *vb = new QVBoxLayout( this, 3 );
195 142
196 totalSize = new QLabel( this ); 143 totalSize = new QLabel( this );
197 vb->addWidget( totalSize ); 144 vb->addWidget( totalSize );
198 145
146 fs = filesys;
147 title = fs->name();
148
199 data = new GraphData(); 149 data = new GraphData();
200 graph = new BarGraph( this ); 150 graph = new BarGraph( this );
201 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 151 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
202 vb->addWidget( graph, 1 ); 152 vb->addWidget( graph, 1 );
203 graph->setData( data ); 153 graph->setData( data );
204 154
205 legend = new GraphLegend( this ); 155 legend = new GraphLegend( this );
206 legend->setOrientation(Horizontal); 156 legend->setOrientation(Horizontal);
207 vb->addWidget( legend ); 157 vb->addWidget( legend );
208 legend->setData( data ); 158 legend->setData( data );
209 159
210 updateData(); 160 updateData();
211} 161}
212 162
213MountInfo::~MountInfo() 163MountInfo::~MountInfo()
214{ 164{
215 delete data; 165 delete data;
216 delete fs; 166 delete fs;
217} 167}
218 168
219void MountInfo::updateData() 169void MountInfo::updateData()
220{ 170{
221 fs->update();
222
223 long mult = fs->blockSize() / 1024; 171 long mult = fs->blockSize() / 1024;
224 long div = 1024 / fs->blockSize(); 172 long div = 1024 / fs->blockSize();
225 if ( !mult ) mult = 1; 173 if ( !mult ) mult = 1;
226 if ( !div ) div = 1; 174 if ( !div ) div = 1;
227 long total = fs->totalBlocks() * mult / div; 175 long total = fs->totalBlocks() * mult / div;
228 long avail = fs->availBlocks() * mult / div; 176 long avail = fs->availBlocks() * mult / div;
229 long used = total - avail; 177 long used = total - avail;
230 totalSize->setText( title + tr(" : %1 kB").arg( total ) ); 178 totalSize->setText( title + tr(" : %1 kB").arg( total ) );
231 data->clear(); 179 data->clear();
232 data->addItem( tr("Used (%1 kB)").arg(used), used ); 180 data->addItem( tr("Used (%1 kB)").arg(used), used );
233 data->addItem( tr("Available (%1 kB)").arg(avail), avail ); 181 data->addItem( tr("Available (%1 kB)").arg(avail), avail );
234 graph->repaint( FALSE ); 182 graph->repaint( FALSE );
235 legend->update(); 183 legend->update();
236 graph->show(); 184 graph->show();
237 legend->show(); 185 legend->show();
238} 186}
239 187
240//---------------------------------------------------------------------------
241
242FileSystem::FileSystem( const QString &p )
243 : fspath( p ), blkSize(512), totalBlks(0), availBlks(0)
244{
245 update();
246}
247
248void FileSystem::update()
249{
250#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
251 struct statfs fs;
252 if ( !statfs( fspath.latin1(), &fs ) ) {
253 blkSize = fs.f_bsize;
254 totalBlks = fs.f_blocks;
255 availBlks = fs.f_bavail;
256 } else {
257 blkSize = 0;
258 totalBlks = 0;
259 availBlks = 0;
260 }
261#endif
262}
263
diff --git a/noncore/settings/sysinfo/storage.h b/noncore/settings/sysinfo/storage.h
index 7e8b4e0..b8564af 100644
--- a/noncore/settings/sysinfo/storage.h
+++ b/noncore/settings/sysinfo/storage.h
@@ -1,89 +1,79 @@
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#include <qwidget.h> 20#include <qwidget.h>
21#include <qframe.h> 21#include <qframe.h>
22#include <qlist.h> 22#include <qlist.h>
23#include <qdict.h> 23#include <qdict.h>
24 24
25class QLabel; 25class QLabel;
26class GraphData; 26class GraphData;
27class Graph; 27class Graph;
28class GraphLegend; 28class GraphLegend;
29class FileSystem; 29class FileSystem;
30class MountInfo; 30class MountInfo;
31class QVBoxLayout; 31class QVBoxLayout;
32class QWidget; 32class QWidget;
33class StorageInfo;
33 34
34 35
35class StorageInfo : public QWidget 36class FileSysInfo : public QWidget
36{ 37{
37 Q_OBJECT 38 Q_OBJECT
38public: 39public:
39 StorageInfo( QWidget *parent=0, const char *name=0 ); 40 FileSysInfo( QWidget *parent=0, const char *name=0 );
40 41
41protected: 42protected:
42 void timerEvent(QTimerEvent*); 43 void timerEvent(QTimerEvent*);
43 44
44private: 45private:
45 void updateMounts(); 46 void updateMounts();
46 QDict<MountInfo> disks; 47
47 QList<QFrame> lines; 48 QWidget *container;
48 QVBoxLayout *vb; 49 QVBoxLayout *vb;
49 QWidget *container; 50
51 StorageInfo *storage;
52 QDict<MountInfo> disks;
53 QList<QFrame> lines;
54
55 bool rebuildDisks;
56
57private slots:
58 void disksChanged();
50}; 59};
51 60
52class MountInfo : public QWidget 61class MountInfo : public QWidget
53{ 62{
54 Q_OBJECT 63 Q_OBJECT
55public: 64public:
56 MountInfo( const QString &path, const QString &ttl, QWidget *parent=0, const char *name=0 ); 65 MountInfo( FileSystem *filesys=0, QWidget *parent=0, const char *name=0 );
57 ~MountInfo(); 66 ~MountInfo();
58 67
59 void updateData(); 68 void updateData();
69
70 FileSystem *fs;
60 71
61private: 72private:
62 QString title; 73 QString title;
63 FileSystem *fs;
64 QLabel *totalSize; 74 QLabel *totalSize;
65 GraphData *data; 75 GraphData *data;
66 Graph *graph; 76 Graph *graph;
67 GraphLegend *legend; 77 GraphLegend *legend;
68}; 78};
69 79
70class FileSystem
71{
72public:
73 FileSystem( const QString &p );
74
75 void update();
76
77 const QString &path() const { return fspath; }
78 long blockSize() const { return blkSize; }
79 long totalBlocks() const { return totalBlks; }
80 long availBlocks() const { return availBlks; }
81
82private:
83 QString fspath;
84 long blkSize;
85 long totalBlks;
86 long availBlks;
87};
88
89
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp
index c3bdae5..0c5a969 100644
--- a/noncore/settings/sysinfo/sysinfo.cpp
+++ b/noncore/settings/sysinfo/sysinfo.cpp
@@ -25,46 +25,46 @@
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
40SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) 40SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags )
41 : QWidget( parent, name, WStyle_ContextHelp ) 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", tr("Memory") ); 55 tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", 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", tr("Storage") ); 57 tab->addTab( new FileSysInfo( tab ), "sysinfo/storagetabicon", tr("Storage") );
58#endif 58#endif
59 tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon", tr("CPU") ); 59 tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon", tr("CPU") );
60 if ( advanced ) 60 if ( advanced )
61 { 61 {
62 tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon", tr("Process") ); 62 tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon", tr("Process") );
63 tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr("Modules") ); 63 tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr("Modules") );
64 } 64 }
65 tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") ); 65 tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", 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 9a444df..801af29 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,144 +1,153 @@
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#include <qfile.h> 24#include <qfile.h>
25#include <qimage.h> 25#include <qimage.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qscrollview.h>
30#include <qtextstream.h> 31#include <qtextstream.h>
31#include <qtimer.h> 32#include <qtimer.h>
32#include <qwhatsthis.h> 33#include <qwhatsthis.h>
33 34
34#include "versioninfo.h" 35#include "versioninfo.h"
35 36
36#include <opie/odevice.h> 37#include <opie/odevice.h>
37 38
38using namespace Opie; 39using namespace Opie;
39 40
40VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 41VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
41 : QWidget( parent, name, f ) 42 : QWidget( parent, name, f )
42{ 43{
43 setMinimumSize( 200, 150 ); 44 setMinimumSize( 200, 150 );
44 45
45 QVBoxLayout *vb = new QVBoxLayout( this, 4 ); 46 QVBoxLayout *tmpvb = new QVBoxLayout( this );
47 QScrollView *sv = new QScrollView( this );
48 tmpvb->addWidget( sv, 0, 0 );
49 sv->setResizePolicy( QScrollView::AutoOneFit );
50 sv->setFrameStyle( QFrame::NoFrame );
51 QWidget *container = new QWidget( sv->viewport() );
52 sv->addChild( container );
53
54 QVBoxLayout *vb = new QVBoxLayout( container, 4 );
46 55
47 QString kernelVersionString; 56 QString kernelVersionString;
48 QFile file( "/proc/version" ); 57 QFile file( "/proc/version" );
49 if ( file.open( IO_ReadOnly ) ) { 58 if ( file.open( IO_ReadOnly ) ) {
50 QTextStream t( &file ); 59 QTextStream t( &file );
51 QString v; 60 QString v;
52 t >> v; t >> v; t >> v; 61 t >> v; t >> v; t >> v;
53 v = v.left( 20 ); 62 v = v.left( 20 );
54 kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ); 63 kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " );
55 kernelVersionString.append( v ); 64 kernelVersionString.append( v );
56 kernelVersionString.append( "<p>" ); 65 kernelVersionString.append( "<p>" );
57 t >> v; 66 t >> v;
58 kernelVersionString.append( tr( "Compiled by: " ) ); 67 kernelVersionString.append( tr( "Compiled by: " ) );
59 kernelVersionString.append( v ); 68 kernelVersionString.append( v );
60 file.close(); 69 file.close();
61 } 70 }
62 71
63 QString palmtopVersionString = tr( "<b>Opie</b><p>Version: " ); 72 QString palmtopVersionString = tr( "<b>Opie</b><p>Version: " );
64 palmtopVersionString.append( QPE_VERSION ); 73 palmtopVersionString.append( QPE_VERSION );
65 palmtopVersionString.append( "<p>" ); 74 palmtopVersionString.append( "<p>" );
66#ifdef QPE_VENDOR 75#ifdef QPE_VENDOR
67 QString builder = QPE_VENDOR; 76 QString builder = QPE_VENDOR;
68#else 77#else
69 QString builder = "Unknown"; 78 QString builder = "Unknown";
70#endif 79#endif
71 palmtopVersionString.append( tr( "Compiled by: " ) ); 80 palmtopVersionString.append( tr( "Compiled by: " ) );
72 palmtopVersionString.append( builder ); 81 palmtopVersionString.append( builder );
73 palmtopVersionString.append( "<p>" ); 82 palmtopVersionString.append( "<p>" );
74 palmtopVersionString.append( tr( "Built on: " ) ); 83 palmtopVersionString.append( tr( "Built on: " ) );
75 palmtopVersionString.append( __DATE__ ); 84 palmtopVersionString.append( __DATE__ );
76 85
77 86
78 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 87 QHBoxLayout *hb1 = new QHBoxLayout( vb );
79 hb1->setSpacing( 2 ); 88 hb1->setSpacing( 2 );
80 89
81 QLabel *palmtopLogo = new QLabel( this ); 90 QLabel *palmtopLogo = new QLabel( container );
82 QImage logo1 = Resource::loadImage( "logo/opielogo" ); 91 QImage logo1 = Resource::loadImage( "logo/opielogo" );
83 logo1 = logo1.smoothScale( 50, 55 ); 92 logo1 = logo1.smoothScale( 50, 55 );
84 QPixmap logo1Pixmap; 93 QPixmap logo1Pixmap;
85 logo1Pixmap.convertFromImage( logo1 ); 94 logo1Pixmap.convertFromImage( logo1 );
86 palmtopLogo->setPixmap( logo1Pixmap ); 95 palmtopLogo->setPixmap( logo1Pixmap );
87 palmtopLogo->setFixedSize( 60, 60 ); 96 palmtopLogo->setFixedSize( 60, 60 );
88 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 97 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
89 98
90 QLabel *palmtopVersion = new QLabel( this ); 99 QLabel *palmtopVersion = new QLabel( container );
91 palmtopVersion->setText( palmtopVersionString ); 100 palmtopVersion->setText( palmtopVersionString );
92 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 101 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
93 102
94 103
95 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 104 QHBoxLayout *hb2 = new QHBoxLayout( vb );
96 hb1->setSpacing( 2 ); 105 hb1->setSpacing( 2 );
97 106
98 QLabel *linuxLogo = new QLabel( this ); 107 QLabel *linuxLogo = new QLabel( container );
99 QImage logo2 = Resource::loadImage( "logo/tux-logo" ); 108 QImage logo2 = Resource::loadImage( "logo/tux-logo" );
100 logo2 = logo2.smoothScale( 55, 60 ); 109 logo2 = logo2.smoothScale( 55, 60 );
101 QPixmap logo2Pixmap; 110 QPixmap logo2Pixmap;
102 logo2Pixmap.convertFromImage( logo2 ); 111 logo2Pixmap.convertFromImage( logo2 );
103 linuxLogo->setPixmap( logo2Pixmap ); 112 linuxLogo->setPixmap( logo2Pixmap );
104 linuxLogo->setFixedSize( 60, 60 ); 113 linuxLogo->setFixedSize( 60, 60 );
105 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 114 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
106 115
107 QLabel *kernelVersion = new QLabel( this ); 116 QLabel *kernelVersion = new QLabel( container );
108 kernelVersion->setText( kernelVersionString ); 117 kernelVersion->setText( kernelVersionString );
109 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 118 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
110 119
111 120
112 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 121 QHBoxLayout *hb3 = new QHBoxLayout( vb );
113 hb3->setSpacing( 2 ); 122 hb3->setSpacing( 2 );
114 123
115 QLabel *palmtopLogo3 = new QLabel( this ); 124 QLabel *palmtopLogo3 = new QLabel( container );
116 QImage logo3 = Resource::loadImage( "sysinfo/pda" ); 125 QImage logo3 = Resource::loadImage( "sysinfo/pda" );
117 logo3 = logo3.smoothScale( 50, 55 ); 126 logo3 = logo3.smoothScale( 50, 55 );
118 QPixmap logo3Pixmap; 127 QPixmap logo3Pixmap;
119 logo3Pixmap.convertFromImage( logo3 ); 128 logo3Pixmap.convertFromImage( logo3 );
120 palmtopLogo3->setPixmap( logo3Pixmap ); 129 palmtopLogo3->setPixmap( logo3Pixmap );
121 palmtopLogo3->setFixedSize( 60, 60 ); 130 palmtopLogo3->setFixedSize( 60, 60 );
122 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); 131 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
123 132
124 QString systemString = "<b>"; 133 QString systemString = "<b>";
125 systemString.append( ODevice::inst()->systemString() ); 134 systemString.append( ODevice::inst()->systemString() );
126 systemString.append( "</b>" ); 135 systemString.append( "</b>" );
127 systemString.append( tr( "<p>Version: " ) ); 136 systemString.append( tr( "<p>Version: " ) );
128 systemString.append( ODevice::inst()->systemVersionString() ); 137 systemString.append( ODevice::inst()->systemVersionString() );
129 systemString.append( tr( "<p>Model: " ) ); 138 systemString.append( tr( "<p>Model: " ) );
130 systemString.append( ODevice::inst()->modelString() ); 139 systemString.append( ODevice::inst()->modelString() );
131 systemString.append( tr( "<p>Vendor: " ) ); 140 systemString.append( tr( "<p>Vendor: " ) );
132 systemString.append( ODevice::inst()->vendorString() ); 141 systemString.append( ODevice::inst()->vendorString() );
133 142
134 QLabel *systemVersion = new QLabel( this ); 143 QLabel *systemVersion = new QLabel( container );
135 systemVersion->setText( systemString ); 144 systemVersion->setText( systemString );
136 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 145 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
137 146
138 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); 147 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
139} 148}
140 149
141VersionInfo::~VersionInfo() 150VersionInfo::~VersionInfo()
142{ 151{
143} 152}
144 153