-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 5b53568..53837c7 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -287,220 +287,211 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
287 | } | 287 | } |
288 | 288 | ||
289 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 289 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
290 | for ( int i = 0; i < numVButtons; i++ ) { | 290 | for ( int i = 0; i < numVButtons; i++ ) { |
291 | if ( event->state() == QMouseEvent::LeftButton ) { | 291 | if ( event->state() == QMouseEvent::LeftButton ) { |
292 | // The test to see if the mouse click is inside the button or not | 292 | // The test to see if the mouse click is inside the button or not |
293 | int x = event->pos().x() - xoff; | 293 | int x = event->pos().x() - xoff; |
294 | int y = event->pos().y() - yoff; | 294 | int y = event->pos().y() - yoff; |
295 | 295 | ||
296 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 296 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
297 | && y < imgButtonMask->height() | 297 | && y < imgButtonMask->height() |
298 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 298 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
299 | 299 | ||
300 | if ( isOnButton && !videoButtons[i].isHeld ) { | 300 | if ( isOnButton && !videoButtons[i].isHeld ) { |
301 | videoButtons[i].isHeld = TRUE; | 301 | videoButtons[i].isHeld = TRUE; |
302 | toggleButton(i); | 302 | toggleButton(i); |
303 | 303 | ||
304 | switch (i) { | 304 | switch (i) { |
305 | case VideoVolUp: | 305 | case VideoVolUp: |
306 | emit moreClicked(); | 306 | emit moreClicked(); |
307 | return; | 307 | return; |
308 | case VideoVolDown: | 308 | case VideoVolDown: |
309 | emit lessClicked(); | 309 | emit lessClicked(); |
310 | return; | 310 | return; |
311 | } | 311 | } |
312 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 312 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
313 | videoButtons[i].isHeld = FALSE; | 313 | videoButtons[i].isHeld = FALSE; |
314 | toggleButton(i); | 314 | toggleButton(i); |
315 | } | 315 | } |
316 | } else { | 316 | } else { |
317 | 317 | ||
318 | if ( videoButtons[i].isHeld ) { | 318 | if ( videoButtons[i].isHeld ) { |
319 | videoButtons[i].isHeld = FALSE; | 319 | videoButtons[i].isHeld = FALSE; |
320 | if ( !videoButtons[i].isToggle ) { | 320 | if ( !videoButtons[i].isToggle ) { |
321 | setToggleButton( i, FALSE ); | 321 | setToggleButton( i, FALSE ); |
322 | } | 322 | } |
323 | 323 | ||
324 | switch(i) { | 324 | switch(i) { |
325 | 325 | ||
326 | case VideoPlay: { | 326 | case VideoPlay: { |
327 | if( mediaPlayerState->isPaused ) { | 327 | if( mediaPlayerState->isPaused ) { |
328 | setToggleButton( i, FALSE ); | 328 | setToggleButton( i, FALSE ); |
329 | mediaPlayerState->setPaused( FALSE ); | 329 | mediaPlayerState->setPaused( FALSE ); |
330 | return; | 330 | return; |
331 | } else if( !mediaPlayerState->isPaused ) { | 331 | } else if( !mediaPlayerState->isPaused ) { |
332 | setToggleButton( i, TRUE ); | 332 | setToggleButton( i, TRUE ); |
333 | mediaPlayerState->setPaused( TRUE ); | 333 | mediaPlayerState->setPaused( TRUE ); |
334 | return; | 334 | return; |
335 | } else { | 335 | } else { |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 340 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
341 | case VideoNext: mediaPlayerState->setNext(); return; | 341 | case VideoNext: mediaPlayerState->setNext(); return; |
342 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 342 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
343 | case VideoVolUp: emit moreReleased(); return; | 343 | case VideoVolUp: emit moreReleased(); return; |
344 | case VideoVolDown: emit lessReleased(); return; | 344 | case VideoVolDown: emit lessReleased(); return; |
345 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 345 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
346 | } | 346 | } |
347 | } | 347 | } |
348 | } | 348 | } |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 352 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
353 | mouseMoveEvent( event ); | 353 | mouseMoveEvent( event ); |
354 | } | 354 | } |
355 | 355 | ||
356 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 356 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
357 | if ( mediaPlayerState->fullscreen() ) { | 357 | if ( mediaPlayerState->fullscreen() ) { |
358 | mediaPlayerState->setFullscreen( FALSE ); | 358 | mediaPlayerState->setFullscreen( FALSE ); |
359 | makeVisible(); | 359 | makeVisible(); |
360 | } | 360 | } |
361 | mouseMoveEvent( event ); | 361 | mouseMoveEvent( event ); |
362 | } | 362 | } |
363 | 363 | ||
364 | void VideoWidget::showEvent( QShowEvent* ) { | 364 | void VideoWidget::showEvent( QShowEvent* ) { |
365 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 365 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
366 | mouseMoveEvent( &event ); | 366 | mouseMoveEvent( &event ); |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | void VideoWidget::backToNormal() { | 370 | void VideoWidget::backToNormal() { |
371 | mediaPlayerState->setFullscreen( FALSE ); | 371 | mediaPlayerState->setFullscreen( FALSE ); |
372 | makeVisible(); | 372 | makeVisible(); |
373 | } | 373 | } |
374 | 374 | ||
375 | void VideoWidget::makeVisible() { | 375 | void VideoWidget::makeVisible() { |
376 | if ( mediaPlayerState->fullscreen() ) { | 376 | if ( mediaPlayerState->fullscreen() ) { |
377 | setBackgroundMode( QWidget::NoBackground ); | 377 | setBackgroundMode( QWidget::NoBackground ); |
378 | showFullScreen(); | 378 | showFullScreen(); |
379 | resize( qApp->desktop()->size() ); | 379 | resize( qApp->desktop()->size() ); |
380 | slider->hide(); | 380 | slider->hide(); |
381 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 381 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
382 | 382 | ||
383 | } else { | 383 | } else { |
384 | showNormal(); | 384 | showNormal(); |
385 | showMaximized(); | 385 | showMaximized(); |
386 | setBackgroundPixmap( *pixBg ); | 386 | setBackgroundPixmap( *pixBg ); |
387 | if ( mediaPlayerState->streaming() ) { | 387 | if ( mediaPlayerState->streaming() ) { |
388 | slider->hide(); | 388 | slider->hide(); |
389 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 389 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
390 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 390 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
391 | } else { | 391 | } else { |
392 | slider->show(); | 392 | slider->show(); |
393 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 393 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
394 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 394 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
395 | } | 395 | } |
396 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 396 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
397 | qApp->processEvents(); | 397 | qApp->processEvents(); |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 402 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
403 | QPainter p( this ); | 403 | QPainter p( this ); |
404 | 404 | ||
405 | if ( mediaPlayerState->fullscreen() ) { | 405 | if ( mediaPlayerState->fullscreen() ) { |
406 | // Clear the background | 406 | // Clear the background |
407 | p.setBrush( QBrush( Qt::black ) ); | 407 | p.setBrush( QBrush( Qt::black ) ); |
408 | } else { | 408 | } else { |
409 | if ( !pe->erased() ) { | 409 | if ( !pe->erased() ) { |
410 | // Combine with background and double buffer | 410 | // Combine with background and double buffer |
411 | QPixmap pix( pe->rect().size() ); | 411 | QPixmap pix( pe->rect().size() ); |
412 | QPainter p( &pix ); | 412 | QPainter p( &pix ); |
413 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 413 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
414 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 414 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
415 | for ( int i = 0; i < numVButtons; i++ ) { | 415 | for ( int i = 0; i < numVButtons; i++ ) { |
416 | paintButton( &p, i ); | 416 | paintButton( &p, i ); |
417 | } | 417 | } |
418 | QPainter p2( this ); | 418 | QPainter p2( this ); |
419 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 419 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
420 | } else { | 420 | } else { |
421 | QPainter p( this ); | 421 | QPainter p( this ); |
422 | for ( int i = 0; i < numVButtons; i++ ) | 422 | for ( int i = 0; i < numVButtons; i++ ) |
423 | paintButton( &p, i ); | 423 | paintButton( &p, i ); |
424 | } | 424 | } |
425 | slider->repaint( TRUE ); | 425 | slider->repaint( TRUE ); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | 429 | ||
430 | void VideoWidget::closeEvent( QCloseEvent* ) { | 430 | void VideoWidget::closeEvent( QCloseEvent* ) { |
431 | mediaPlayerState->setList(); | 431 | mediaPlayerState->setList(); |
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
435 | 435 | ||
436 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 436 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
437 | switch ( e->key() ) { | 437 | switch ( e->key() ) { |
438 | ////////////////////////////// Zaurus keys | 438 | ////////////////////////////// Zaurus keys |
439 | case Key_Home: | 439 | case Key_Home: |
440 | break; | 440 | break; |
441 | case Key_F9: //activity | 441 | case Key_F9: //activity |
442 | break; | 442 | break; |
443 | case Key_F10: //contacts | 443 | case Key_F10: //contacts |
444 | // hide(); | 444 | // hide(); |
445 | break; | 445 | break; |
446 | case Key_F11: //menu | 446 | case Key_F11: //menu |
447 | break; | 447 | break; |
448 | case Key_F12: //home | 448 | case Key_F12: //home |
449 | break; | 449 | break; |
450 | case Key_F13: //mail | 450 | case Key_F13: //mail |
451 | break; | 451 | break; |
452 | case Key_Space: { | 452 | case Key_Space: { |
453 | if(mediaPlayerState->playing()) { | 453 | if(mediaPlayerState->playing()) { |
454 | mediaPlayerState->setPlaying(FALSE); | 454 | mediaPlayerState->setPlaying(FALSE); |
455 | } else { | 455 | } else { |
456 | mediaPlayerState->setPlaying(TRUE); | 456 | mediaPlayerState->setPlaying(TRUE); |
457 | } | 457 | } |
458 | } | 458 | } |
459 | break; | 459 | break; |
460 | case Key_Down: | 460 | case Key_Down: |
461 | // toggleButton(6); | 461 | // toggleButton(6); |
462 | emit lessClicked(); | 462 | emit lessClicked(); |
463 | emit lessReleased(); | 463 | emit lessReleased(); |
464 | // toggleButton(6); | 464 | // toggleButton(6); |
465 | break; | 465 | break; |
466 | case Key_Up: | 466 | case Key_Up: |
467 | // toggleButton(5); | 467 | // toggleButton(5); |
468 | emit moreClicked(); | 468 | emit moreClicked(); |
469 | emit moreReleased(); | 469 | emit moreReleased(); |
470 | // toggleButton(5); | 470 | // toggleButton(5); |
471 | break; | 471 | break; |
472 | case Key_Right: | 472 | case Key_Right: |
473 | mediaPlayerState->setNext(); | 473 | mediaPlayerState->setNext(); |
474 | break; | 474 | break; |
475 | case Key_Left: | 475 | case Key_Left: |
476 | mediaPlayerState->setPrev(); | 476 | mediaPlayerState->setPrev(); |
477 | break; | 477 | break; |
478 | case Key_Escape: | 478 | case Key_Escape: |
479 | #if defined(QT_QWS_IPAQ) | ||
480 | if( mediaPlayerState->isPaused ) { | ||
481 | setToggleButton( i, FALSE ); | ||
482 | mediaPlayerState->setPaused( FALSE ); | ||
483 | } else if( !mediaPlayerState->isPaused ) { | ||
484 | setToggleButton( i, TRUE ); | ||
485 | mediaPlayerState->setPaused( TRUE ); | ||
486 | } | ||
487 | #endif | ||
488 | break; | 479 | break; |
489 | 480 | ||
490 | }; | 481 | }; |
491 | } | 482 | } |
492 | 483 | ||
493 | XineVideoWidget* VideoWidget::vidWidget() { | 484 | XineVideoWidget* VideoWidget::vidWidget() { |
494 | return videoFrame; | 485 | return videoFrame; |
495 | } | 486 | } |
496 | 487 | ||
497 | 488 | ||
498 | void VideoWidget::setFullscreen ( bool b ) { | 489 | void VideoWidget::setFullscreen ( bool b ) { |
499 | setToggleButton( VideoFullscreen, b ); | 490 | setToggleButton( VideoFullscreen, b ); |
500 | } | 491 | } |
501 | 492 | ||
502 | 493 | ||
503 | void VideoWidget::setPlaying( bool b) { | 494 | void VideoWidget::setPlaying( bool b) { |
504 | setToggleButton( VideoPlay, b ); | 495 | setToggleButton( VideoPlay, b ); |
505 | } | 496 | } |
506 | 497 | ||