summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-11 12:26:54 (UTC)
committer harlekin <harlekin>2002-08-11 12:26:54 (UTC)
commitc7c84fd736d1ae29f0d9e51f781e1d94f0c39334 (patch) (unidiff)
tree830ed00d66ae074ca6db8ddd820ab2a68d1a1a2b
parentc20e4302b915bcba07b468874e9795d37d2eaa03 (diff)
downloadopie-c7c84fd736d1ae29f0d9e51f781e1d94f0c39334.zip
opie-c7c84fd736d1ae29f0d9e51f781e1d94f0c39334.tar.gz
opie-c7c84fd736d1ae29f0d9e51f781e1d94f0c39334.tar.bz2
make it compile again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index a4e6b6e..9b88299 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -100,193 +100,193 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
100 100
101 for ( int i = 0; i < 7; i++ ) { 101 for ( int i = 0; i < 7; i++ ) {
102 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; 102 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png";
103 masks[i] = new QBitmap( filename ); 103 masks[i] = new QBitmap( filename );
104 qDebug(filename); 104 qDebug(filename);
105 if ( !masks[i]->isNull() ) { 105 if ( !masks[i]->isNull() ) {
106 QImage imgMask = masks[i]->convertToImage(); 106 QImage imgMask = masks[i]->convertToImage();
107 uchar **dest = imgButtonMask->jumpTable(); 107 uchar **dest = imgButtonMask->jumpTable();
108 for ( int y = 0; y < imgUp->height(); y++ ) { 108 for ( int y = 0; y < imgUp->height(); y++ ) {
109 uchar *line = dest[y]; 109 uchar *line = dest[y];
110 for ( int x = 0; x < imgUp->width(); x++ ) { 110 for ( int x = 0; x < imgUp->width(); x++ ) {
111 if ( !qRed( imgMask.pixel( x, y ) ) ) 111 if ( !qRed( imgMask.pixel( x, y ) ) )
112 line[x] = i + 1; 112 line[x] = i + 1;
113 } 113 }
114 } 114 }
115 } 115 }
116 116
117 } 117 }
118 118
119 for ( int i = 0; i < 7; i++ ) { 119 for ( int i = 0; i < 7; i++ ) {
120 buttonPixUp[i] = NULL; 120 buttonPixUp[i] = NULL;
121 buttonPixDown[i] = NULL; 121 buttonPixDown[i] = NULL;
122 } 122 }
123 123
124 setBackgroundPixmap( *pixBg ); 124 setBackgroundPixmap( *pixBg );
125 125
126 slider = new QSlider( Qt::Horizontal, this ); 126 slider = new QSlider( Qt::Horizontal, this );
127 slider->setMinValue( 0 ); 127 slider->setMinValue( 0 );
128 slider->setMaxValue( 1 ); 128 slider->setMaxValue( 1 );
129 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 129 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
130 slider->setFocusPolicy( QWidget::NoFocus ); 130 slider->setFocusPolicy( QWidget::NoFocus );
131 slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 131 slider->setGeometry( QRect( 7, 250, 220, 20 ) );
132 132
133 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 133 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
134 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 134 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
135 135
136 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 136 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
137 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 137 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
138 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 138 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
139 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 139 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
140 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 140 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
141 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 141 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
142 142
143 setLength( mediaPlayerState->length() ); 143 setLength( mediaPlayerState->length() );
144 setPosition( mediaPlayerState->position() ); 144 setPosition( mediaPlayerState->position() );
145 145
146 ////////////////////////// FIXME 146 ////////////////////////// FIXME
147// setFullscreen( mediaPlayerState->fullscreen() ); 147// setFullscreen( mediaPlayerState->fullscreen() );
148 setPaused( mediaPlayerState->paused() ); 148 setPaused( mediaPlayerState->paused() );
149 setPlaying( mediaPlayerState->playing() ); 149 setPlaying( mediaPlayerState->playing() );
150 qDebug("finished videowidget"); 150 qDebug("finished videowidget");
151} 151}
152 152
153 153
154VideoWidget::~VideoWidget() { 154VideoWidget::~VideoWidget() {
155 for ( int i = 0; i < 7; i++ ) { 155 for ( int i = 0; i < 7; i++ ) {
156 delete buttonPixUp[i]; 156 delete buttonPixUp[i];
157 delete buttonPixDown[i]; 157 delete buttonPixDown[i];
158 } 158 }
159 159
160 delete pixBg; 160 delete pixBg;
161 delete imgUp; 161 delete imgUp;
162 delete imgDn; 162 delete imgDn;
163 delete imgButtonMask; 163 delete imgButtonMask;
164 for ( int i = 0; i < 7; i++ ) { 164 for ( int i = 0; i < 7; i++ ) {
165 delete masks[i]; 165 delete masks[i];
166 } 166 }
167} 167}
168 168
169QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 169QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
170 QPixmap pix( img.width(), img.height() ); 170 QPixmap pix( img.width(), img.height() );
171 QPainter p( &pix ); 171 QPainter p( &pix );
172 p.drawTiledPixmap( pix.rect(), bg, offset ); 172 p.drawTiledPixmap( pix.rect(), bg, offset );
173 p.drawImage( 0, 0, img ); 173 p.drawImage( 0, 0, img );
174 return new QPixmap( pix ); 174 return new QPixmap( pix );
175} 175}
176 176
177QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { 177QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
178 QPixmap *pixmap = new QPixmap( pix ); 178 QPixmap *pixmap = new QPixmap( pix );
179 pixmap->setMask( mask ); 179 pixmap->setMask( mask );
180 return pixmap; 180 return pixmap;
181} 181}
182 182
183void VideoWidget::resizeEvent( QResizeEvent * ) { 183void VideoWidget::resizeEvent( QResizeEvent * ) {
184 int h = height(); 184 int h = height();
185 int w = width(); 185 int w = width();
186 int Vh = 160; 186 int Vh = 160;
187 //videoFrame->height(); 187 //videoFrame->height();
188 int Vw = 220; 188 int Vw = 220;
189 //videoFrame->width(); 189 //videoFrame->width();
190// songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); 190// songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
191 191
192 slider->setFixedWidth( w - 110 ); 192 slider->setFixedWidth( w - 110 );
193 slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); 193 slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
194 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 194 slider->setBackgroundOrigin( QWidget::ParentOrigin );
195 slider->setFocusPolicy( QWidget::NoFocus ); 195 slider->setFocusPolicy( QWidget::NoFocus );
196make slider->setBackgroundPixmap( *pixBg ); 196 slider->setBackgroundPixmap( *pixBg );
197 197
198// time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 198// time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
199 xoff = 0;// ( imgUp->width() ) / 2; 199 xoff = 0;// ( imgUp->width() ) / 2;
200 yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; 200 yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10;
201 QPoint p( xoff, yoff ); 201 QPoint p( xoff, yoff );
202 202
203 203
204 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); 204 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p );
205 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); 205 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p );
206 206
207 for ( int i = 0; i < 7; i++ ) { 207 for ( int i = 0; i < 7; i++ ) {
208 if ( !masks[i]->isNull() ) { 208 if ( !masks[i]->isNull() ) {
209 delete buttonPixUp[i]; 209 delete buttonPixUp[i];
210 delete buttonPixDown[i]; 210 delete buttonPixDown[i];
211 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); 211 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
212 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); 212 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] );
213 } 213 }
214 } 214 }
215 215
216 delete pixUp; 216 delete pixUp;
217 delete pixDn; 217 delete pixDn;
218} 218}
219 219
220static bool videoSliderBeingMoved = FALSE; 220static bool videoSliderBeingMoved = FALSE;
221 221
222void VideoWidget::sliderPressed() { 222void VideoWidget::sliderPressed() {
223 videoSliderBeingMoved = TRUE; 223 videoSliderBeingMoved = TRUE;
224} 224}
225 225
226void VideoWidget::sliderReleased() { 226void VideoWidget::sliderReleased() {
227 videoSliderBeingMoved = FALSE; 227 videoSliderBeingMoved = FALSE;
228 if ( slider->width() == 0 ) { 228 if ( slider->width() == 0 ) {
229 return; 229 return;
230 } 230 }
231 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 231 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
232 mediaPlayerState->setPosition( val ); 232 mediaPlayerState->setPosition( val );
233} 233}
234 234
235void VideoWidget::setPosition( long i ) { 235void VideoWidget::setPosition( long i ) {
236 updateSlider( i, mediaPlayerState->length() ); 236 updateSlider( i, mediaPlayerState->length() );
237} 237}
238 238
239 239
240void VideoWidget::setLength( long max ) { 240void VideoWidget::setLength( long max ) {
241 updateSlider( mediaPlayerState->position(), max ); 241 updateSlider( mediaPlayerState->position(), max );
242} 242}
243 243
244void VideoWidget::setView( char view ) { 244void VideoWidget::setView( char view ) {
245 if ( view == 'v' ) { 245 if ( view == 'v' ) {
246 makeVisible(); 246 makeVisible();
247 } else { 247 } else {
248 // Effectively blank the view next time we show it so it looks nicer 248 // Effectively blank the view next time we show it so it looks nicer
249 scaledWidth = 0; 249 scaledWidth = 0;
250 scaledHeight = 0; 250 scaledHeight = 0;
251 hide(); 251 hide();
252 } 252 }
253} 253}
254 254
255void VideoWidget::updateSlider( long i, long max ) { 255void VideoWidget::updateSlider( long i, long max ) {
256 // Will flicker too much if we don't do this 256 // Will flicker too much if we don't do this
257 if ( max == 0 ) { 257 if ( max == 0 ) {
258 return; 258 return;
259 } 259 }
260 int width = slider->width(); 260 int width = slider->width();
261 int val = int((double)i * width / max); 261 int val = int((double)i * width / max);
262 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { 262 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) {
263 if ( slider->value() != val ) { 263 if ( slider->value() != val ) {
264 slider->setValue( val ); 264 slider->setValue( val );
265 } 265 }
266 if ( slider->maxValue() != width ) { 266 if ( slider->maxValue() != width ) {
267 slider->setMaxValue( width ); 267 slider->setMaxValue( width );
268 } 268 }
269 } 269 }
270} 270}
271 271
272void VideoWidget::setToggleButton( int i, bool down ) { 272void VideoWidget::setToggleButton( int i, bool down ) {
273 if ( down != videoButtons[i].isDown ) { 273 if ( down != videoButtons[i].isDown ) {
274 toggleButton( i ); 274 toggleButton( i );
275 } 275 }
276} 276}
277 277
278void VideoWidget::toggleButton( int i ) { 278void VideoWidget::toggleButton( int i ) {
279 videoButtons[i].isDown = !videoButtons[i].isDown; 279 videoButtons[i].isDown = !videoButtons[i].isDown;
280 QPainter p(this); 280 QPainter p(this);
281 paintButton ( &p, i ); 281 paintButton ( &p, i );
282} 282}
283 283
284void VideoWidget::paintButton( QPainter *p, int i ) { 284void VideoWidget::paintButton( QPainter *p, int i ) {
285 285
286 if ( videoButtons[i].isDown ) 286 if ( videoButtons[i].isDown )
287 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 287 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
288 else 288 else
289 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 289 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
290} 290}
291 291
292void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 292void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
@@ -368,99 +368,99 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
368 if ( !pe->erased() ) { 368 if ( !pe->erased() ) {
369 // Combine with background and double buffer 369 // Combine with background and double buffer
370 QPixmap pix( pe->rect().size() ); 370 QPixmap pix( pe->rect().size() );
371 QPainter p( &pix ); 371 QPainter p( &pix );
372 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 372 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
373 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 373 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
374 for ( int i = 0; i < numButtons; i++ ) 374 for ( int i = 0; i < numButtons; i++ )
375 paintButton( &p, i ); 375 paintButton( &p, i );
376 QPainter p2( this ); 376 QPainter p2( this );
377 p2.drawPixmap( pe->rect().topLeft(), pix ); 377 p2.drawPixmap( pe->rect().topLeft(), pix );
378 } else { 378 } else {
379 QPainter p( this ); 379 QPainter p( this );
380 for ( int i = 0; i < numButtons; i++ ) 380 for ( int i = 0; i < numButtons; i++ )
381 paintButton( &p, i ); 381 paintButton( &p, i );
382 } 382 }
383// for ( int i = 0; i < numButtons; i++ ) { 383// for ( int i = 0; i < numButtons; i++ ) {
384// paintButton( &p, i ); 384// paintButton( &p, i );
385// } 385// }
386// // draw the slider 386// // draw the slider
387// slider->repaint( TRUE ); 387// slider->repaint( TRUE );
388 } 388 }
389} 389}
390 390
391 391
392void VideoWidget::closeEvent( QCloseEvent* ) { 392void VideoWidget::closeEvent( QCloseEvent* ) {
393 mediaPlayerState->setList(); 393 mediaPlayerState->setList();
394} 394}
395 395
396 396
397bool VideoWidget::playVideo() { 397bool VideoWidget::playVideo() {
398 bool result = FALSE; 398 bool result = FALSE;
399 399
400 int stream = 0; 400 int stream = 0;
401 401
402 int sw = 240; 402 int sw = 240;
403 int sh = 320; 403 int sh = 320;
404 int dd = QPixmap::defaultDepth(); 404 int dd = QPixmap::defaultDepth();
405 int w = height(); 405 int w = height();
406 int h = width(); 406 int h = width();
407 407
408 return true; 408 return true;
409} 409}
410 410
411void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 411void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
412 switch ( e->key() ) { 412 switch ( e->key() ) {
413////////////////////////////// Zaurus keys 413////////////////////////////// Zaurus keys
414 case Key_Home: 414 case Key_Home:
415 break; 415 break;
416 case Key_F9: //activity 416 case Key_F9: //activity
417 break; 417 break;
418 case Key_F10: //contacts 418 case Key_F10: //contacts
419// hide(); 419// hide();
420 break; 420 break;
421 case Key_F11: //menu 421 case Key_F11: //menu
422 break; 422 break;
423 case Key_F12: //home 423 case Key_F12: //home
424 break; 424 break;
425 case Key_F13: //mail 425 case Key_F13: //mail
426 break; 426 break;
427 case Key_Space: { 427 case Key_Space: {
428 if(mediaPlayerState->playing()) { 428 if(mediaPlayerState->playing()) {
429 mediaPlayerState->setPlaying(FALSE); 429 mediaPlayerState->setPlaying(FALSE);
430 } else { 430 } else {
431 mediaPlayerState->setPlaying(TRUE); 431 mediaPlayerState->setPlaying(TRUE);
432 } 432 }
433 } 433 }
434 break; 434 break;
435 case Key_Down: 435 case Key_Down:
436// toggleButton(6); 436// toggleButton(6);
437// emit lessClicked(); 437// emit lessClicked();
438// emit lessReleased(); 438// emit lessReleased();
439// toggleButton(6); 439// toggleButton(6);
440 break; 440 break;
441 case Key_Up: 441 case Key_Up:
442// toggleButton(5); 442// toggleButton(5);
443// emit moreClicked(); 443// emit moreClicked();
444// emit moreReleased(); 444// emit moreReleased();
445// toggleButton(5); 445// toggleButton(5);
446 break; 446 break;
447 case Key_Right: 447 case Key_Right:
448 mediaPlayerState->setNext(); 448 mediaPlayerState->setNext();
449 break; 449 break;
450 case Key_Left: 450 case Key_Left:
451 mediaPlayerState->setPrev(); 451 mediaPlayerState->setPrev();
452 break; 452 break;
453 case Key_Escape: 453 case Key_Escape:
454 break; 454 break;
455 455
456 }; 456 };
457} 457}
458 458
459XineVideoWidget* VideoWidget::vidWidget() { 459XineVideoWidget* VideoWidget::vidWidget() {
460 return videoFrame; 460 return videoFrame;
461} 461}
462 462
463 463
464void VideoWidget::setFullscreen ( bool b ) { 464void VideoWidget::setFullscreen ( bool b ) {
465 setToggleButton( VideoFullscreen, b ); 465 setToggleButton( VideoFullscreen, b );
466} 466}