summaryrefslogtreecommitdiff
authordrw <drw>2002-11-17 02:14:03 (UTC)
committer drw <drw>2002-11-17 02:14:03 (UTC)
commit9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2 (patch) (side-by-side diff)
treef84b36548fa91496c0c100c96a3fa1512ec8b108
parent5a1f5ba99dfb754f1be4500dd55dca42b36413b8 (diff)
downloadopie-9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2.zip
opie-9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2.tar.gz
opie-9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2.tar.bz2
Start of What's This for Sysinfo, plus some code tweaks
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/load.cpp9
-rw-r--r--noncore/settings/sysinfo/memory.cpp10
-rw-r--r--noncore/settings/sysinfo/opie-sysinfo.control2
-rw-r--r--noncore/settings/sysinfo/storage.cpp39
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp2
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp15
6 files changed, 53 insertions, 24 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,142 +1,147 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <stdio.h>
+
+#include <qfile.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qpixmap.h>
-#include <qtimer.h>
-#include <qfile.h>
#include <qtextstream.h>
+#include <qtimer.h>
+#include <qwhatsthis.h>
+
#include "load.h"
LoadInfo::LoadInfo( QWidget *parent, const char *name, WFlags f )
: QWidget( parent, name, f )
{
QVBoxLayout *vb = new QVBoxLayout( this, 6 );
QString cpuInfo = getCpuInfo();
if ( !cpuInfo.isNull() )
vb->addWidget( new QLabel( cpuInfo, this ) );
vb->addWidget( new Load( this ), 100 );
QLabel *l = new QLabel( this );
l->setPixmap( makeLabel( red, tr("Application CPU usage (%)") ) );
vb->addWidget( l, 1 );
l = new QLabel( this );
l->setPixmap( makeLabel( green, tr("System CPU usage (%)") ) );
vb->addWidget( l, 1 );
vb->addStretch(50);
+
+ QWhatsThis::add( this, tr( "This page shows how much this device's processor is being used." ) );
}
QPixmap LoadInfo::makeLabel( const QColor &col, const QString &text )
{
int h = fontMetrics().height();
QPixmap pm( 20 + fontMetrics().width( text ), h );
QPainter p( &pm );
p.fillRect( pm.rect(), colorGroup().background() );
p.fillRect( 0, h/2-4, 18, h/2+3, black );
p.setPen( col );
p.drawLine( 2, h/2, 15, h/2 );
p.setPen( colorGroup().text() );
p.drawText( 20, fontMetrics().ascent(), text );
return pm;
}
QString LoadInfo::getCpuInfo()
{
bool haveInfo = FALSE;
QString info = tr("Type: ");
QFile f( "/proc/cpuinfo" );
if ( f.open( IO_ReadOnly ) ) {
QTextStream ts( &f );
while ( !ts.atEnd() ) {
QString s = ts.readLine();
if ( s.find( "model name" ) == 0 ) {
info += s.mid( s.find( ':' ) + 2 );
haveInfo = TRUE;
} else if ( s.find( "cpu MHz" ) == 0 ) {
double mhz = s.mid( s.find( ':' ) + 2 ).toDouble();
info += " " + QString::number( mhz, 'f', 0 );
info += "MHz";
break;
} else if ( s.find( "Processor" ) == 0 ) {
info += s.mid( s.find( ':' ) + 2 );
haveInfo = TRUE;
break;
#ifdef __MIPSEL__
} else if ( s.find( "cpu model" ) == 0 ) {
info += " " + s.mid( s.find( ':' ) + 2 );
break;
} else if ( s.find( "cpu" ) == 0 ) {
info += s.mid( s.find( ':' ) + 2 );
haveInfo = TRUE;
#endif
}
}
}
if ( !haveInfo )
info = QString();
return info;
}
Load::Load( QWidget *parent, const char *name, WFlags f )
: QWidget( parent, name, f )
{
setMinimumHeight( 30 );
setBackgroundColor( black );
points = 100;
setMinimumWidth( points );
userLoad = new double [points];
systemLoad = new double [points];
for ( int i = 0; i < points; i++ ) {
userLoad[i] = 0.0;
systemLoad[i] = 0.0;
}
maxLoad = 1.3;
QTimer *timer = new QTimer( this );
connect( timer, SIGNAL(timeout()), SLOT(timeout()) );
timer->start( 2000 );
gettimeofday( &last, 0 );
first = TRUE;
timeout();
}
void Load::paintEvent( QPaintEvent *ev )
{
QPainter p( this );
int h = height() - 5;
int mult = (int)(h / maxLoad);
p.setPen( gray );
p.drawLine( 0, h - mult, width(), h - mult );
p.drawText( 0, h - mult, "100" );
p.drawText( 0, h, "0" );
p.setPen( green );
for ( int i = 1; i < points; i++ ) {
int x1 = (i - 1) * width() / points;
int x2 = i * width() / points;
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 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qlabel.h>
-#include <qtimer.h>
#include <qfile.h>
-#include <qtextstream.h>
#include <qlayout.h>
+#include <qtextstream.h>
+#include <qtimer.h>
+#include <qwhatsthis.h>
+
#include "graph.h"
#include "memory.h"
MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags f )
- : QWidget( parent, name, f )
+ : QWidget( parent, name, WStyle_ContextHelp )
{
QVBoxLayout *vb = new QVBoxLayout( this, 5 );
totalMem = new QLabel( this );
vb->addWidget( totalMem );
data = new GraphData();
// graph = new PieGraph( this );
graph = new BarGraph( this );
graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
vb->addWidget( graph, 1 );
graph->setData( data );
legend = new GraphLegend( this );
vb->addWidget( legend );
legend->setData( data );
vb->addStretch( 1 );
updateData();
QTimer *t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
t->start( 5000 );
+
+ 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." ) );
}
MemoryInfo::~MemoryInfo()
{
delete data;
}
void MemoryInfo::updateData()
{
QFile file( "/proc/meminfo" );
if ( file.open( IO_ReadOnly ) ) {
QTextStream t( &file );
QString dummy = t.readLine(); // title
t >> dummy;
int total, used, memfree, shared, buffers, cached;
t >> total;
total /= 1000;
t >> used;
used /= 1000;
t >> memfree;
memfree /= 1000;
t >> shared;
shared /= 1000;
t >> buffers;
buffers /= 1000;
t >> cached;
cached /= 1000;
int realUsed = total - ( buffers + cached + memfree );
data->clear();
data->addItem( tr("Used (%1 kB)").arg(realUsed), realUsed );
data->addItem( tr("Buffers (%1 kB)").arg(buffers), buffers );
data->addItem( tr("Cached (%1 kB)").arg(cached), cached );
data->addItem( tr("Free (%1 kB)").arg(memfree), memfree );
totalMem->setText( tr( "Total Memory: %1 kB" ).arg( total ) );
graph->repaint( FALSE );
legend->update();
}
}
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 @@
Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/sysinfo
Priority: optional
Section: opie/applications
-Maintainer: Dan Williams <wiliamsdr@acm.org>
+Maintainer: Dan Williams <williamsdr@acm.org>
Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION
Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
Description: System Information dialog
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,234 +1,251 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
// additions copyright 2002 by L.J. Potter
#include <qlabel.h>
#include <qlayout.h>
#include <qtimer.h>
-#include <qlayout.h>
+#include <qwhatsthis.h>
+
#include "graph.h"
#include "storage.h"
#include <stdio.h>
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
#include <sys/vfs.h>
#include <mntent.h>
#endif
StorageInfo::StorageInfo( QWidget *parent, const char *name )
: QWidget( parent, name )
{
vb = 0;
disks.setAutoDelete(TRUE);
lines.setAutoDelete(TRUE);
updateMounts();
startTimer( 5000 );
}
void StorageInfo::timerEvent(QTimerEvent*)
{
updateMounts();
}
static bool isCF(const QString& m)
{
FILE* f = fopen("/var/run/stab", "r");
if (!f) f = fopen("/var/state/pcmcia/stab", "r");
if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
if ( f ) {
char line[1024];
char devtype[80];
char devname[80];
while ( fgets( line, 1024, f ) ) {
// 0 ide ide-cs 0 hda 3 0
if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) {
if ( QString(devtype) == "ide" && m.find(devname)>0 ) {
fclose(f);
return TRUE;
}
}
}
fclose(f);
}
return FALSE;
}
void StorageInfo::updateMounts()
{
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
struct mntent *me;
FILE *mntfp = setmntent( "/etc/mtab", "r" );
QStringList curdisks;
QStringList curfs;
QStringList mountList;
QStringList fsT;
bool rebuild = FALSE;
int n=0;
if ( mntfp ) {
while ( (me = getmntent( mntfp )) != 0 ) {
QString fs = me->mnt_fsname;
qDebug(fs+" "+(QString)me->mnt_type);
if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
|| fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd"
|| fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") {
n++;
curdisks.append(fs);
QString d = me->mnt_dir;
curfs.append(d);
QString mount = me->mnt_dir;
mountList.append(mount);
QString t = me->mnt_type;
fsT.append(t);
if ( !disks.find(d) )
rebuild = TRUE;
}
}
endmntent( mntfp );
}
if ( rebuild || n != (int)disks.count() ) {
disks.clear();
lines.clear();
delete vb;
vb = new QVBoxLayout( this, n > 3 ? 1 : 5 );
bool frst=TRUE;
QStringList::ConstIterator it=curdisks.begin();
QStringList::ConstIterator fsit=curfs.begin();
QStringList::ConstIterator fsmount=mountList.begin();
QStringList::ConstIterator fsTit=fsT.begin();
for (; it!=curdisks.end(); ++it, ++fsit) {
if ( !frst ) {
QFrame *f = new QFrame( this );
vb->addWidget(f);
f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
lines.append(f);
f->show();
} frst=FALSE;
QString humanname=*it;
// qDebug(humanname);
if ( isCF(humanname) )
- humanname = tr("CF Card: "+*fsmount+" "+*fsTit+" ");
+ humanname = tr( "CF Card: " );
else if ( humanname == "/dev/hda1" )
- humanname = tr("Hard Disk "+*fsmount+" "+*fsTit+" ");
+ humanname = tr( "Hard Disk " );
else if ( humanname.left(9) == "/dev/mmcd" )
- humanname = tr("SD Card "+*fsmount+" "+*fsTit+" ");
+ humanname = tr( "SD Card " );
else if ( humanname.left(7) == "/dev/hd" )
- humanname = tr("Hard Disk") + " " + humanname.mid(7)+" "+*fsmount+" "+*fsTit+" ";
+ humanname = tr( "Hard Disk /dev/hd " );
else if ( humanname.left(7) == "/dev/sd" )
- humanname = tr("SCSI Hard Disk") + " " + humanname.mid(7)+" "+*fsmount+" "+*fsTit+" ";
+ humanname = tr( "SCSI Hard Disk /dev/sd " );
else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" )
- humanname = tr("Int. Storage "+*fsmount+" "+*fsTit+"\n");
+ humanname = tr( "Int. Storage " );
else if ( humanname.left(14) == "/dev/mtdblock/" )
- humanname = tr("Int. Storage") + " " + humanname.mid(14)+" "+*fsmount+" "+*fsTit+" ";
+ humanname = tr( "Int. Storage /dev/mtdblock/ " );
else if ( humanname.left(13) == "/dev/mtdblock" )
- humanname = tr("Int. Storage") + " " + humanname.mid(13)+" "+*fsmount+" "+*fsTit+" ";
- else if ( humanname.left(9) == "/dev/root" )
- humanname = tr("Int. Storage "+*fsmount+" "+*fsTit+" ");
+ humanname = tr( "Int. Storage /dev/mtdblock " );
+ else if ( humanname.left(9) == "/dev/root" )
+ humanname = tr( "Int. Storage " );
// etc.
+ humanname.append( *fsmount );
+ humanname.append( " " );
+ humanname.append( *fsTit );
+ humanname.append( " " );
+
MountInfo* mi = new MountInfo( *fsit, humanname, this );
vb->addWidget(mi);
disks.insert(*fsit,mi);
mi->show();
fsmount++;fsTit++;
+ QString tempstr = humanname.left( 2 );
+ if ( tempstr == tr( "CF" ) )
+ QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) );
+ else if ( tempstr == tr( "Ha" ) )
+ QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
+ else if ( tempstr == tr( "SD" ) )
+ QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) );
+ else if ( tempstr == tr( "SC" ) )
+ QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
+ else if ( tempstr == tr( "In" ) )
+ 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." ) );
}
vb->addStretch();
} else {
// just update them
for (QDictIterator<MountInfo> i(disks); i.current(); ++i)
i.current()->updateData();
}
#endif
}
MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name )
: QWidget( parent, name ), title(ttl)
{
qDebug("new path is "+path);
fs = new FileSystem( path );
QVBoxLayout *vb = new QVBoxLayout( this, 3 );
totalSize = new QLabel( this );
vb->addWidget( totalSize );
data = new GraphData();
graph = new BarGraph( this );
graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
vb->addWidget( graph, 1 );
graph->setData( data );
legend = new GraphLegend( this );
legend->setOrientation(Horizontal);
vb->addWidget( legend );
legend->setData( data );
updateData();
}
MountInfo::~MountInfo()
{
delete data;
delete fs;
}
void MountInfo::updateData()
{
fs->update();
long mult = fs->blockSize() / 1024;
long div = 1024 / fs->blockSize();
if ( !mult ) mult = 1;
if ( !div ) div = 1;
long total = fs->totalBlocks() * mult / div;
long avail = fs->availBlocks() * mult / div;
long used = total - avail;
totalSize->setText( title + tr(" : %1 kB").arg( total ) );
data->clear();
data->addItem( tr("Used (%1 kB)").arg(used), used );
data->addItem( tr("Available (%1 kB)").arg(avail), avail );
graph->repaint( FALSE );
legend->update();
graph->show();
legend->show();
}
//---------------------------------------------------------------------------
FileSystem::FileSystem( const QString &p )
: fspath( p ), blkSize(512), totalBlks(0), availBlks(0)
{
update();
}
void FileSystem::update()
{
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
struct statfs fs;
if ( !statfs( fspath.latin1(), &fs ) ) {
blkSize = fs.f_bsize;
totalBlks = fs.f_blocks;
availBlks = fs.f_bavail;
} else {
blkSize = 0;
totalBlks = 0;
availBlks = 0;
}
#endif
}
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 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************
**
** Enhancements by: Dan Williams, <williamsdr@acm.org>
**
**********************************************************************/
#include "memory.h"
#include "load.h"
#include "storage.h"
#include "processinfo.h"
#include "modulesinfo.h"
#include "versioninfo.h"
#include "sysinfo.h"
#include <opie/otabwidget.h>
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qlayout.h>
SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
- : QWidget( parent, name, f )
+ : QWidget( parent, name, WStyle_ContextHelp )
{
setIcon( Resource::loadPixmap( "system_icon" ) );
setCaption( tr("System Info") );
resize( 220, 180 );
Config config( "qpe" );
config.setGroup( "Appearance" );
bool advanced = config.readBoolEntry( "Advanced", TRUE );
QVBoxLayout *lay = new QVBoxLayout( this );
OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global );
lay->addWidget( tab );
tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") );
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
tab->addTab( new StorageInfo( tab ), "sysinfo/storagetabicon.png", tr("Storage") );
#endif
tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon.png", tr("CPU") );
if ( advanced )
{
tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon.png", tr("Process") );
tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon.png", tr("Modules") );
}
tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") );
tab->setCurrentTab( tr( "Memory" ) );
}
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 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qpe/resource.h>
#include <qpe/version.h>
-
+#include <qfile.h>
+#include <qimage.h>
#include <qlabel.h>
+#include <qlayout.h>
#include <qpixmap.h>
#include <qpainter.h>
-#include <qimage.h>
-#include <qtimer.h>
-#include <qfile.h>
#include <qtextstream.h>
-#include <qlayout.h>
+#include <qtimer.h>
+#include <qwhatsthis.h>
+
#include "versioninfo.h"
#include <opie/odevice.h>
+
using namespace Opie;
VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
: QWidget( parent, name, f )
{
setMinimumSize( 200, 150 );
QVBoxLayout *vb = new QVBoxLayout( this, 4 );
QString kernelVersionString;
QFile file( "/proc/version" );
if ( file.open( IO_ReadOnly ) ) {
QTextStream t( &file );
QString v;
t >> v; t >> v; t >> v;
v = v.left( 20 );
kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>";
t >> v;
kernelVersionString += tr( "Compiled by: " ) + v;
file.close();
}
QString palmtopVersionString;
palmtopVersionString = tr( "<b>Opie</b><p>Version: " ) + QPE_VERSION + "<p>";
#ifdef QPE_VENDOR
QString builder = QPE_VENDOR;
#else
QString builder = "Unknown";
#endif
palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>";
palmtopVersionString += tr( "Built on: " ) + __DATE__;
QHBoxLayout *hb1 = new QHBoxLayout( vb );
hb1->setSpacing( 2 );
QLabel *palmtopLogo = new QLabel( this );
QImage logo1 = Resource::loadImage( "logo/opielogo" );
logo1 = logo1.smoothScale( 50, 55 );
QPixmap logo1Pixmap;
logo1Pixmap.convertFromImage( logo1 );
palmtopLogo->setPixmap( logo1Pixmap );
palmtopLogo->setFixedSize( 60, 60 );
hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
QLabel *palmtopVersion = new QLabel( this );
palmtopVersion->setText( palmtopVersionString );
hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
QHBoxLayout *hb2 = new QHBoxLayout( vb );
hb1->setSpacing( 2 );
QLabel *linuxLogo = new QLabel( this );
QImage logo2 = Resource::loadImage( "logo/tux-logo" );
logo2 = logo2.smoothScale( 55, 60 );
QPixmap logo2Pixmap;
logo2Pixmap.convertFromImage( logo2 );
linuxLogo->setPixmap( logo2Pixmap );
linuxLogo->setFixedSize( 60, 60 );
hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
QLabel *kernelVersion = new QLabel( this );
kernelVersion->setText( kernelVersionString );
hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
QHBoxLayout *hb3 = new QHBoxLayout( vb );
hb3->setSpacing( 2 );
QLabel *palmtopLogo3 = new QLabel( this );
QImage logo3 = Resource::loadImage( "SystemInfo" );
logo3 = logo3.smoothScale( 50, 55 );
QPixmap logo3Pixmap;
logo3Pixmap.convertFromImage( logo3 );
palmtopLogo3->setPixmap( logo3Pixmap );
palmtopLogo3->setFixedSize( 60, 60 );
hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
// QString systemString = tr( "<b>System</b><p>System: ") + ODevice::inst()->systemString()
QString systemString = "<b>"+ ODevice::inst()->systemString()+"</b>"
+tr("<p>Version: " ) + ODevice::inst()->systemVersionString()
+tr("<p>Model: ") + ODevice::inst()->modelString()
+tr("<p>Vendor: ") + ODevice::inst()->vendorString();
QLabel *systemVersion = new QLabel( this );
systemVersion->setText( systemString );
hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
-
+
+ QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
}
VersionInfo::~VersionInfo()
{
}