Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

versioninfo.cpp

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #include "versioninfo.h"
00022 
00023 /* OPIE */
00024 #include <opie2/odevice.h>
00025 #include <opie2/oresource.h>
00026 #include <qpe/version.h>
00027 
00028 /* QT */
00029 #include <qfile.h>
00030 #include <qlabel.h>
00031 #include <qlayout.h>
00032 #include <qscrollview.h>
00033 #include <qtextstream.h>
00034 #include <qwhatsthis.h>
00035 
00036 using namespace Opie::Core;
00037 
00038 VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
00039     : QWidget( parent, name, f )
00040 {
00041     setMinimumSize( 200, 150 );
00042 
00043     QVBoxLayout *tmpvb = new QVBoxLayout( this );
00044     QScrollView *sv = new QScrollView( this );
00045     tmpvb->addWidget( sv, 0, 0 );
00046     sv->setResizePolicy( QScrollView::AutoOneFit );
00047     sv->setHScrollBarMode( QScrollView::AlwaysOff );
00048     sv->setVScrollBarMode( QScrollView::AlwaysOff );
00049     sv->setFrameStyle( QFrame::NoFrame );
00050     QWidget *container = new QWidget( sv->viewport() );
00051     sv->addChild( container );
00052 
00053     QVBoxLayout *vb = new QVBoxLayout( container, 3 );
00054 
00055     QString kernelVersionString;
00056     QFile file( "/proc/version" );
00057     if ( file.open( IO_ReadOnly ) )
00058     {
00059         QTextStream t( &file );
00060   QStringList strList;
00061 
00062   strList = QStringList::split(  " " , t.read(),  false );
00063 
00064         kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " );
00065         kernelVersionString.append( strList[2] );
00066         kernelVersionString.append( "<br>" );
00067         kernelVersionString.append( tr( "Compiled by: " ) );
00068         kernelVersionString.append( strList[3] );
00069         kernelVersionString.append("</qt>");
00070         file.close();
00071     }
00072 
00073     QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " );
00074     palmtopVersionString.append( QPE_VERSION );
00075     palmtopVersionString.append( "<br>" );
00076 #ifdef QPE_VENDOR
00077     QString builder = QPE_VENDOR;
00078 #else
00079     QString builder = "Unknown";
00080 #endif
00081     palmtopVersionString.append( tr( "Built against Qt/E " ) );
00082     palmtopVersionString.append( QT_VERSION_STR );
00083     palmtopVersionString.append( "<br>" );
00084     palmtopVersionString.append( tr( "Built on: " ) );
00085     palmtopVersionString.append( __DATE__  );
00086     palmtopVersionString.append( "</qt>" );
00087 
00088     QHBoxLayout *hb1 = new QHBoxLayout( vb );
00089     hb1->setSpacing( 2 );
00090 
00091     QLabel *palmtopLogo = new QLabel( container );
00092     QImage logo1 = Opie::Core::OResource::loadImage( "logo/opielogo" );
00093     logo1 = logo1.smoothScale( 50, 55 );
00094     QPixmap logo1Pixmap;
00095     logo1Pixmap.convertFromImage( logo1 );
00096     palmtopLogo->setPixmap( logo1Pixmap );
00097     palmtopLogo->setFixedSize( 60, 60 );
00098     hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
00099 
00100     QLabel *palmtopVersion = new QLabel( container );
00101     palmtopVersion->setText( palmtopVersionString  );
00102     hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
00103 
00104 
00105     QHBoxLayout *hb2 = new QHBoxLayout( vb );
00106     hb1->setSpacing( 2 );
00107 
00108     QLabel *linuxLogo = new QLabel( container );
00109     QImage logo2 = Opie::Core::OResource::loadImage( "logo/tux-logo" );
00110     logo2 = logo2.smoothScale( 55, 60 );
00111     QPixmap logo2Pixmap;
00112     logo2Pixmap.convertFromImage( logo2 );
00113     linuxLogo->setPixmap( logo2Pixmap );
00114     linuxLogo->setFixedSize( 60, 60 );
00115     hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
00116 
00117     QLabel *kernelVersion = new QLabel( container );
00118     kernelVersion->setText( kernelVersionString );
00119     hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
00120 
00121 
00122     QHBoxLayout *hb3 = new QHBoxLayout( vb );
00123     hb3->setSpacing( 2 );
00124 
00125     QLabel *palmtopLogo3 = new QLabel( container );
00126 
00127     OModel model = ODevice::inst()->model();
00128     QString modelPixmap = "sysinfo/";
00129     if ( model == Model_Zaurus_SLC7x0 )
00130         modelPixmap += "zaurusc700";
00131     else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 )
00132         modelPixmap += "zaurus5500";
00133     else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx )
00134         modelPixmap += "ipaq3600";
00135     else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus )
00136         modelPixmap += "simpad";
00137     else if ( model == Model_Jornada_56x )
00138         modelPixmap += "jornada56x";
00139     else if ( model == Model_Jornada_720 )
00140         modelPixmap += "jornada720";
00141     else
00142         modelPixmap += "pda";
00143 
00144     QImage logo3 = Opie::Core::OResource::loadImage( modelPixmap );
00145 
00146     int width = logo3.width();
00147     int height = logo3.height();
00148     float aspect = float( height ) / width;
00149     logo3 = logo3.smoothScale( 50, 50.0 * aspect );
00150 
00151     QPixmap logo3Pixmap;
00152     logo3Pixmap.convertFromImage( logo3 );
00153     palmtopLogo3->setPixmap( logo3Pixmap );
00154     palmtopLogo3->setFixedSize( 60, 100 );
00155     hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
00156 
00157     QString systemString = "<qt><b>";
00158     systemString.append( ODevice::inst()->systemString() );
00159     systemString.append( "</b>" );
00160     systemString.append( tr( "<p>Version: " ) );
00161     systemString.append( ODevice::inst()->systemVersionString() );
00162     systemString.append( tr( "<br>Model: " ) );
00163     systemString.append( ODevice::inst()->modelString() );
00164     systemString.append( tr( "<br>Vendor: " ) );
00165     systemString.append( ODevice::inst()->vendorString() );
00166     systemString.append("</qt>");
00167 
00168     QLabel *systemVersion = new QLabel( container );
00169     systemVersion->setText( systemString );
00170     hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
00171 
00172     QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
00173 }
00174 
00175 VersionInfo::~VersionInfo()
00176 {
00177 }
00178 

Generated on Sat Nov 5 16:17:58 2005 for OPIE by  doxygen 1.4.2