summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-03-18 22:33:56 (UTC)
committer kergoth <kergoth>2002-03-18 22:33:56 (UTC)
commite7171ae513696f32a1edfeb41e22ff5b036c0460 (patch) (unidiff)
tree21297e19e810b5056a461431a0f1d8f57f66049d
parentd41e6d2ed4caeabf78ab08bde7d4f5866c9eeb04 (diff)
downloadopie-e7171ae513696f32a1edfeb41e22ff5b036c0460.zip
opie-e7171ae513696f32a1edfeb41e22ff5b036c0460.tar.gz
opie-e7171ae513696f32a1edfeb41e22ff5b036c0460.tar.bz2
oops
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/calibrate/calibrate.cpp2
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp4
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/core/apps/calibrate/calibrate.cpp b/core/apps/calibrate/calibrate.cpp
index 945749b..8647957 100644
--- a/core/apps/calibrate/calibrate.cpp
+++ b/core/apps/calibrate/calibrate.cpp
@@ -1,243 +1,243 @@
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 "calibrate.h" 21#include "calibrate.h"
22 22
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24 24
25#include <qapplication.h> 25#include <qapplication.h>
26 26
27#if defined(Q_WS_QWS) || defined(_WS_QWS_) 27#if defined(Q_WS_QWS) || defined(_WS_QWS_)
28 28
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwindowsystem_qws.h> 31#include <qwindowsystem_qws.h>
32#include <qgfx_qws.h> 32#include <qgfx_qws.h>
33 33
34 34
35Calibrate::Calibrate(QWidget* parent, const char * name, WFlags wf) : 35Calibrate::Calibrate(QWidget* parent, const char * name, WFlags wf) :
36 QDialog( parent, name, TRUE, wf | WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop ) 36 QDialog( parent, name, TRUE, wf | WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop )
37{ 37{
38 showCross = TRUE; 38 showCross = TRUE;
39 const int offset = 30; 39 const int offset = 30;
40 QRect desk = qApp->desktop()->geometry(); 40 QRect desk = qApp->desktop()->geometry();
41 setGeometry( 0, 0, desk.width(), desk.height() ); 41 setGeometry( 0, 0, desk.width(), desk.height() );
42 if ( desk.height() < 250 ) { 42 if ( desk.height() < 250 ) {
43 int w = desk.height()/3; 43 int w = desk.height()/3;
44 logo.convertFromImage(Resource::loadImage("launcher/launcher/opielogo").smoothScale(w,w)); 44 logo.convertFromImage(Resource::loadImage("launcher/opielogo").smoothScale(w,w));
45 } else { 45 } else {
46 logo = Resource::loadPixmap( "launcher/launcher/opielogo" ); 46 logo = Resource::loadPixmap( "launcher/launcher/opielogo" );
47 } 47 }
48 cd.screenPoints[QWSPointerCalibrationData::TopLeft] = QPoint( offset, offset ); 48 cd.screenPoints[QWSPointerCalibrationData::TopLeft] = QPoint( offset, offset );
49 cd.screenPoints[QWSPointerCalibrationData::BottomLeft] = QPoint( offset, qt_screen->deviceHeight() - offset ); 49 cd.screenPoints[QWSPointerCalibrationData::BottomLeft] = QPoint( offset, qt_screen->deviceHeight() - offset );
50 cd.screenPoints[QWSPointerCalibrationData::BottomRight] = QPoint( qt_screen->deviceWidth() - offset, qt_screen->deviceHeight() - offset ); 50 cd.screenPoints[QWSPointerCalibrationData::BottomRight] = QPoint( qt_screen->deviceWidth() - offset, qt_screen->deviceHeight() - offset );
51 cd.screenPoints[QWSPointerCalibrationData::TopRight] = QPoint( qt_screen->deviceWidth() - offset, offset ); 51 cd.screenPoints[QWSPointerCalibrationData::TopRight] = QPoint( qt_screen->deviceWidth() - offset, offset );
52 cd.screenPoints[QWSPointerCalibrationData::Center] = QPoint( qt_screen->deviceWidth()/2, qt_screen->deviceHeight()/2 ); 52 cd.screenPoints[QWSPointerCalibrationData::Center] = QPoint( qt_screen->deviceWidth()/2, qt_screen->deviceHeight()/2 );
53 goodcd = cd; 53 goodcd = cd;
54 reset(); 54 reset();
55 55
56 timer = new QTimer( this ); 56 timer = new QTimer( this );
57 connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) ); 57 connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) );
58} 58}
59 59
60Calibrate::~Calibrate() 60Calibrate::~Calibrate()
61{ 61{
62 store(); 62 store();
63} 63}
64 64
65void Calibrate::show() 65void Calibrate::show()
66{ 66{
67 grabMouse(); 67 grabMouse();
68 QWSServer::mouseHandler()->getCalibration(&goodcd); 68 QWSServer::mouseHandler()->getCalibration(&goodcd);
69 QWSServer::mouseHandler()->clearCalibration(); 69 QWSServer::mouseHandler()->clearCalibration();
70 QDialog::show(); 70 QDialog::show();
71} 71}
72 72
73void Calibrate::store() 73void Calibrate::store()
74{ 74{
75 QWSServer::mouseHandler()->calibrate( &goodcd ); 75 QWSServer::mouseHandler()->calibrate( &goodcd );
76} 76}
77 77
78void Calibrate::hide() 78void Calibrate::hide()
79{ 79{
80 if ( isVisible() ) 80 if ( isVisible() )
81 store(); 81 store();
82 QDialog::hide(); 82 QDialog::hide();
83} 83}
84 84
85void Calibrate::reset() 85void Calibrate::reset()
86{ 86{
87 penPos = QPoint(); 87 penPos = QPoint();
88 location = QWSPointerCalibrationData::TopLeft; 88 location = QWSPointerCalibrationData::TopLeft;
89 crossPos = fromDevice( cd.screenPoints[location] ); 89 crossPos = fromDevice( cd.screenPoints[location] );
90} 90}
91 91
92QPoint Calibrate::fromDevice( const QPoint &p ) 92QPoint Calibrate::fromDevice( const QPoint &p )
93{ 93{
94 return qt_screen->mapFromDevice( p, 94 return qt_screen->mapFromDevice( p,
95 QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight()) ); 95 QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight()) );
96} 96}
97 97
98bool Calibrate::sanityCheck() 98bool Calibrate::sanityCheck()
99{ 99{
100 QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft]; 100 QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft];
101 QPoint tr = cd.devPoints[QWSPointerCalibrationData::TopRight]; 101 QPoint tr = cd.devPoints[QWSPointerCalibrationData::TopRight];
102 QPoint bl = cd.devPoints[QWSPointerCalibrationData::BottomLeft]; 102 QPoint bl = cd.devPoints[QWSPointerCalibrationData::BottomLeft];
103 QPoint br = cd.devPoints[QWSPointerCalibrationData::BottomRight]; 103 QPoint br = cd.devPoints[QWSPointerCalibrationData::BottomRight];
104 104
105 int vl = QABS( tl.y() - bl.y() ); 105 int vl = QABS( tl.y() - bl.y() );
106 int vr = QABS( tr.y() - br.y() ); 106 int vr = QABS( tr.y() - br.y() );
107 int diff = QABS( vl - vr ); 107 int diff = QABS( vl - vr );
108 int avg = ( vl + vr ) / 2; 108 int avg = ( vl + vr ) / 2;
109 if ( diff > avg / 20 ) // 5% leeway 109 if ( diff > avg / 20 ) // 5% leeway
110 return FALSE; 110 return FALSE;
111 111
112 int ht = QABS( tl.x() - tr.x() ); 112 int ht = QABS( tl.x() - tr.x() );
113 int hb = QABS( br.x() - bl.x() ); 113 int hb = QABS( br.x() - bl.x() );
114 diff = QABS( ht - hb ); 114 diff = QABS( ht - hb );
115 avg = ( ht + hb ) / 2; 115 avg = ( ht + hb ) / 2;
116 if ( diff > avg / 20 ) // 5% leeway 116 if ( diff > avg / 20 ) // 5% leeway
117 return FALSE; 117 return FALSE;
118 118
119 return TRUE; 119 return TRUE;
120} 120}
121 121
122void Calibrate::moveCrosshair( QPoint pt ) 122void Calibrate::moveCrosshair( QPoint pt )
123{ 123{
124/* 124/*
125 QPainter p( this ); 125 QPainter p( this );
126 p.drawPixmap( crossPos.x()-8, crossPos.y()-8, saveUnder ); 126 p.drawPixmap( crossPos.x()-8, crossPos.y()-8, saveUnder );
127 saveUnder = QPixmap::grabWindow( winId(), pt.x()-8, pt.y()-8, 16, 16 ); 127 saveUnder = QPixmap::grabWindow( winId(), pt.x()-8, pt.y()-8, 16, 16 );
128 p.drawRect( pt.x()-1, pt.y()-8, 2, 7 ); 128 p.drawRect( pt.x()-1, pt.y()-8, 2, 7 );
129 p.drawRect( pt.x()-1, pt.y()+1, 2, 7 ); 129 p.drawRect( pt.x()-1, pt.y()+1, 2, 7 );
130 p.drawRect( pt.x()-8, pt.y()-1, 7, 2 ); 130 p.drawRect( pt.x()-8, pt.y()-1, 7, 2 );
131 p.drawRect( pt.x()+1, pt.y()-1, 7, 2 ); 131 p.drawRect( pt.x()+1, pt.y()-1, 7, 2 );
132*/ 132*/
133 showCross = FALSE; 133 showCross = FALSE;
134 repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 ); 134 repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 );
135 showCross = TRUE; 135 showCross = TRUE;
136 crossPos = pt; 136 crossPos = pt;
137 repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 ); 137 repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 );
138} 138}
139 139
140void Calibrate::paintEvent( QPaintEvent * ) 140void Calibrate::paintEvent( QPaintEvent * )
141{ 141{
142 QPainter p( this ); 142 QPainter p( this );
143 143
144 int y; 144 int y;
145 145
146 if ( !logo.isNull() ) { 146 if ( !logo.isNull() ) {
147 y = height() / 2 - logo.height() - 15; 147 y = height() / 2 - logo.height() - 15;
148 p.drawPixmap( (width() - logo.width())/2, y, logo ); 148 p.drawPixmap( (width() - logo.width())/2, y, logo );
149 } 149 }
150 150
151 y = height() / 2 + 15; 151 y = height() / 2 + 15;
152 152
153 p.drawText( 0, y+height()/8, width(), height() - y, AlignHCenter, 153 p.drawText( 0, y+height()/8, width(), height() - y, AlignHCenter,
154 tr("Touch the crosshairs firmly and\n" 154 tr("Touch the crosshairs firmly and\n"
155 "accurately to calibrate your screen.") ); 155 "accurately to calibrate your screen.") );
156 156
157 QFont f = p.font(); f.setBold(TRUE); 157 QFont f = p.font(); f.setBold(TRUE);
158 p.setFont( f ); 158 p.setFont( f );
159 p.drawText( 0, y, width(), height() - y, AlignHCenter|WordBreak, 159 p.drawText( 0, y, width(), height() - y, AlignHCenter|WordBreak,
160 tr("Welcome to Opie") ); 160 tr("Welcome to Opie") );
161 161
162/* 162/*
163 saveUnder = QPixmap::grabWindow( winId(), crossPos.x()-8, crossPos.y()-8, 163 saveUnder = QPixmap::grabWindow( winId(), crossPos.x()-8, crossPos.y()-8,
164 16, 16 ); 164 16, 16 );
165 moveCrosshair( crossPos ); 165 moveCrosshair( crossPos );
166*/ 166*/
167 if ( showCross ) { 167 if ( showCross ) {
168 p.drawRect( crossPos.x()-1, crossPos.y()-8, 2, 7 ); 168 p.drawRect( crossPos.x()-1, crossPos.y()-8, 2, 7 );
169 p.drawRect( crossPos.x()-1, crossPos.y()+1, 2, 7 ); 169 p.drawRect( crossPos.x()-1, crossPos.y()+1, 2, 7 );
170 p.drawRect( crossPos.x()-8, crossPos.y()-1, 7, 2 ); 170 p.drawRect( crossPos.x()-8, crossPos.y()-1, 7, 2 );
171 p.drawRect( crossPos.x()+1, crossPos.y()-1, 7, 2 ); 171 p.drawRect( crossPos.x()+1, crossPos.y()-1, 7, 2 );
172 } 172 }
173} 173}
174 174
175void Calibrate::mousePressEvent( QMouseEvent *e ) 175void Calibrate::mousePressEvent( QMouseEvent *e )
176{ 176{
177 // map to device coordinates 177 // map to device coordinates
178 QPoint devPos = qt_screen->mapToDevice( e->pos(), 178 QPoint devPos = qt_screen->mapToDevice( e->pos(),
179 QSize(qt_screen->width(), qt_screen->height()) ); 179 QSize(qt_screen->width(), qt_screen->height()) );
180 if ( penPos.isNull() ) 180 if ( penPos.isNull() )
181 penPos = devPos; 181 penPos = devPos;
182 else 182 else
183 penPos = QPoint( (penPos.x() + devPos.x())/2, 183 penPos = QPoint( (penPos.x() + devPos.x())/2,
184 (penPos.y() + devPos.y())/2 ); 184 (penPos.y() + devPos.y())/2 );
185} 185}
186 186
187void Calibrate::mouseReleaseEvent( QMouseEvent * ) 187void Calibrate::mouseReleaseEvent( QMouseEvent * )
188{ 188{
189 if ( timer->isActive() ) 189 if ( timer->isActive() )
190 return; 190 return;
191 191
192 bool doMove = TRUE; 192 bool doMove = TRUE;
193 193
194 cd.devPoints[location] = penPos; 194 cd.devPoints[location] = penPos;
195 if ( location < QWSPointerCalibrationData::LastLocation ) { 195 if ( location < QWSPointerCalibrationData::LastLocation ) {
196 location = (QWSPointerCalibrationData::Location)((int)location + 1); 196 location = (QWSPointerCalibrationData::Location)((int)location + 1);
197 } else { 197 } else {
198 if ( sanityCheck() ) { 198 if ( sanityCheck() ) {
199 reset(); 199 reset();
200 goodcd = cd; 200 goodcd = cd;
201 hide(); 201 hide();
202 emit accept(); 202 emit accept();
203 doMove = FALSE; 203 doMove = FALSE;
204 } else { 204 } else {
205 location = QWSPointerCalibrationData::TopLeft; 205 location = QWSPointerCalibrationData::TopLeft;
206 } 206 }
207 } 207 }
208 208
209 if ( doMove ) { 209 if ( doMove ) {
210 QPoint target = fromDevice( cd.screenPoints[location] ); 210 QPoint target = fromDevice( cd.screenPoints[location] );
211 dx = (target.x() - crossPos.x())/10; 211 dx = (target.x() - crossPos.x())/10;
212 dy = (target.y() - crossPos.y())/10; 212 dy = (target.y() - crossPos.y())/10;
213 timer->start( 30 ); 213 timer->start( 30 );
214 } 214 }
215} 215}
216 216
217void Calibrate::timeout() 217void Calibrate::timeout()
218{ 218{
219 QPoint target = fromDevice( cd.screenPoints[location] ); 219 QPoint target = fromDevice( cd.screenPoints[location] );
220 220
221 bool doneX = FALSE; 221 bool doneX = FALSE;
222 bool doneY = FALSE; 222 bool doneY = FALSE;
223 QPoint newPos( crossPos.x() + dx, crossPos.y() + dy ); 223 QPoint newPos( crossPos.x() + dx, crossPos.y() + dy );
224 224
225 if ( QABS(crossPos.x() - target.x()) <= QABS(dx) ) { 225 if ( QABS(crossPos.x() - target.x()) <= QABS(dx) ) {
226 newPos.setX( target.x() ); 226 newPos.setX( target.x() );
227 doneX = TRUE; 227 doneX = TRUE;
228 } 228 }
229 229
230 if ( QABS(crossPos.y() - target.y()) <= QABS(dy) ) { 230 if ( QABS(crossPos.y() - target.y()) <= QABS(dy) ) {
231 newPos.setY(target.y()); 231 newPos.setY(target.y());
232 doneY = TRUE; 232 doneY = TRUE;
233 } 233 }
234 234
235 if ( doneX && doneY ) { 235 if ( doneX && doneY ) {
236 penPos = QPoint(); 236 penPos = QPoint();
237 timer->stop(); 237 timer->stop();
238 } 238 }
239 239
240 moveCrosshair( newPos ); 240 moveCrosshair( newPos );
241} 241}
242 242
243#endif // _WS_QWS_ 243#endif // _WS_QWS_
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index b5d8b78..991301a 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -1,183 +1,183 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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#include <qpe/applnk.h> 20#include <qpe/applnk.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpainter.h> 22#include <qpainter.h>
23#include <qimage.h> 23#include <qimage.h>
24#include <qheader.h> 24#include <qheader.h>
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlist.h> 26#include <qlist.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28 28
29#include "playlistselection.h" 29#include "playlistselection.h"
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33class PlayListSelectionItem : public QListViewItem { 33class PlayListSelectionItem : public QListViewItem {
34public: 34public:
35 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { 35 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) {
36 setText( 0, f->name() ); 36 setText( 0, f->name() );
37 setPixmap( 0, f->pixmap() ); 37 setPixmap( 0, f->pixmap() );
38 } 38 }
39 39
40 ~PlayListSelectionItem() { 40 ~PlayListSelectionItem() {
41 }; 41 };
42 42
43 const DocLnk *file() const { return fl; } 43 const DocLnk *file() const { return fl; }
44 44
45private: 45private:
46 const DocLnk *fl; 46 const DocLnk *fl;
47}; 47};
48 48
49 49
50PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) 50PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
51 : QListView( parent, name ) 51 : QListView( parent, name )
52{ 52{
53 qDebug("starting playlistselector"); 53 qDebug("starting playlistselector");
54// #ifdef USE_PLAYLIST_BACKGROUND 54// #ifdef USE_PLAYLIST_BACKGROUND
55// setStaticBackground( TRUE ); 55// setStaticBackground( TRUE );
56// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); 56// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) );
57 57
58 setBackgroundPixmap( Resource::loadPixmap( "launcher/launcher/opielogo" ) ); 58 setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
59// #endif 59// #endif
60// addColumn("Title",236); 60// addColumn("Title",236);
61// setAllColumnsShowFocus( TRUE ); 61// setAllColumnsShowFocus( TRUE );
62 addColumn( tr( "Playlist Selection" ) ); 62 addColumn( tr( "Playlist Selection" ) );
63 header()->hide(); 63 header()->hide();
64 setSorting( -1, FALSE ); 64 setSorting( -1, FALSE );
65} 65}
66 66
67 67
68PlayListSelection::~PlayListSelection() { 68PlayListSelection::~PlayListSelection() {
69} 69}
70 70
71 71
72// #ifdef USE_PLAYLIST_BACKGROUND 72// #ifdef USE_PLAYLIST_BACKGROUND
73void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 73void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
74// qDebug("drawBackground"); 74// qDebug("drawBackground");
75 p->fillRect( r, QBrush( white ) ); 75 p->fillRect( r, QBrush( white ) );
76 QImage logo = Resource::loadImage( "launcher/launcher/opielogo" ); 76 QImage logo = Resource::loadImage( "launcher/opielogo" );
77 if ( !logo.isNull() ) 77 if ( !logo.isNull() )
78 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 78 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
79} 79}
80// #endif 80// #endif
81 81
82 82
83void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 83void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
84 if ( event->state() == QMouseEvent::LeftButton ) { 84 if ( event->state() == QMouseEvent::LeftButton ) {
85 QListViewItem *currentItem = selectedItem(); 85 QListViewItem *currentItem = selectedItem();
86 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 86 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
87 if ( currentItem && currentItem->itemAbove() == itemUnder ) 87 if ( currentItem && currentItem->itemAbove() == itemUnder )
88 moveSelectedUp(); 88 moveSelectedUp();
89 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 89 else if ( currentItem && currentItem->itemBelow() == itemUnder )
90 moveSelectedDown(); 90 moveSelectedDown();
91 } 91 }
92} 92}
93 93
94 94
95const DocLnk *PlayListSelection::current() { 95const DocLnk *PlayListSelection::current() {
96 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); 96 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
97 if ( item ) 97 if ( item )
98 return item->file(); 98 return item->file();
99 return NULL; 99 return NULL;
100} 100}
101 101
102 102
103void PlayListSelection::addToSelection( const DocLnk &lnk ) { 103void PlayListSelection::addToSelection( const DocLnk &lnk ) {
104 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); 104 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) );
105 QListViewItem *current = selectedItem(); 105 QListViewItem *current = selectedItem();
106 if ( current ) 106 if ( current )
107 item->moveItem( current ); 107 item->moveItem( current );
108 setSelected( item, TRUE ); 108 setSelected( item, TRUE );
109 ensureItemVisible( selectedItem() ); 109 ensureItemVisible( selectedItem() );
110} 110}
111 111
112 112
113void PlayListSelection::removeSelected() { 113void PlayListSelection::removeSelected() {
114 QListViewItem *item = selectedItem(); 114 QListViewItem *item = selectedItem();
115 if ( item ) 115 if ( item )
116 delete item; 116 delete item;
117 setSelected( currentItem(), TRUE ); 117 setSelected( currentItem(), TRUE );
118 ensureItemVisible( selectedItem() ); 118 ensureItemVisible( selectedItem() );
119} 119}
120 120
121 121
122void PlayListSelection::moveSelectedUp() { 122void PlayListSelection::moveSelectedUp() {
123 QListViewItem *item = selectedItem(); 123 QListViewItem *item = selectedItem();
124 if ( item && item->itemAbove() ) 124 if ( item && item->itemAbove() )
125 item->itemAbove()->moveItem( item ); 125 item->itemAbove()->moveItem( item );
126 ensureItemVisible( selectedItem() ); 126 ensureItemVisible( selectedItem() );
127} 127}
128 128
129 129
130void PlayListSelection::moveSelectedDown() { 130void PlayListSelection::moveSelectedDown() {
131 QListViewItem *item = selectedItem(); 131 QListViewItem *item = selectedItem();
132 if ( item && item->itemBelow() ) 132 if ( item && item->itemBelow() )
133 item->moveItem( item->itemBelow() ); 133 item->moveItem( item->itemBelow() );
134 ensureItemVisible( selectedItem() ); 134 ensureItemVisible( selectedItem() );
135} 135}
136 136
137 137
138bool PlayListSelection::prev() { 138bool PlayListSelection::prev() {
139 QListViewItem *item = selectedItem(); 139 QListViewItem *item = selectedItem();
140 if ( item && item->itemAbove() ) 140 if ( item && item->itemAbove() )
141 setSelected( item->itemAbove(), TRUE ); 141 setSelected( item->itemAbove(), TRUE );
142 else 142 else
143 return FALSE; 143 return FALSE;
144 ensureItemVisible( selectedItem() ); 144 ensureItemVisible( selectedItem() );
145 return TRUE; 145 return TRUE;
146} 146}
147 147
148 148
149bool PlayListSelection::next() { 149bool PlayListSelection::next() {
150 QListViewItem *item = selectedItem(); 150 QListViewItem *item = selectedItem();
151 if ( item && item->itemBelow() ) 151 if ( item && item->itemBelow() )
152 setSelected( item->itemBelow(), TRUE ); 152 setSelected( item->itemBelow(), TRUE );
153 else 153 else
154 return FALSE; 154 return FALSE;
155 ensureItemVisible( selectedItem() ); 155 ensureItemVisible( selectedItem() );
156 return TRUE; 156 return TRUE;
157} 157}
158 158
159 159
160bool PlayListSelection::first() { 160bool PlayListSelection::first() {
161 QListViewItem *item = firstChild(); 161 QListViewItem *item = firstChild();
162 if ( item ) 162 if ( item )
163 setSelected( item, TRUE ); 163 setSelected( item, TRUE );
164 else 164 else
165 return FALSE; 165 return FALSE;
166 ensureItemVisible( selectedItem() ); 166 ensureItemVisible( selectedItem() );
167 return TRUE; 167 return TRUE;
168} 168}
169 169
170 170
171bool PlayListSelection::last() { 171bool PlayListSelection::last() {
172 QListViewItem *prevItem = NULL; 172 QListViewItem *prevItem = NULL;
173 QListViewItem *item = firstChild(); 173 QListViewItem *item = firstChild();
174 while ( ( item = item->nextSibling() ) ) 174 while ( ( item = item->nextSibling() ) )
175 prevItem = item; 175 prevItem = item;
176 if ( prevItem ) 176 if ( prevItem )
177 setSelected( prevItem, TRUE ); 177 setSelected( prevItem, TRUE );
178 else 178 else
179 return FALSE; 179 return FALSE;
180 ensureItemVisible( selectedItem() ); 180 ensureItemVisible( selectedItem() );
181 return TRUE; 181 return TRUE;
182} 182}
183 183
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
index 27c4cf5..517029b 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,109 +1,109 @@
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 <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/version.h> 22#include <qpe/version.h>
23 23
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qpixmap.h> 25#include <qpixmap.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qimage.h> 27#include <qimage.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include "versioninfo.h" 32#include "versioninfo.h"
33 33
34VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 34VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
35 : QWidget( parent, name, f ) 35 : QWidget( parent, name, f )
36{ 36{
37 setMinimumSize( 200, 150 ); 37 setMinimumSize( 200, 150 );
38 38
39 QVBoxLayout *vb = new QVBoxLayout( this, 4 ); 39 QVBoxLayout *vb = new QVBoxLayout( this, 4 );
40 40
41 QString kernelVersionString; 41 QString kernelVersionString;
42 QFile file( "/proc/version" ); 42 QFile file( "/proc/version" );
43 if ( file.open( IO_ReadOnly ) ) { 43 if ( file.open( IO_ReadOnly ) ) {
44 QTextStream t( &file ); 44 QTextStream t( &file );
45 QString v; 45 QString v;
46 t >> v; t >> v; t >> v; 46 t >> v; t >> v; t >> v;
47 v = v.left( 20 ); 47 v = v.left( 20 );
48 kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>"; 48 kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>";
49 t >> v; 49 t >> v;
50 kernelVersionString += tr( "Compiled by: " ) + v; 50 kernelVersionString += tr( "Compiled by: " ) + v;
51 file.close(); 51 file.close();
52 } 52 }
53 53
54 QString palmtopVersionString; 54 QString palmtopVersionString;
55 palmtopVersionString = tr( "<b>Opie</b><p>Version: " ) + QPE_VERSION + "<p>"; 55 palmtopVersionString = tr( "<b>Opie</b><p>Version: " ) + QPE_VERSION + "<p>";
56#ifdef QPE_VENDOR 56#ifdef QPE_VENDOR
57 QString builder = QPE_VENDOR; 57 QString builder = QPE_VENDOR;
58#else 58#else
59 QString builder = "Unknown"; 59 QString builder = "Unknown";
60#endif 60#endif
61 palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>"; 61 palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>";
62 palmtopVersionString += tr( "Built on: " ) + __DATE__; 62 palmtopVersionString += tr( "Built on: " ) + __DATE__;
63 63
64 64
65 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 65 QHBoxLayout *hb1 = new QHBoxLayout( vb );
66 hb1->setSpacing( 2 ); 66 hb1->setSpacing( 2 );
67 67
68 QLabel *palmtopLogo = new QLabel( this ); 68 QLabel *palmtopLogo = new QLabel( this );
69 QImage logo1 = Resource::loadImage( "launcher/launcher/opielogo" ); 69 QImage logo1 = Resource::loadImage( "launcher/opielogo" );
70 logo1 = logo1.smoothScale( 50, 55 ); 70 logo1 = logo1.smoothScale( 50, 55 );
71 QPixmap logo1Pixmap; 71 QPixmap logo1Pixmap;
72 logo1Pixmap.convertFromImage( logo1 ); 72 logo1Pixmap.convertFromImage( logo1 );
73 palmtopLogo->setPixmap( logo1Pixmap ); 73 palmtopLogo->setPixmap( logo1Pixmap );
74 palmtopLogo->setFixedSize( 60, 60 ); 74 palmtopLogo->setFixedSize( 60, 60 );
75 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 75 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
76 76
77 QLabel *palmtopVersion = new QLabel( this ); 77 QLabel *palmtopVersion = new QLabel( this );
78 palmtopVersion->setText( palmtopVersionString ); 78 palmtopVersion->setText( palmtopVersionString );
79 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 79 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
80 80
81 81
82 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 82 QHBoxLayout *hb2 = new QHBoxLayout( vb );
83 hb1->setSpacing( 2 ); 83 hb1->setSpacing( 2 );
84 84
85 QLabel *linuxLogo = new QLabel( this ); 85 QLabel *linuxLogo = new QLabel( this );
86 86
87 // Need to do this extra qpainter code with this image becuase for some 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 88 // reason it doesn't alpha belnd if directly converted to a pixmap
89 QPixmap logo2Pixmap( 60, 60 ); 89 QPixmap logo2Pixmap( 60, 60 );
90 QColor bgColor = colorGroup().background(); 90 QColor bgColor = colorGroup().background();
91 QPainter painter( &logo2Pixmap ); 91 QPainter painter( &logo2Pixmap );
92 painter.fillRect( QRect( 0, 0, 60, 60 ), QBrush( bgColor ) ); 92 painter.fillRect( QRect( 0, 0, 60, 60 ), QBrush( bgColor ) );
93 QImage logo2 = Resource::loadImage( "tux-logo" ); 93 QImage logo2 = Resource::loadImage( "tux-logo" );
94 logo2 = logo2.smoothScale( 40, 47 ); 94 logo2 = logo2.smoothScale( 40, 47 );
95 painter.drawImage( 0, 0, logo2 ); 95 painter.drawImage( 0, 0, logo2 );
96 painter.end(); 96 painter.end();
97 linuxLogo->setPixmap( logo2Pixmap ); 97 linuxLogo->setPixmap( logo2Pixmap );
98 linuxLogo->setFixedSize( 60, 60 ); 98 linuxLogo->setFixedSize( 60, 60 );
99 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 99 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
100 100
101 QLabel *kernelVersion = new QLabel( this ); 101 QLabel *kernelVersion = new QLabel( this );
102 kernelVersion->setText( kernelVersionString ); 102 kernelVersion->setText( kernelVersionString );
103 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 103 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
104} 104}
105 105
106VersionInfo::~VersionInfo() 106VersionInfo::~VersionInfo()
107{ 107{
108} 108}
109 109