-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 6ed0108..48104ca 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -289,53 +289,48 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
289 | 289 | ||
290 | 290 | ||
291 | void VideoWidget::setToggleButton( int i, bool down ) { | 291 | void VideoWidget::setToggleButton( int i, bool down ) { |
292 | if ( down != videoButtons[i].isDown ) | 292 | if ( down != videoButtons[i].isDown ) |
293 | toggleButton( i ); | 293 | toggleButton( i ); |
294 | } | 294 | } |
295 | 295 | ||
296 | 296 | ||
297 | void VideoWidget::toggleButton( int i ) { | 297 | void VideoWidget::toggleButton( int i ) { |
298 | videoButtons[i].isDown = !videoButtons[i].isDown; | 298 | videoButtons[i].isDown = !videoButtons[i].isDown; |
299 | QPainter p(this); | 299 | QPainter p(this); |
300 | paintButton ( &p, i ); | 300 | paintButton ( &p, i ); |
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | void VideoWidget::paintButton( QPainter *p, int i ) { | 304 | void VideoWidget::paintButton( QPainter *p, int i ) { |
305 | if ( videoButtons[i].isDown ) | 305 | if ( videoButtons[i].isDown ) |
306 | { | 306 | { |
307 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 307 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 311 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
312 | } | 312 | } |
313 | // int x = videoButtons[i].xPos; | ||
314 | // int y = videoButtons[i].yPos; | ||
315 | // int offset = 10 + videoButtons[i].isDown; | ||
316 | // p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] ); | ||
317 | // p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); | ||
318 | } | 313 | } |
319 | 314 | ||
320 | 315 | ||
321 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 316 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
322 | for ( int i = 0; i < numVButtons; i++ ) { | 317 | for ( int i = 0; i < numVButtons; i++ ) { |
323 | if ( event->state() == QMouseEvent::LeftButton ) { | 318 | if ( event->state() == QMouseEvent::LeftButton ) { |
324 | // The test to see if the mouse click is inside the button or not | 319 | // The test to see if the mouse click is inside the button or not |
325 | int x = event->pos().x() - xoff; | 320 | int x = event->pos().x() - xoff; |
326 | int y = event->pos().y() - yoff; | 321 | int y = event->pos().y() - yoff; |
327 | 322 | ||
328 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 323 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
329 | && y < imgButtonMask->height() | 324 | && y < imgButtonMask->height() |
330 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 325 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
331 | 326 | ||
332 | if ( isOnButton && !videoButtons[i].isHeld ) { | 327 | if ( isOnButton && !videoButtons[i].isHeld ) { |
333 | videoButtons[i].isHeld = TRUE; | 328 | videoButtons[i].isHeld = TRUE; |
334 | toggleButton(i); | 329 | toggleButton(i); |
335 | 330 | ||
336 | switch (i) { | 331 | switch (i) { |
337 | case VideoVolUp: | 332 | case VideoVolUp: |
338 | emit moreClicked(); | 333 | emit moreClicked(); |
339 | return; | 334 | return; |
340 | case VideoVolDown: | 335 | case VideoVolDown: |
341 | emit lessClicked(); | 336 | emit lessClicked(); |
@@ -367,150 +362,48 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
367 | qDebug("isPaused"); | 362 | qDebug("isPaused"); |
368 | setToggleButton( i, FALSE ); | 363 | setToggleButton( i, FALSE ); |
369 | mediaPlayerState->setPaused( FALSE ); | 364 | mediaPlayerState->setPaused( FALSE ); |
370 | return; | 365 | return; |
371 | } else if( !mediaPlayerState->isPaused ) { | 366 | } else if( !mediaPlayerState->isPaused ) { |
372 | qDebug("is not paused"); | 367 | qDebug("is not paused"); |
373 | setToggleButton( i, TRUE ); | 368 | setToggleButton( i, TRUE ); |
374 | mediaPlayerState->setPaused( TRUE ); | 369 | mediaPlayerState->setPaused( TRUE ); |
375 | return; | 370 | return; |
376 | } else { | 371 | } else { |
377 | return; | 372 | return; |
378 | } | 373 | } |
379 | } | 374 | } |
380 | 375 | ||
381 | case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; | 376 | case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; |
382 | case VideoNext: mediaPlayerState->setNext(); return; | 377 | case VideoNext: mediaPlayerState->setNext(); return; |
383 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 378 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
384 | case VideoVolUp: emit moreReleased(); return; | 379 | case VideoVolUp: emit moreReleased(); return; |
385 | case VideoVolDown: emit lessReleased(); return; | 380 | case VideoVolDown: emit lessReleased(); return; |
386 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 381 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
387 | } | 382 | } |
388 | } | 383 | } |
389 | } | 384 | } |
390 | } | 385 | } |
391 | |||
392 | // for ( int i = 0; i < numVButtons; i++ ) | ||
393 | // { | ||
394 | // if ( event->state() == QMouseEvent::LeftButton ) | ||
395 | // { | ||
396 | // // The test to see if the mouse click is inside the button or not | ||
397 | // int x = event->pos().x() - xoff; | ||
398 | // int y = event->pos().y() - yoff; | ||
399 | |||
400 | // bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | ||
401 | // && y < imgButtonMask->height() | ||
402 | // && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | ||
403 | |||
404 | // if ( isOnButton && !videoButtons[i].isHeld ) | ||
405 | // { | ||
406 | // qDebug("key %d", i); | ||
407 | |||
408 | // videoButtons[i].isHeld = TRUE; | ||
409 | // toggleButton(i); | ||
410 | // switch (i) { | ||
411 | // case VideoVolUp: | ||
412 | // emit moreClicked(); | ||
413 | // return; | ||
414 | // case VideoVolDown: | ||
415 | // emit lessClicked(); | ||
416 | // return; | ||
417 | // } | ||
418 | // } else if ( !isOnButton && videoButtons[i].isHeld ) { | ||
419 | // videoButtons[i].isHeld = FALSE; | ||
420 | // toggleButton(i); | ||
421 | // } | ||
422 | |||
423 | |||
424 | // } else { | ||
425 | |||
426 | // if ( videoButtons[i].isHeld ) | ||
427 | // { | ||
428 | // videoButtons[i].isHeld = FALSE; | ||
429 | // if ( !videoButtons[i].isToggle ) { | ||
430 | // setToggleButton( i, FALSE ); | ||
431 | // } | ||
432 | // qDebug("key %d", i); | ||
433 | // switch(i) { | ||
434 | // case VideoPlay: | ||
435 | // { | ||
436 | // if( mediaPlayerState->isPaused ) { | ||
437 | // setToggleButton( i, FALSE ); | ||
438 | // mediaPlayerState->setPaused( FALSE ); | ||
439 | // return; | ||
440 | // } | ||
441 | // else if( !mediaPlayerState->isPaused ) { | ||
442 | // setToggleButton( i, TRUE ); | ||
443 | // mediaPlayerState->setPaused( TRUE ); | ||
444 | // return; | ||
445 | // } else { | ||
446 | // return; | ||
447 | // } | ||
448 | // } | ||
449 | |||
450 | // case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | ||
451 | // // case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | ||
452 | // // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
453 | // case VideoNext: mediaPlayerState->setNext(); return; | ||
454 | // case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
455 | // case VideoVolUp: emit moreReleased(); return; | ||
456 | // case VideoVolDown: emit lessReleased(); return; | ||
457 | // // case VideoPlayList: mediaPlayerState->setList(); return; | ||
458 | // case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
459 | // } | ||
460 | // } | ||
461 | // } | ||
462 | // } | ||
463 | |||
464 | |||
465 | |||
466 | |||
467 | |||
468 | // for ( int i = 0; i < numButtons; i++ ) { | ||
469 | // int x = videoButtons[i].xPos; | ||
470 | // int y = videoButtons[i].yPos; | ||
471 | // if ( event->state() == QMouseEvent::LeftButton ) { | ||
472 | // // The test to see if the mouse click is inside the circular button or not | ||
473 | // // (compared with the radius squared to avoid a square-root of our distance) | ||
474 | // int radius = 16; | ||
475 | // QPoint center = QPoint( x + radius, y + radius ); | ||
476 | // QPoint dXY = center - event->pos(); | ||
477 | // int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | ||
478 | // bool isOnButton = dist <= (radius * radius); | ||
479 | // if ( isOnButton != videoButtons[i].isHeld ) { | ||
480 | // videoButtons[i].isHeld = isOnButton; | ||
481 | // toggleButton(i); | ||
482 | // } | ||
483 | // } else { | ||
484 | // if ( videoButtons[i].isHeld ) { | ||
485 | // videoButtons[i].isHeld = FALSE; | ||
486 | // if ( !videoButtons[i].isToggle ) | ||
487 | // setToggleButton( i, FALSE ); | ||
488 | // } | ||
489 | // } | ||
490 | |||
491 | |||
492 | // } | ||
493 | } | 386 | } |
494 | 387 | ||
495 | 388 | ||
496 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 389 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
497 | mouseMoveEvent( event ); | 390 | mouseMoveEvent( event ); |
498 | } | 391 | } |
499 | 392 | ||
500 | 393 | ||
501 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 394 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
502 | if ( mediaPlayerState->fullscreen() ) | 395 | if ( mediaPlayerState->fullscreen() ) |
503 | { | 396 | { |
504 | mediaPlayerState->setFullscreen( FALSE ); | 397 | mediaPlayerState->setFullscreen( FALSE ); |
505 | makeVisible(); | 398 | makeVisible(); |
506 | } | 399 | } |
507 | mouseMoveEvent( event ); | 400 | mouseMoveEvent( event ); |
508 | // } | 401 | // } |
509 | } | 402 | } |
510 | 403 | ||
511 | 404 | ||
512 | void VideoWidget::makeVisible() { | 405 | void VideoWidget::makeVisible() { |
513 | if ( mediaPlayerState->fullscreen() ) | 406 | if ( mediaPlayerState->fullscreen() ) |
514 | { | 407 | { |
515 | setBackgroundMode( QWidget::NoBackground ); | 408 | setBackgroundMode( QWidget::NoBackground ); |
516 | showFullScreen(); | 409 | showFullScreen(); |