summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-15 16:43:50 (UTC)
committer harlekin <harlekin>2002-08-15 16:43:50 (UTC)
commit09b410db4f8f0104ada5f76d611b39e49e327670 (patch) (unidiff)
treecdeaf715c48fa93c8e370d85ffdbf5f794e6a815
parent71520dfe386a04f8bce5d6f5d9d86dcbeda000d2 (diff)
downloadopie-09b410db4f8f0104ada5f76d611b39e49e327670.zip
opie-09b410db4f8f0104ada5f76d611b39e49e327670.tar.gz
opie-09b410db4f8f0104ada5f76d611b39e49e327670.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp17
1 files changed, 1 insertions, 16 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index f5780aa..5a23d84 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -105,65 +105,64 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
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 for ( int i = 0; i < 7; i++ ) { 118 for ( int i = 0; i < 7; i++ ) {
119 buttonPixUp[i] = NULL; 119 buttonPixUp[i] = NULL;
120 buttonPixDown[i] = NULL; 120 buttonPixDown[i] = NULL;
121 } 121 }
122 122
123 setBackgroundPixmap( *pixBg ); 123 setBackgroundPixmap( *pixBg );
124 124
125 slider = new QSlider( Qt::Horizontal, this ); 125 slider = new QSlider( Qt::Horizontal, this );
126 slider->setMinValue( 0 ); 126 slider->setMinValue( 0 );
127 slider->setMaxValue( 1 ); 127 slider->setMaxValue( 1 );
128 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 128 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
129 slider->setFocusPolicy( QWidget::NoFocus ); 129 slider->setFocusPolicy( QWidget::NoFocus );
130 130
131 resizeEvent( NULL ); 131 resizeEvent( NULL );
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 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 135 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
136 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 136 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
137 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
138 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 137 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
139 138
140 setLength( mediaPlayerState->length() ); 139 setLength( mediaPlayerState->length() );
141 setPosition( mediaPlayerState->position() ); 140 setPosition( mediaPlayerState->position() );
142 setFullscreen( mediaPlayerState->fullscreen() ); 141 setFullscreen( mediaPlayerState->fullscreen() );
143 setPaused( mediaPlayerState->paused() ); 142 setPaused( mediaPlayerState->paused() );
144 setPlaying( mediaPlayerState->playing() ); 143 setPlaying( mediaPlayerState->playing() );
145} 144}
146 145
147 146
148VideoWidget::~VideoWidget() { 147VideoWidget::~VideoWidget() {
149 148
150 for ( int i = 0; i < 7; i++ ) { 149 for ( int i = 0; i < 7; i++ ) {
151 delete buttonPixUp[i]; 150 delete buttonPixUp[i];
152 delete buttonPixDown[i]; 151 delete buttonPixDown[i];
153 } 152 }
154 153
155 delete pixBg; 154 delete pixBg;
156 delete imgUp; 155 delete imgUp;
157 delete imgDn; 156 delete imgDn;
158 delete imgButtonMask; 157 delete imgButtonMask;
159 for ( int i = 0; i < 7; i++ ) { 158 for ( int i = 0; i < 7; i++ ) {
160 delete masks[i]; 159 delete masks[i];
161 } 160 }
162 161
163} 162}
164 163
165QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 164QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
166 QPixmap pix( img.width(), img.height() ); 165 QPixmap pix( img.width(), img.height() );
167 QPainter p( &pix ); 166 QPainter p( &pix );
168 p.drawTiledPixmap( pix.rect(), bg, offset ); 167 p.drawTiledPixmap( pix.rect(), bg, offset );
169 p.drawImage( 0, 0, img ); 168 p.drawImage( 0, 0, img );
@@ -325,144 +324,133 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
325 return; 324 return;
326 } 325 }
327 } else if ( !isOnButton && videoButtons[i].isHeld ) { 326 } else if ( !isOnButton && videoButtons[i].isHeld ) {
328 videoButtons[i].isHeld = FALSE; 327 videoButtons[i].isHeld = FALSE;
329 toggleButton(i); 328 toggleButton(i);
330 } 329 }
331 } else { 330 } else {
332 331
333 if ( videoButtons[i].isHeld ) { 332 if ( videoButtons[i].isHeld ) {
334 videoButtons[i].isHeld = FALSE; 333 videoButtons[i].isHeld = FALSE;
335 if ( !videoButtons[i].isToggle ) { 334 if ( !videoButtons[i].isToggle ) {
336 setToggleButton( i, FALSE ); 335 setToggleButton( i, FALSE );
337 } 336 }
338 337
339 switch(i) { 338 switch(i) {
340 339
341 case VideoPlay: { 340 case VideoPlay: {
342 if( mediaPlayerState->isPaused ) { 341 if( mediaPlayerState->isPaused ) {
343 setToggleButton( i, FALSE ); 342 setToggleButton( i, FALSE );
344 mediaPlayerState->setPaused( FALSE ); 343 mediaPlayerState->setPaused( FALSE );
345 return; 344 return;
346 } else if( !mediaPlayerState->isPaused ) { 345 } else if( !mediaPlayerState->isPaused ) {
347 setToggleButton( i, TRUE ); 346 setToggleButton( i, TRUE );
348 mediaPlayerState->setPaused( TRUE ); 347 mediaPlayerState->setPaused( TRUE );
349 return; 348 return;
350 } else { 349 } else {
351 // setToggleButton( i, TRUE ); 350 // setToggleButton( i, TRUE );
352 // mediaPlayerState->setPlaying( videoButtons[i].isDown ); 351 // mediaPlayerState->setPlaying( videoButtons[i].isDown );
353 } 352 }
354 } 353 }
355 354
356 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; 355 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
357// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
358 case VideoNext: mediaPlayerState->setNext(); return; 356 case VideoNext: mediaPlayerState->setNext(); return;
359 case VideoPrevious: mediaPlayerState->setPrev(); return; 357 case VideoPrevious: mediaPlayerState->setPrev(); return;
360 case VideoVolUp: emit moreReleased(); return; 358 case VideoVolUp: emit moreReleased(); return;
361 case VideoVolDown: emit lessReleased(); return; 359 case VideoVolDown: emit lessReleased(); return;
362 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 360 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
363 } 361 }
364 } 362 }
365 } 363 }
366 } 364 }
367} 365}
368 366
369void VideoWidget::mousePressEvent( QMouseEvent *event ) { 367void VideoWidget::mousePressEvent( QMouseEvent *event ) {
370 mouseMoveEvent( event ); 368 mouseMoveEvent( event );
371} 369}
372 370
373void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 371void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
374 if ( mediaPlayerState->fullscreen() ) { 372 if ( mediaPlayerState->fullscreen() ) {
375 mediaPlayerState->setFullscreen( FALSE ); 373 mediaPlayerState->setFullscreen( FALSE );
376 makeVisible(); 374 makeVisible();
377 } 375 }
378 mouseMoveEvent( event ); 376 mouseMoveEvent( event );
379} 377}
380 378
381void VideoWidget::showEvent( QShowEvent* ) { 379void VideoWidget::showEvent( QShowEvent* ) {
382 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 380 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
383 mouseMoveEvent( &event ); 381 mouseMoveEvent( &event );
384} 382}
385 383
386 384
387void VideoWidget::makeVisible() { 385void VideoWidget::makeVisible() {
388 if ( mediaPlayerState->fullscreen() ) { 386 if ( mediaPlayerState->fullscreen() ) {
389 setBackgroundMode( QWidget::NoBackground ); 387 setBackgroundMode( QWidget::NoBackground );
390 showFullScreen(); 388 showFullScreen();
391 resize( qApp->desktop()->size() ); 389 resize( qApp->desktop()->size() );
392 slider->hide(); 390 slider->hide();
393 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 391 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
394 } else { 392 } else {
395 showNormal(); 393 showNormal();
396 showMaximized(); 394 showMaximized();
397 slider->show(); 395 slider->show();
398 videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); 396 videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) );
399 qApp->processEvents(); 397 qApp->processEvents();
400 } 398 }
401} 399}
402 400
403 401
404void VideoWidget::paintEvent( QPaintEvent * pe) { 402void VideoWidget::paintEvent( QPaintEvent * pe) {
405 QPainter p( this ); 403 QPainter p( this );
406 404
407 if ( mediaPlayerState->fullscreen() ) { 405 if ( mediaPlayerState->fullscreen() ) {
408 // Clear the background 406 // Clear the background
409 p.setBrush( QBrush( Qt::black ) ); 407 p.setBrush( QBrush( Qt::black ) );
410 // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) );
411
412 } else { 408 } else {
413
414 // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) );
415 // draw the buttons
416
417 if ( !pe->erased() ) { 409 if ( !pe->erased() ) {
418 // Combine with background and double buffer 410 // Combine with background and double buffer
419 QPixmap pix( pe->rect().size() ); 411 QPixmap pix( pe->rect().size() );
420 QPainter p( &pix ); 412 QPainter p( &pix );
421 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 413 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
422 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 414 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
423 for ( int i = 0; i < numVButtons; i++ ) { 415 for ( int i = 0; i < numVButtons; i++ ) {
424 paintButton( &p, i ); 416 paintButton( &p, i );
425 } 417 }
426 QPainter p2( this ); 418 QPainter p2( this );
427 p2.drawPixmap( pe->rect().topLeft(), pix ); 419 p2.drawPixmap( pe->rect().topLeft(), pix );
428 } else { 420 } else {
429 QPainter p( this ); 421 QPainter p( this );
430 for ( int i = 0; i < numVButtons; i++ ) 422 for ( int i = 0; i < numVButtons; i++ )
431 paintButton( &p, i ); 423 paintButton( &p, i );
432 } 424 }
433 // for ( int i = 0; i < numButtons; i++ ) {
434 // paintButton( &p, i );
435 // }
436 // draw the slider
437 slider->repaint( TRUE ); 425 slider->repaint( TRUE );
438 } 426 }
439} 427}
440 428
441 429
442void VideoWidget::closeEvent( QCloseEvent* ) { 430void VideoWidget::closeEvent( QCloseEvent* ) {
443 mediaPlayerState->setList(); 431 mediaPlayerState->setList();
444} 432}
445 433
446 434
447 435
448void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 436void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
449 switch ( e->key() ) { 437 switch ( e->key() ) {
450////////////////////////////// Zaurus keys 438////////////////////////////// Zaurus keys
451 case Key_Home: 439 case Key_Home:
452 break; 440 break;
453 case Key_F9: //activity 441 case Key_F9: //activity
454 break; 442 break;
455 case Key_F10: //contacts 443 case Key_F10: //contacts
456// hide(); 444// hide();
457 break; 445 break;
458 case Key_F11: //menu 446 case Key_F11: //menu
459 break; 447 break;
460 case Key_F12: //home 448 case Key_F12: //home
461 break; 449 break;
462 case Key_F13: //mail 450 case Key_F13: //mail
463 break; 451 break;
464 case Key_Space: { 452 case Key_Space: {
465 if(mediaPlayerState->playing()) { 453 if(mediaPlayerState->playing()) {
466 mediaPlayerState->setPlaying(FALSE); 454 mediaPlayerState->setPlaying(FALSE);
467 } else { 455 } else {
468 mediaPlayerState->setPlaying(TRUE); 456 mediaPlayerState->setPlaying(TRUE);
@@ -473,40 +461,37 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
473// toggleButton(6); 461// toggleButton(6);
474// emit lessClicked(); 462// emit lessClicked();
475// emit lessReleased(); 463// emit lessReleased();
476// toggleButton(6); 464// toggleButton(6);
477 break; 465 break;
478 case Key_Up: 466 case Key_Up:
479// toggleButton(5); 467// toggleButton(5);
480// emit moreClicked(); 468// emit moreClicked();
481// emit moreReleased(); 469// emit moreReleased();
482// toggleButton(5); 470// toggleButton(5);
483 break; 471 break;
484 case Key_Right: 472 case Key_Right:
485 mediaPlayerState->setNext(); 473 mediaPlayerState->setNext();
486 break; 474 break;
487 case Key_Left: 475 case Key_Left:
488 mediaPlayerState->setPrev(); 476 mediaPlayerState->setPrev();
489 break; 477 break;
490 case Key_Escape: 478 case Key_Escape:
491 break; 479 break;
492 480
493 }; 481 };
494} 482}
495 483
496XineVideoWidget* VideoWidget::vidWidget() { 484XineVideoWidget* VideoWidget::vidWidget() {
497 return videoFrame; 485 return videoFrame;
498} 486}
499 487
500 488
501void VideoWidget::setFullscreen ( bool b ) { 489void VideoWidget::setFullscreen ( bool b ) {
502 setToggleButton( VideoFullscreen, b ); 490 setToggleButton( VideoFullscreen, b );
503} 491}
504 492
505void VideoWidget::setPaused( bool b) {
506// setToggleButton( VideoPause, b );
507}
508 493
509void VideoWidget::setPlaying( bool b) { 494void VideoWidget::setPlaying( bool b) {
510 setToggleButton( VideoPlay, b ); 495 setToggleButton( VideoPlay, b );
511} 496}
512 497