summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo
Side-by-side diff
Diffstat (limited to 'noncore/settings/sysinfo') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/.cvsignore3
-rw-r--r--noncore/settings/sysinfo/Makefile.in193
-rw-r--r--noncore/settings/sysinfo/graph.cpp183
-rw-r--r--noncore/settings/sysinfo/graph.h89
-rw-r--r--noncore/settings/sysinfo/load.cpp207
-rw-r--r--noncore/settings/sysinfo/load.h60
-rw-r--r--noncore/settings/sysinfo/main.cpp34
-rw-r--r--noncore/settings/sysinfo/memory.cpp94
-rw-r--r--noncore/settings/sysinfo/memory.h48
-rw-r--r--noncore/settings/sysinfo/qpe-sysinfo.control9
-rw-r--r--noncore/settings/sysinfo/storage.cpp220
-rw-r--r--noncore/settings/sysinfo/storage.h87
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp53
-rw-r--r--noncore/settings/sysinfo/sysinfo.h29
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro25
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp109
-rw-r--r--noncore/settings/sysinfo/versioninfo.h34
17 files changed, 1477 insertions, 0 deletions
diff --git a/noncore/settings/sysinfo/.cvsignore b/noncore/settings/sysinfo/.cvsignore
new file mode 100644
index 0000000..edfa921
--- a/dev/null
+++ b/noncore/settings/sysinfo/.cvsignore
@@ -0,0 +1,3 @@
+moc_*
+*.moc
+Makefile
diff --git a/noncore/settings/sysinfo/Makefile.in b/noncore/settings/sysinfo/Makefile.in
new file mode 100644
index 0000000..1149304
--- a/dev/null
+++ b/noncore/settings/sysinfo/Makefile.in
@@ -0,0 +1,193 @@
+#############################################################################
+
+####### Compiler, tools and options
+
+CXX = $(SYSCONF_CXX) $(QT_CXX_MT)
+CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
+CC = $(SYSCONF_CC) $(QT_C_MT)
+CFLAGS = $(SYSCONF_CFLAGS)
+INCPATH = -I$(QPEDIR)/include
+LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
+LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
+MOC = $(SYSCONF_MOC)
+UIC = $(SYSCONF_UIC)
+
+####### Target
+
+DESTDIR = $(QPEDIR)/bin/
+VER_MAJ = 1
+VER_MIN = 0
+VER_PATCH = 0
+TARGET = sysinfo
+TARGET1 = lib$(TARGET).so.$(VER_MAJ)
+
+####### Files
+
+HEADERS = memory.h \
+ graph.h \
+ load.h \
+ storage.h \
+ versioninfo.h \
+ sysinfo.h
+SOURCES = main.cpp \
+ memory.cpp \
+ graph.cpp \
+ load.cpp \
+ storage.cpp \
+ versioninfo.cpp \
+ sysinfo.cpp
+OBJECTS = main.o \
+ memory.o \
+ graph.o \
+ load.o \
+ storage.o \
+ versioninfo.o \
+ sysinfo.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = moc_memory.cpp \
+ moc_graph.cpp \
+ moc_load.cpp \
+ moc_storage.cpp \
+ moc_versioninfo.cpp \
+ moc_sysinfo.cpp
+OBJMOC = moc_memory.o \
+ moc_graph.o \
+ moc_load.o \
+ moc_storage.o \
+ moc_versioninfo.o \
+ moc_sysinfo.o
+
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(DESTDIR)$(TARGET)
+
+$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
+ $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake:
+ tmake sysinfo.pro
+
+clean:
+ -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
+ -rm -f *~ core
+ -rm -f allmoc.cpp
+
+####### Extension Modules
+
+listpromodules:
+ @echo
+
+listallmodules:
+ @echo
+
+listaddonpromodules:
+ @echo
+
+listaddonentmodules:
+ @echo
+
+
+REQUIRES=
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+
+####### Compile
+
+main.o: main.cpp \
+ sysinfo.h \
+ $(QPEDIR)/include/qpe/qpeapplication.h
+
+memory.o: memory.cpp \
+ graph.h \
+ memory.h
+
+graph.o: graph.cpp \
+ graph.h
+
+load.o: load.cpp \
+ load.h
+
+storage.o: storage.cpp \
+ graph.h \
+ storage.h
+
+versioninfo.o: versioninfo.cpp \
+ $(QPEDIR)/include/qpe/resource.h \
+ $(QPEDIR)/include/qpe/version.h \
+ versioninfo.h
+
+sysinfo.o: sysinfo.cpp \
+ memory.h \
+ load.h \
+ storage.h \
+ versioninfo.h \
+ sysinfo.h \
+ $(QPEDIR)/include/qpe/resource.h
+
+moc_memory.o: moc_memory.cpp \
+ memory.h
+
+moc_graph.o: moc_graph.cpp \
+ graph.h
+
+moc_load.o: moc_load.cpp \
+ load.h
+
+moc_storage.o: moc_storage.cpp \
+ storage.h
+
+moc_versioninfo.o: moc_versioninfo.cpp \
+ versioninfo.h
+
+moc_sysinfo.o: moc_sysinfo.cpp \
+ sysinfo.h
+
+moc_memory.cpp: memory.h
+ $(MOC) memory.h -o moc_memory.cpp
+
+moc_graph.cpp: graph.h
+ $(MOC) graph.h -o moc_graph.cpp
+
+moc_load.cpp: load.h
+ $(MOC) load.h -o moc_load.cpp
+
+moc_storage.cpp: storage.h
+ $(MOC) storage.h -o moc_storage.cpp
+
+moc_versioninfo.cpp: versioninfo.h
+ $(MOC) versioninfo.h -o moc_versioninfo.cpp
+
+moc_sysinfo.cpp: sysinfo.h
+ $(MOC) sysinfo.h -o moc_sysinfo.cpp
+
+
diff --git a/noncore/settings/sysinfo/graph.cpp b/noncore/settings/sysinfo/graph.cpp
new file mode 100644
index 0000000..0b02bf7
--- a/dev/null
+++ b/noncore/settings/sysinfo/graph.cpp
@@ -0,0 +1,183 @@
+/**********************************************************************
+** 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 <qpainter.h>
+#include <qpixmap.h>
+#include "graph.h"
+
+void GraphData::clear()
+{
+ names.clear();
+ values.resize(0);
+}
+
+void GraphData::addItem( const QString &name, int value )
+{
+ names.append( name );
+ values.resize( values.size() + 1 );
+ values[values.size()-1] = value;
+}
+
+Graph::Graph(QWidget *parent, const char *name, WFlags f )
+ : QFrame( parent, name, f )
+{
+}
+
+PieGraph::PieGraph(QWidget *parent, const char *name, WFlags f )
+ : Graph( parent, name, f )
+{
+}
+
+void PieGraph::drawContents( QPainter *p )
+{
+ int size = QMIN( contentsRect().width(), contentsRect().height() ) - 1;
+
+ int total = 0;
+ for ( unsigned i = 0; i < data->count(); i++ )
+ total += data->value(i);
+
+ int angle = 0;
+ for ( unsigned i = 0; i < data->count(); i++ ) {
+ int len;
+ if ( i == data->count() - 1 || !total )
+ len = 5760 - angle;
+ else
+ len = data->value(i) * 5760 / total;
+ QColor col;
+ col.setHsv( i * 360 / data->count(), 255, 255 );
+ p->setBrush( col );
+ p->drawPie ( contentsRect().x(), contentsRect().y(),
+ size, size, angle, len+32 );
+ angle += len;
+ }
+}
+
+BarGraph::BarGraph(QWidget *parent, const char *name, WFlags f )
+ : Graph( parent, name, f )
+{
+ setMinimumHeight( 10 );
+ setMaximumHeight( 45 );
+}
+
+void BarGraph::drawContents( QPainter *p )
+{
+ int h = contentsRect().height();
+ int y = contentsRect().top();
+
+ int total = 0;
+ for ( unsigned i = 0; i < data->count(); i++ )
+ total += data->value(i);
+
+ int pos = 0;
+ for ( unsigned i = 0; i < data->count(); i++ ) {
+ int len;
+ if ( i == data->count() - 1 || !total )
+ len = contentsRect().width() - pos;
+ else
+ len = data->value(i) * contentsRect().width() / total;
+ QColor col;
+ col.setHsv( i * 360 / data->count(), 255, 255 );
+ drawSegment( p, QRect(contentsRect().x() + pos, y, len, h), col );
+ pos += len;
+ }
+}
+
+void BarGraph::drawSegment( QPainter *p, const QRect &r, const QColor &c )
+{
+ if ( QPixmap::defaultDepth() > 8 ) {
+ QColor topgrad = c.light(170);
+ QColor botgrad = c.dark();
+
+ int h1, h2, s1, s2, v1, v2;
+ topgrad.hsv( &h1, &s1, &v1 );
+ botgrad.hsv( &h2, &s2, &v2 );
+ int ng = r.height();
+ for ( int j =0; j < ng; j++ ) {
+ p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1),
+ s1 + ((s2-s1)*j)/(ng-1),
+ v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) );
+ p->drawLine( r.x(), r.top()+j, r.x()+r.width(), r.top()+j );
+ }
+ } else {
+ p->fillRect( r.x(), r.top(), r.width(), r.height(), c );
+ }
+}
+
+
+GraphLegend::GraphLegend( QWidget *parent, const char *name, WFlags f )
+ : QFrame( parent, name, f )
+{
+ horz = FALSE;
+}
+
+void GraphLegend::setOrientation(Orientation o)
+{
+ horz = o == Horizontal;
+}
+
+void GraphLegend::drawContents( QPainter *p )
+{
+ int total = 0;
+ for ( unsigned i = 0; i < data->count(); i++ )
+ total += data->value(i);
+
+ int tw = width()/data->count()-1;
+ int th = height()/(horz ? 1 : data->count());
+ if ( th > p->fontMetrics().height() )
+ th = p->fontMetrics().height();
+ int x = 0;
+ int y = 0;
+ for ( unsigned i = 0; i < data->count(); i++ ) {
+ QColor col;
+ col.setHsv( i * 360 / data->count(), 255, 255 );
+ p->setBrush( col );
+ p->drawRect( x+1, y+1, th - 2, th - 2 );
+ p->drawText( x+th + 1, y + p->fontMetrics().ascent()+1, data->name(i) );
+ if ( horz ) {
+ x += tw;
+ } else {
+ y += th;
+ }
+ }
+}
+
+QSize GraphLegend::sizeHint() const
+{
+ int th = fontMetrics().height() + 2;
+ int maxw = 0;
+ for ( unsigned i = 0; i < data->count(); i++ ) {
+ int w = fontMetrics().width( data->name(i) );
+ if ( w > maxw )
+ maxw = w;
+ }
+ if ( 0 && horz ) {
+ return QSize( maxw * data->count(), th );
+ } else {
+ return QSize( maxw, th * data->count() );
+ }
+}
+
+void GraphLegend::setData( const GraphData *p )
+{
+ data = p;
+ int th = fontMetrics().height();
+ setMinimumHeight( th * ( horz ? 1 : data->count() ) );
+ updateGeometry();
+}
diff --git a/noncore/settings/sysinfo/graph.h b/noncore/settings/sysinfo/graph.h
new file mode 100644
index 0000000..5a65e79
--- a/dev/null
+++ b/noncore/settings/sysinfo/graph.h
@@ -0,0 +1,89 @@
+/**********************************************************************
+** 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 <qframe.h>
+#include <qarray.h>
+#include <qstringlist.h>
+
+class GraphData
+{
+public:
+ void clear();
+ void addItem( const QString &name, int value );
+
+ const QString &name( int i ) const { return names[i]; }
+ int value( int i ) const { return values[i]; }
+ unsigned count() const { return values.size(); }
+
+private:
+ QStringList names;
+ QArray<int> values;
+};
+
+class Graph : public QFrame
+{
+ Q_OBJECT
+public:
+ Graph( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+
+ void setData( const GraphData *p ) { data = p; }
+
+protected:
+ const GraphData *data;
+};
+
+class PieGraph : public Graph
+{
+ Q_OBJECT
+public:
+ PieGraph( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+
+protected:
+ virtual void drawContents( QPainter *p );
+};
+
+class BarGraph : public Graph
+{
+ Q_OBJECT
+public:
+ BarGraph( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+
+protected:
+ virtual void drawContents( QPainter *p );
+ void drawSegment( QPainter *p, const QRect &r, const QColor &c );
+};
+
+class GraphLegend : public QFrame
+{
+ Q_OBJECT
+public:
+ GraphLegend( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+
+ void setData( const GraphData *p );
+ virtual QSize sizeHint() const;
+ void setOrientation(Orientation o);
+
+protected:
+ virtual void drawContents( QPainter *p );
+
+private:
+ const GraphData *data;
+ bool horz;
+};
diff --git a/noncore/settings/sysinfo/load.cpp b/noncore/settings/sysinfo/load.cpp
new file mode 100644
index 0000000..0fcfa6b
--- a/dev/null
+++ b/noncore/settings/sysinfo/load.cpp
@@ -0,0 +1,207 @@
+/**********************************************************************
+** 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 <qlayout.h>
+#include <qlabel.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qtimer.h>
+#include <qfile.h>
+#include <qtextstream.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);
+}
+
+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;
+ p.drawLine( x1, h - systemLoad[i-1] * mult,
+ x2, h - systemLoad[i] * mult );
+ }
+
+ p.setPen( red );
+ for ( int i = 1; i < points; i++ ) {
+ int x1 = (i - 1) * width() / points;
+ int x2 = i * width() / points;
+ p.drawLine( x1, h - userLoad[i-1] * mult,
+ x2, h - userLoad[i] * mult );
+ }
+}
+
+void Load::timeout()
+{
+ int user;
+ int usernice;
+ int sys;
+ int idle;
+ FILE *fp;
+ fp = fopen( "/proc/stat", "r" );
+ fscanf( fp, "cpu %d %d %d %d", &user, &usernice, &sys, &idle );
+ fclose( fp );
+ struct timeval now;
+ gettimeofday( &now, 0 );
+ int tdiff = now.tv_usec - last.tv_usec;
+ tdiff += (now.tv_sec - last.tv_sec) * 1000000;
+ tdiff /= 10000;
+
+ int udiff = user - lastUser;
+ int sdiff = sys - lastSys;
+ if ( tdiff > 0 ) {
+ double uload = (double)udiff / (double)tdiff;
+ double sload = (double)sdiff / (double)tdiff;
+ if ( !first ) {
+ for ( int i = 1; i < points; i++ ) {
+ userLoad[i-1] = userLoad[i];
+ systemLoad[i-1] = systemLoad[i];
+ }
+ userLoad[points-1] = uload;
+ systemLoad[points-1] = sload;
+// scroll( -width()/points, 0, QRect( 0, 0, width() - width()/points + 1, height() ) );
+ repaint( TRUE );
+ double ml = 1.3;
+ /*
+ for ( int i = 0; i < points; i++ ) {
+ if ( userLoad[i] > ml )
+ ml = userLoad[i];
+ }
+ */
+ if ( maxLoad != ml ) {
+ maxLoad = ml;
+ update();
+ }
+ }
+
+ last = now;
+ lastUser = user;
+ lastSys = sys;
+ first = FALSE;
+ } else if ( tdiff < 0 ) {
+ last = now;
+ }
+}
+
diff --git a/noncore/settings/sysinfo/load.h b/noncore/settings/sysinfo/load.h
new file mode 100644
index 0000000..e7f5388
--- a/dev/null
+++ b/noncore/settings/sysinfo/load.h
@@ -0,0 +1,60 @@
+/**********************************************************************
+** 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 <sys/time.h>
+#include <qwidget.h>
+
+/*
+ Little load meter
+*/
+class Load : public QWidget {
+ Q_OBJECT
+public:
+ Load( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+
+protected:
+ void paintEvent( QPaintEvent *ev );
+
+private slots:
+ void timeout();
+
+private:
+ int points;
+ double *userLoad;
+ double *systemLoad;
+ double maxLoad;
+ struct timeval last;
+ int lastUser;
+ int lastUsernice;
+ int lastSys;
+ int lastIdle;
+ bool first;
+};
+
+class LoadInfo : public QWidget
+{
+ Q_OBJECT
+public:
+ LoadInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+
+private:
+ QPixmap makeLabel( const QColor &col, const QString &text );
+ QString getCpuInfo();
+};
diff --git a/noncore/settings/sysinfo/main.cpp b/noncore/settings/sysinfo/main.cpp
new file mode 100644
index 0000000..6e889db
--- a/dev/null
+++ b/noncore/settings/sysinfo/main.cpp
@@ -0,0 +1,34 @@
+/**********************************************************************
+** 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 "sysinfo.h"
+
+#include <qpe/qpeapplication.h>
+
+int main( int argc, char *argv[] )
+{
+ QPEApplication a( argc, argv );
+
+ SystemInfo *si = new SystemInfo();
+ a.showMainWidget( si );
+
+ return a.exec();
+}
+
diff --git a/noncore/settings/sysinfo/memory.cpp b/noncore/settings/sysinfo/memory.cpp
new file mode 100644
index 0000000..781f0df
--- a/dev/null
+++ b/noncore/settings/sysinfo/memory.cpp
@@ -0,0 +1,94 @@
+/**********************************************************************
+** 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 "graph.h"
+#include "memory.h"
+
+MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags f )
+ : QWidget( parent, name, f )
+{
+ 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 );
+}
+
+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/memory.h b/noncore/settings/sysinfo/memory.h
new file mode 100644
index 0000000..696f97c
--- a/dev/null
+++ b/noncore/settings/sysinfo/memory.h
@@ -0,0 +1,48 @@
+/**********************************************************************
+** 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.
+**
+**********************************************************************/
+
+#ifndef MEMORY_H
+#define MEMORY_H
+
+#include <qwidget.h>
+
+class GraphData;
+class Graph;
+class GraphLegend;
+class QLabel;
+
+class MemoryInfo : public QWidget
+{
+ Q_OBJECT
+public:
+ MemoryInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ ~MemoryInfo();
+
+private slots:
+ void updateData();
+
+private:
+ QLabel *totalMem;
+ GraphData *data;
+ Graph *graph;
+ GraphLegend *legend;
+};
+
+#endif
diff --git a/noncore/settings/sysinfo/qpe-sysinfo.control b/noncore/settings/sysinfo/qpe-sysinfo.control
new file mode 100644
index 0000000..e5ed583
--- a/dev/null
+++ b/noncore/settings/sysinfo/qpe-sysinfo.control
@@ -0,0 +1,9 @@
+Files: bin/sysinfo apps/Applications/sysinfo.desktop pics/qpe-logo.png pics/tux-logo.png
+Priority: optional
+Section: qpe/applications
+Maintainer: Warwick Allison <warwick@trolltech.com>
+Architecture: arm
+Version: $QPE_VERSION-3
+Depends: qpe-base ($QPE_VERSION)
+Description: System Information dialog
+ For the Qtopia environment.
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp
new file mode 100644
index 0000000..4e81170
--- a/dev/null
+++ b/noncore/settings/sysinfo/storage.cpp
@@ -0,0 +1,220 @@
+/**********************************************************************
+** 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 <qlayout.h>
+#include <qtimer.h>
+#include <qlayout.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;
+ bool rebuild = FALSE;
+ int n=0;
+ if ( mntfp ) {
+ while ( (me = getmntent( mntfp )) != 0 ) {
+ QString fs = me->mnt_fsname;
+ if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
+ || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" )
+ {
+ n++;
+ curdisks.append(fs);
+ QString d = me->mnt_dir;
+ curfs.append(d);
+ 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();
+ 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;
+ if ( isCF(humanname) )
+ humanname = tr("CF Card");
+ else if ( humanname == "/dev/hda1" )
+ humanname = tr("Hard Disk");
+ else if ( humanname.left(9) == "/dev/mmcd" )
+ humanname = tr("SD Card");
+ else if ( humanname.left(7) == "/dev/hd" )
+ humanname = tr("Hard Disk") + " " + humanname.mid(7);
+ else if ( humanname.left(7) == "/dev/sd" )
+ humanname = tr("SCSI Hard Disk") + " " + humanname.mid(7);
+ else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" )
+ humanname = tr("Internal Storage");
+ else if ( humanname.left(14) == "/dev/mtdblock/" )
+ humanname = tr("Internal Storage") + " " + humanname.mid(14);
+ else if ( humanname.left(13) == "/dev/mtdblock" )
+ humanname = tr("Internal Storage") + " " + humanname.mid(13);
+ // etc.
+ MountInfo* mi = new MountInfo( *fsit, humanname, this );
+ vb->addWidget(mi);
+ disks.insert(*fsit,mi);
+ mi->show();
+ }
+ 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)
+{
+ 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(" total: %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/storage.h b/noncore/settings/sysinfo/storage.h
new file mode 100644
index 0000000..3fa5b79
--- a/dev/null
+++ b/noncore/settings/sysinfo/storage.h
@@ -0,0 +1,87 @@
+/**********************************************************************
+** 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 <qwidget.h>
+#include <qframe.h>
+#include <qlist.h>
+#include <qdict.h>
+
+class QLabel;
+class GraphData;
+class Graph;
+class GraphLegend;
+class FileSystem;
+class MountInfo;
+class QVBoxLayout;
+
+
+class StorageInfo : public QWidget
+{
+ Q_OBJECT
+public:
+ StorageInfo( QWidget *parent=0, const char *name=0 );
+
+protected:
+ void timerEvent(QTimerEvent*);
+
+private:
+ void updateMounts();
+ QDict<MountInfo> disks;
+ QList<QFrame> lines;
+ QVBoxLayout *vb;
+};
+
+class MountInfo : public QWidget
+{
+ Q_OBJECT
+public:
+ MountInfo( const QString &path, const QString &ttl, QWidget *parent=0, const char *name=0 );
+ ~MountInfo();
+
+ void updateData();
+
+private:
+ QString title;
+ FileSystem *fs;
+ QLabel *totalSize;
+ GraphData *data;
+ Graph *graph;
+ GraphLegend *legend;
+};
+
+class FileSystem
+{
+public:
+ FileSystem( const QString &p );
+
+ void update();
+
+ const QString &path() const { return fspath; }
+ long blockSize() const { return blkSize; }
+ long totalBlocks() const { return totalBlks; }
+ long availBlocks() const { return availBlks; }
+
+private:
+ QString fspath;
+ long blkSize;
+ long totalBlks;
+ long availBlks;
+};
+
+
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp
new file mode 100644
index 0000000..bc483aa
--- a/dev/null
+++ b/noncore/settings/sysinfo/sysinfo.cpp
@@ -0,0 +1,53 @@
+/**********************************************************************
+** 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 "memory.h"
+#include "load.h"
+#include "storage.h"
+//#include "graphics.h"
+#include "versioninfo.h"
+#include "sysinfo.h"
+
+
+#include <qpe/resource.h>
+
+#include <qtabwidget.h>
+#include <qlayout.h>
+
+SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f )
+ : QWidget( parent, name, f )
+{
+ setIcon( Resource::loadPixmap( "system_icon" ) );
+ setCaption( tr("System Info") );
+ QVBoxLayout *lay = new QVBoxLayout( this );
+ QTabWidget *tab = new QTabWidget( this );
+ lay->addWidget( tab );
+ tab->addTab( new MemoryInfo( tab ), tr("Memory") );
+#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
+ tab->addTab( new StorageInfo( tab ), tr("Storage") );
+#endif
+ tab->addTab( new LoadInfo( tab ), tr("CPU") );
+// tab->addTab( new Graphics( tab ), tr("Graphics") );
+ tab->addTab( new VersionInfo( tab ), tr("Version") );
+
+ resize( 220, 180 );
+}
+
+
diff --git a/noncore/settings/sysinfo/sysinfo.h b/noncore/settings/sysinfo/sysinfo.h
new file mode 100644
index 0000000..abbf955
--- a/dev/null
+++ b/noncore/settings/sysinfo/sysinfo.h
@@ -0,0 +1,29 @@
+/**********************************************************************
+** 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 <qwidget.h>
+
+class SystemInfo : public QWidget
+{
+ Q_OBJECT
+public:
+ SystemInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+};
+
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
new file mode 100644
index 0000000..0c7d907
--- a/dev/null
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -0,0 +1,25 @@
+TEMPLATE = app
+CONFIG = qt warn_on release
+DESTDIR = $(QPEDIR)/bin
+HEADERS = memory.h \
+ graph.h \
+ load.h \
+ storage.h \
+ versioninfo.h \
+ sysinfo.h
+SOURCES = main.cpp \
+ memory.cpp \
+ graph.cpp \
+ load.cpp \
+ storage.cpp \
+ versioninfo.cpp \
+ sysinfo.cpp
+INTERFACES =
+
+INCLUDEPATH += $(QPEDIR)/include
+DEPENDPATH += $(QPEDIR)/include
+LIBS += -lqpe
+
+TARGET = sysinfo
+
+TRANSLATIONS = ../i18n/de/sysinfo.ts
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
new file mode 100644
index 0000000..d60a445
--- a/dev/null
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -0,0 +1,109 @@
+/**********************************************************************
+** 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 <qlabel.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qimage.h>
+#include <qtimer.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qlayout.h>
+#include "versioninfo.h"
+
+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>Qtopia</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( "qpe-logo" );
+ 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 );
+
+ // Need to do this extra qpainter code with this image becuase for some
+ // reason it doesn't alpha belnd if directly converted to a pixmap
+ QPixmap logo2Pixmap( 60, 60 );
+ QColor bgColor = colorGroup().background();
+ QPainter painter( &logo2Pixmap );
+ painter.fillRect( QRect( 0, 0, 60, 60 ), QBrush( bgColor ) );
+ QImage logo2 = Resource::loadImage( "tux-logo" );
+ logo2 = logo2.smoothScale( 40, 47 );
+ painter.drawImage( 0, 0, logo2 );
+ painter.end();
+ 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 );
+}
+
+VersionInfo::~VersionInfo()
+{
+}
+
diff --git a/noncore/settings/sysinfo/versioninfo.h b/noncore/settings/sysinfo/versioninfo.h
new file mode 100644
index 0000000..1b5c851
--- a/dev/null
+++ b/noncore/settings/sysinfo/versioninfo.h
@@ -0,0 +1,34 @@
+/**********************************************************************
+** 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.
+**
+**********************************************************************/
+
+#ifndef VERSIONINFO_H
+#define VERSIONINFO_H
+
+#include <qwidget.h>
+
+class VersionInfo : public QWidget
+{
+ Q_OBJECT
+public:
+ VersionInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ ~VersionInfo();
+};
+
+#endif