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