summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/versioninfo.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo/versioninfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp109
1 files changed, 109 insertions, 0 deletions
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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/resource.h>
22#include <qpe/version.h>
23
24#include <qlabel.h>
25#include <qpixmap.h>
26#include <qpainter.h>
27#include <qimage.h>
28#include <qtimer.h>
29#include <qfile.h>
30#include <qtextstream.h>
31#include <qlayout.h>
32#include "versioninfo.h"
33
34VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
35 : QWidget( parent, name, f )
36{
37 setMinimumSize( 200, 150 );
38
39 QVBoxLayout *vb = new QVBoxLayout( this, 4 );
40
41 QString kernelVersionString;
42 QFile file( "/proc/version" );
43 if ( file.open( IO_ReadOnly ) ) {
44 QTextStream t( &file );
45 QString v;
46 t >> v; t >> v; t >> v;
47 v = v.left( 20 );
48 kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>";
49 t >> v;
50 kernelVersionString += tr( "Compiled by: " ) + v;
51 file.close();
52 }
53
54 QString palmtopVersionString;
55 palmtopVersionString = tr( "<b>Qtopia</b><p>Version: " ) + QPE_VERSION + "<p>";
56#ifdef QPE_VENDOR
57 QString builder = QPE_VENDOR;
58#else
59 QString builder = "Unknown";
60#endif
61 palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>";
62 palmtopVersionString += tr( "Built on: " ) + __DATE__;
63
64
65 QHBoxLayout *hb1 = new QHBoxLayout( vb );
66 hb1->setSpacing( 2 );
67
68 QLabel *palmtopLogo = new QLabel( this );
69 QImage logo1 = Resource::loadImage( "qpe-logo" );
70 logo1 = logo1.smoothScale( 50, 55 );
71 QPixmap logo1Pixmap;
72 logo1Pixmap.convertFromImage( logo1 );
73 palmtopLogo->setPixmap( logo1Pixmap );
74 palmtopLogo->setFixedSize( 60, 60 );
75 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
76
77 QLabel *palmtopVersion = new QLabel( this );
78 palmtopVersion->setText( palmtopVersionString );
79 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
80
81
82 QHBoxLayout *hb2 = new QHBoxLayout( vb );
83 hb1->setSpacing( 2 );
84
85 QLabel *linuxLogo = new QLabel( this );
86
87 // Need to do this extra qpainter code with this image becuase for some
88 // reason it doesn't alpha belnd if directly converted to a pixmap
89 QPixmap logo2Pixmap( 60, 60 );
90 QColor bgColor = colorGroup().background();
91 QPainter painter( &logo2Pixmap );
92 painter.fillRect( QRect( 0, 0, 60, 60 ), QBrush( bgColor ) );
93 QImage logo2 = Resource::loadImage( "tux-logo" );
94 logo2 = logo2.smoothScale( 40, 47 );
95 painter.drawImage( 0, 0, logo2 );
96 painter.end();
97 linuxLogo->setPixmap( logo2Pixmap );
98 linuxLogo->setFixedSize( 60, 60 );
99 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
100
101 QLabel *kernelVersion = new QLabel( this );
102 kernelVersion->setText( kernelVersionString );
103 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
104}
105
106VersionInfo::~VersionInfo()
107{
108}
109