summaryrefslogtreecommitdiff
authorpaule <paule>2007-06-20 10:45:17 (UTC)
committer paule <paule>2007-06-20 10:45:17 (UTC)
commita5bdee12917db73cb6dbc64f3b53516e0d396007 (patch) (unidiff)
tree25ba65aee25963f05750e953ba3e9e2fed2269fd
parentaccbef5e0097a32847dfbaff9f2abfbf39f7595d (diff)
downloadopie-a5bdee12917db73cb6dbc64f3b53516e0d396007.zip
opie-a5bdee12917db73cb6dbc64f3b53516e0d396007.tar.gz
opie-a5bdee12917db73cb6dbc64f3b53516e0d396007.tar.bz2
Fix incorrect device icons being shown for certain devices, and add new icons for various Palm models. Original patch by Marek Va?ut (Marex) <marek.vasut@gmail.com> (fixes bug #1857)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp197
1 files changed, 169 insertions, 28 deletions
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
index 5105b42..0b6883d 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,192 +1,333 @@
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 "versioninfo.h" 21#include "versioninfo.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odevice.h> 24#include <opie2/odevice.h>
25#include <opie2/oresource.h> 25#include <opie2/oresource.h>
26#include <qpe/version.h> 26#include <qpe/version.h>
27 27
28/* QT */ 28/* QT */
29#include <qfile.h> 29#include <qfile.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qscrollview.h> 32#include <qscrollview.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qwhatsthis.h> 34#include <qwhatsthis.h>
35 35
36using namespace Opie::Core; 36using namespace Opie::Core;
37 37
38VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 38VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
39 : QWidget( parent, name, f ) 39 : QWidget( parent, name, f )
40{ 40{
41 setMinimumSize( 200, 150 ); 41 setMinimumSize( 200, 150 );
42 42
43 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 43 QVBoxLayout *tmpvb = new QVBoxLayout( this );
44 QScrollView *sv = new QScrollView( this ); 44 QScrollView *sv = new QScrollView( this );
45 tmpvb->addWidget( sv, 0, 0 ); 45 tmpvb->addWidget( sv, 0, 0 );
46 sv->setResizePolicy( QScrollView::AutoOneFit ); 46 sv->setResizePolicy( QScrollView::AutoOneFit );
47 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 47 sv->setHScrollBarMode( QScrollView::AlwaysOff );
48 sv->setVScrollBarMode( QScrollView::AlwaysOff ); 48 sv->setVScrollBarMode( QScrollView::AlwaysOff );
49 sv->setFrameStyle( QFrame::NoFrame ); 49 sv->setFrameStyle( QFrame::NoFrame );
50 QWidget *container = new QWidget( sv->viewport() ); 50 QWidget *container = new QWidget( sv->viewport() );
51 sv->addChild( container ); 51 sv->addChild( container );
52 52
53 QVBoxLayout *vb = new QVBoxLayout( container, 3 ); 53 QVBoxLayout *vb = new QVBoxLayout( container, 3 );
54 54
55 QString kernelVersionString; 55 QString kernelVersionString;
56 QFile file( "/proc/version" ); 56 QFile file( "/proc/version" );
57 if ( file.open( IO_ReadOnly ) ) 57 if ( file.open( IO_ReadOnly ) )
58 { 58 {
59 QTextStream t( &file ); 59 QTextStream t( &file );
60 QStringList strList; 60 QStringList strList;
61 61
62 strList = QStringList::split( " " , t.read(), false ); 62 strList = QStringList::split( " " , t.read(), false );
63 63
64 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " ); 64 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " );
65 kernelVersionString.append( strList[2] ); 65 kernelVersionString.append( strList[2] );
66 kernelVersionString.append( "<br>" ); 66 kernelVersionString.append( "<br>" );
67 kernelVersionString.append( tr( "Compiled by: " ) ); 67 kernelVersionString.append( tr( "Compiled by: " ) );
68 kernelVersionString.append( strList[3] ); 68 kernelVersionString.append( strList[3] );
69 kernelVersionString.append("</qt>"); 69 kernelVersionString.append("</qt>");
70 file.close(); 70 file.close();
71 } 71 }
72 72
73 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " ); 73 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " );
74 palmtopVersionString.append( QPE_VERSION ); 74 palmtopVersionString.append( QPE_VERSION );
75 palmtopVersionString.append( "<br>" ); 75 palmtopVersionString.append( "<br>" );
76#ifdef QPE_VENDOR 76#ifdef QPE_VENDOR
77 QString builder = QPE_VENDOR; 77 QString builder = QPE_VENDOR;
78#else 78#else
79 QString builder = "Unknown"; 79 QString builder = "Unknown";
80#endif 80#endif
81 palmtopVersionString.append( tr( "Built against Qt/E " ) ); 81 palmtopVersionString.append( tr( "Built against Qt/E " ) );
82 palmtopVersionString.append( QT_VERSION_STR ); 82 palmtopVersionString.append( QT_VERSION_STR );
83 palmtopVersionString.append( "<br>" ); 83 palmtopVersionString.append( "<br>" );
84 palmtopVersionString.append( tr( "Built on: " ) ); 84 palmtopVersionString.append( tr( "Built on: " ) );
85 palmtopVersionString.append( __DATE__ ); 85 palmtopVersionString.append( __DATE__ );
86 palmtopVersionString.append( "</qt>" ); 86 palmtopVersionString.append( "</qt>" );
87 87
88 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 88 QHBoxLayout *hb1 = new QHBoxLayout( vb );
89 hb1->setSpacing( 2 ); 89 hb1->setSpacing( 2 );
90 90
91 QLabel *palmtopLogo = new QLabel( container ); 91 QLabel *palmtopLogo = new QLabel( container );
92 QImage logo1 = Opie::Core::OResource::loadImage( "logo/opielogo" ); 92 QImage logo1 = Opie::Core::OResource::loadImage( "logo/opielogo" );
93 logo1 = logo1.smoothScale( 50, 55 ); 93 logo1 = logo1.smoothScale( 50, 55 );
94 QPixmap logo1Pixmap; 94 QPixmap logo1Pixmap;
95 logo1Pixmap.convertFromImage( logo1 ); 95 logo1Pixmap.convertFromImage( logo1 );
96 palmtopLogo->setPixmap( logo1Pixmap ); 96 palmtopLogo->setPixmap( logo1Pixmap );
97 palmtopLogo->setFixedSize( 60, 60 ); 97 palmtopLogo->setFixedSize( 60, 60 );
98 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 98 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
99 99
100 QLabel *palmtopVersion = new QLabel( container ); 100 QLabel *palmtopVersion = new QLabel( container );
101 palmtopVersion->setText( palmtopVersionString ); 101 palmtopVersion->setText( palmtopVersionString );
102 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 102 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
103 103
104 104
105 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 105 QHBoxLayout *hb2 = new QHBoxLayout( vb );
106 hb1->setSpacing( 2 ); 106 hb1->setSpacing( 2 );
107 107
108 QLabel *linuxLogo = new QLabel( container ); 108 QLabel *linuxLogo = new QLabel( container );
109 QImage logo2 = Opie::Core::OResource::loadImage( "logo/tux-logo" ); 109 QImage logo2 = Opie::Core::OResource::loadImage( "logo/tux-logo" );
110 logo2 = logo2.smoothScale( 55, 60 ); 110 logo2 = logo2.smoothScale( 55, 60 );
111 QPixmap logo2Pixmap; 111 QPixmap logo2Pixmap;
112 logo2Pixmap.convertFromImage( logo2 ); 112 logo2Pixmap.convertFromImage( logo2 );
113 linuxLogo->setPixmap( logo2Pixmap ); 113 linuxLogo->setPixmap( logo2Pixmap );
114 linuxLogo->setFixedSize( 60, 60 ); 114 linuxLogo->setFixedSize( 60, 60 );
115 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 115 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
116 116
117 QLabel *kernelVersion = new QLabel( container ); 117 QLabel *kernelVersion = new QLabel( container );
118 kernelVersion->setText( kernelVersionString ); 118 kernelVersion->setText( kernelVersionString );
119 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 119 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
120 120
121 121
122 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 122 QHBoxLayout *hb3 = new QHBoxLayout( vb );
123 hb3->setSpacing( 2 ); 123 hb3->setSpacing( 2 );
124 124
125 QLabel *palmtopLogo3 = new QLabel( container ); 125 QLabel *palmtopLogo3 = new QLabel( container );
126 126
127 OModel model = ODevice::inst()->model(); 127 OModel model = ODevice::inst()->model();
128 OVendor vendor = ODevice::inst()->vendor();
128 QString modelPixmap = "sysinfo/"; 129 QString modelPixmap = "sysinfo/";
129 if ( model == Model_Zaurus_SLC7x0 )
130 modelPixmap += "zaurusc700";
131 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 )
132 modelPixmap += "zaurus5500";
133 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx )
134 modelPixmap += "ipaq3600";
135 else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus )
136 modelPixmap += "simpad";
137 else if ( model == Model_Jornada_56x )
138 modelPixmap += "jornada56x";
139 else if ( model == Model_Jornada_720 )
140 modelPixmap += "jornada720";
141 else if ( model == Model_HTC_Universal )
142 modelPixmap += "htcuniversal";
143 else if ( model == Model_HTC_Blueangel )
144 modelPixmap += "htcblueangel";
145 else if ( model == Model_HTC_Apache )
146 modelPixmap += "htcapache";
147 else if ( model == Model_HTC_Magician )
148 modelPixmap += "htcmagician";
149 else if ( model == Model_HTC_Himalaya )
150 modelPixmap += "htchimalaya";
151 else if ( model == Model_HTC_Alpine )
152 modelPixmap += "htcalpine";
153 else if ( model == Model_HTC_Beetles )
154 modelPixmap += "htcbeetles";
155 else
156 modelPixmap += "pda";
157 130
131 switch ( vendor ) {
132 /* SHARP */
133 case Vendor_Sharp:
134 {
135 switch ( model ) {
136 /* ZAURUS */
137 case Model_Zaurus_SLC7x0:
138 modelPixmap += "zaurusc700";
139 break;
140 case Model_Zaurus_SL5000:
141 case Model_Zaurus_SL5500:
142 case Model_Zaurus_SLA300:
143 case Model_Zaurus_SLB600:
144 modelPixmap += "zaurus5500";
145 break;
146 default:
147 modelPixmap += "pda";
148 break;
149 }
150 break;
151 }
152 /* HP */
153 case Vendor_HP:
154 {
155 switch ( model ) {
156 /* IPAQ */
157 case Model_iPAQ_H31xx:
158 case Model_iPAQ_H36xx:
159 case Model_iPAQ_H37xx:
160 case Model_iPAQ_H38xx:
161 case Model_iPAQ_H39xx:
162 case Model_iPAQ_H5xxx:
163 modelPixmap += "ipaq3600";
164 break;
165 /* JORNADA */
166 case Model_Jornada_56x:
167 modelPixmap += "jornada56x";
168 break;
169 case Model_Jornada_720:
170 modelPixmap += "jornada720";
171 break;
172 default:
173 modelPixmap += "pda";
174 break;
175 }
176 break;
177 }
178 /* SIEMENS */
179 case Vendor_SIEMENS:
180 {
181 switch ( model )
182 {
183 /* SIMPAD */
184 case Model_SIMpad_CL4:
185 case Model_SIMpad_SL4:
186 case Model_SIMpad_SLC:
187 case Model_SIMpad_TSinus:
188 modelPixmap += "simpad";
189 break;
190 default:
191 modelPixmap += "pda";
192 break;
193 }
194 break;
195 }
196 /* HTC */
197 case Vendor_HTC:
198 {
199 switch ( model ) {
200 case Model_HTC_Universal:
201 modelPixmap += "htcuniversal";
202 break;
203 case Model_HTC_Blueangel:
204 modelPixmap += "htcblueangel";
205 break;
206 case Model_HTC_Apache:
207 modelPixmap += "htcapache";
208 break;
209 case Model_HTC_Magician:
210 modelPixmap += "htcmagician";
211 break;
212 case Model_HTC_Himalaya:
213 modelPixmap += "htchimalaya";
214 break;
215 case Model_HTC_Alpine:
216 modelPixmap += "htcalpine";
217 break;
218 case Model_HTC_Beetles:
219 modelPixmap += "htcbeetles";
220 break;
221 default:
222 modelPixmap += "pda";
223 break;
224 }
225 break;
226 }
227 /* PALM */
228 case Vendor_Palm:
229 {
230 switch ( model ) {
231 case Model_Palm_TT:
232 modelPixmap += "palmtt";
233 break;
234 case Model_Palm_TT2:
235 modelPixmap += "palmtt2";
236 break;
237 case Model_Palm_TT3:
238 modelPixmap += "palmtt3";
239 break;
240 case Model_Palm_TT5:
241 modelPixmap += "palmtt5";
242 break;
243 case Model_Palm_TE:
244 modelPixmap += "palmte";
245 break;
246 case Model_Palm_TE2:
247 modelPixmap += "palmte2";
248 break;
249 case Model_Palm_TC:
250 modelPixmap += "palmtc";
251 break;
252 case Model_Palm_LD:
253 modelPixmap += "palmld";
254 break;
255 case Model_Palm_TX:
256 modelPixmap += "palmtx";
257 break;
258 case Model_Palm_Z71:
259 modelPixmap += "palmz71";
260 break;
261 case Model_Palm_Z72:
262 modelPixmap += "palmz72";
263 break;
264 case Model_Palm_T600:
265 modelPixmap += "palmt600";
266 break;
267 case Model_Palm_T650:
268 modelPixmap += "palmt650";
269 break;
270 case Model_Palm_T680:
271 modelPixmap += "palmt680";
272 break;
273 case Model_Palm_T700W:
274 modelPixmap += "palmt700w";
275 break;
276 case Model_Palm_T700P:
277 modelPixmap += "palmt700p";
278 break;
279 case Model_Palm_T750:
280 modelPixmap += "palmt750";
281 break;
282 case Model_Palm_T755P:
283 modelPixmap += "palmt755p";
284 break;
285 case Model_Palm_FOLEO:
286 modelPixmap += "palmfoleo";
287 break;
288 default:
289 modelPixmap += "pda";
290 break;
291 }
292 break;
293 }
294 /* OTHER DEVICES */
295 default:
296 modelPixmap += "pda";
297 break;
298 }
158 QImage logo3 = Opie::Core::OResource::loadImage( modelPixmap ); 299 QImage logo3 = Opie::Core::OResource::loadImage( modelPixmap );
159 300
160 int width = logo3.width(); 301 int width = logo3.width();
161 int height = logo3.height(); 302 int height = logo3.height();
162 float aspect = float( height ) / width; 303 float aspect = float( height ) / width;
163 logo3 = logo3.smoothScale( 50, 50.0 * aspect ); 304 logo3 = logo3.smoothScale( 50, 50.0 * aspect );
164 305
165 QPixmap logo3Pixmap; 306 QPixmap logo3Pixmap;
166 logo3Pixmap.convertFromImage( logo3 ); 307 logo3Pixmap.convertFromImage( logo3 );
167 palmtopLogo3->setPixmap( logo3Pixmap ); 308 palmtopLogo3->setPixmap( logo3Pixmap );
168 palmtopLogo3->setFixedSize( 60, 100 ); 309 palmtopLogo3->setFixedSize( 60, 100 );
169 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); 310 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
170 311
171 QString systemString = "<qt><b>"; 312 QString systemString = "<qt><b>";
172 systemString.append( ODevice::inst()->systemString() ); 313 systemString.append( ODevice::inst()->systemString() );
173 systemString.append( "</b>" ); 314 systemString.append( "</b>" );
174 systemString.append( tr( "<p>Version: " ) ); 315 systemString.append( tr( "<p>Version: " ) );
175 systemString.append( ODevice::inst()->systemVersionString() ); 316 systemString.append( ODevice::inst()->systemVersionString() );
176 systemString.append( tr( "<br>Model: " ) ); 317 systemString.append( tr( "<br>Model: " ) );
177 systemString.append( ODevice::inst()->modelString() ); 318 systemString.append( ODevice::inst()->modelString() );
178 systemString.append( tr( "<br>Vendor: " ) ); 319 systemString.append( tr( "<br>Vendor: " ) );
179 systemString.append( ODevice::inst()->vendorString() ); 320 systemString.append( ODevice::inst()->vendorString() );
180 systemString.append("</qt>"); 321 systemString.append("</qt>");
181 322
182 QLabel *systemVersion = new QLabel( container ); 323 QLabel *systemVersion = new QLabel( container );
183 systemVersion->setText( systemString ); 324 systemVersion->setText( systemString );
184 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 325 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
185 326
186 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); 327 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
187} 328}
188 329
189VersionInfo::~VersionInfo() 330VersionInfo::~VersionInfo()
190{ 331{
191} 332}
192 333