-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 49 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
2 files changed, 25 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index a847605..c643273 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -128,33 +128,32 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
128 | buttonPixDown[i] = NULL; | 128 | buttonPixDown[i] = NULL; |
129 | } | 129 | } |
130 | 130 | ||
131 | setBackgroundPixmap( *pixBg ); | 131 | setBackgroundPixmap( *pixBg ); |
132 | 132 | ||
133 | slider = new QSlider( Qt::Horizontal, this ); | 133 | slider = new QSlider( Qt::Horizontal, this ); |
134 | slider->setMinValue( 0 ); | 134 | slider->setMinValue( 0 ); |
135 | slider->setMaxValue( 1 ); | 135 | slider->setMaxValue( 1 ); |
136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
137 | //slider->setFocusPolicy( QWidget::NoFocus ); | 137 | //slider->setFocusPolicy( QWidget::NoFocus ); |
138 | 138 | ||
139 | resizeEvent( NULL ); | 139 | resizeEvent( NULL ); |
140 | 140 | ||
141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
142 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 142 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
143 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 143 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
144 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | ||
145 | 144 | ||
146 | setLength( mediaPlayerState->length() ); | 145 | setLength( mediaPlayerState->length() ); |
147 | setPosition( mediaPlayerState->position() ); | 146 | setPosition( mediaPlayerState->position() ); |
148 | setFullscreen( mediaPlayerState->fullscreen() ); | 147 | setFullscreen( mediaPlayerState->fullscreen() ); |
149 | setPlaying( mediaPlayerState->playing() ); | 148 | setPlaying( mediaPlayerState->playing() ); |
150 | } | 149 | } |
151 | 150 | ||
152 | 151 | ||
153 | VideoWidget::~VideoWidget() { | 152 | VideoWidget::~VideoWidget() { |
154 | 153 | ||
155 | for ( int i = 0; i < 7; i++ ) { | 154 | for ( int i = 0; i < 7; i++ ) { |
156 | delete buttonPixUp[i]; | 155 | delete buttonPixUp[i]; |
157 | delete buttonPixDown[i]; | 156 | delete buttonPixDown[i]; |
158 | } | 157 | } |
159 | 158 | ||
160 | delete pixBg; | 159 | delete pixBg; |
@@ -368,73 +367,76 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
368 | void VideoWidget::showEvent( QShowEvent* ) { | 367 | void VideoWidget::showEvent( QShowEvent* ) { |
369 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 368 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
370 | mouseMoveEvent( &event ); | 369 | mouseMoveEvent( &event ); |
371 | } | 370 | } |
372 | 371 | ||
373 | 372 | ||
374 | void VideoWidget::backToNormal() { | 373 | void VideoWidget::backToNormal() { |
375 | mediaPlayerState->setFullscreen( FALSE ); | 374 | mediaPlayerState->setFullscreen( FALSE ); |
376 | makeVisible(); | 375 | makeVisible(); |
377 | } | 376 | } |
378 | 377 | ||
379 | void VideoWidget::makeVisible() { | 378 | void VideoWidget::makeVisible() { |
380 | if ( mediaPlayerState->fullscreen() ) { | 379 | if ( mediaPlayerState->fullscreen() ) { |
381 | setBackgroundMode( QWidget::NoBackground ); | 380 | setBackgroundMode( QWidget::NoBackground ); |
382 | showFullScreen(); | 381 | showFullScreen(); |
383 | resize( qApp->desktop()->size() ); | 382 | resize( qApp->desktop()->size() ); |
384 | slider->hide(); | ||
385 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 383 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
384 | |||
385 | slider->hide(); | ||
386 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
387 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
388 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
389 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
390 | |||
386 | } else { | 391 | } else { |
387 | showNormal(); | 392 | showNormal(); |
388 | showMaximized(); | 393 | showMaximized(); |
389 | setBackgroundPixmap( *pixBg ); | 394 | setBackgroundPixmap( *pixBg ); |
390 | QWidget *d = QApplication::desktop(); | 395 | QWidget *d = QApplication::desktop(); |
391 | int w = d->width(); | 396 | int w = d->width(); |
392 | int h = d->height(); | 397 | int h = d->height(); |
393 | 398 | ||
394 | if(w>h) { | 399 | if(w>h) { |
395 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 400 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
396 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 401 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
397 | } else { | 402 | } else { |
398 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 403 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
399 | } | 404 | } |
400 | } | ||
401 | } | ||
402 | |||
403 | 405 | ||
404 | void VideoWidget::setSeekable( bool isSeekable ) { | 406 | if ( !mediaPlayerState->seekable() ) { |
405 | 407 | if( !slider->isHidden()) { | |
406 | if ( !isSeekable || mediaPlayerState->fullscreen() ) { | 408 | slider->hide(); |
407 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 409 | } |
408 | if( !slider->isHidden()) { | 410 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
409 | slider->hide(); | 411 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
412 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
413 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
414 | } else { | ||
415 | slider->show(); | ||
416 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
417 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
418 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
419 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
410 | } | 420 | } |
411 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
412 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
413 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
414 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
415 | } else { | ||
416 | slider->show(); | ||
417 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
418 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
419 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
420 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | |||
426 | |||
425 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 427 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
426 | QPainter p( this ); | 428 | QPainter p( this ); |
427 | 429 | ||
428 | if ( mediaPlayerState->fullscreen() ) { | 430 | if ( mediaPlayerState->fullscreen() ) { |
429 | // Clear the background | 431 | // Clear the background |
430 | p.setBrush( QBrush( Qt::black ) ); | 432 | p.setBrush( QBrush( Qt::black ) ); |
431 | } else { | 433 | } else { |
432 | if ( !pe->erased() ) { | 434 | if ( !pe->erased() ) { |
433 | // Combine with background and double buffer | 435 | // Combine with background and double buffer |
434 | QPixmap pix( pe->rect().size() ); | 436 | QPixmap pix( pe->rect().size() ); |
435 | QPainter p( &pix ); | 437 | QPainter p( &pix ); |
436 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 438 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
437 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 439 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
438 | for ( int i = 0; i < numVButtons; i++ ) { | 440 | for ( int i = 0; i < numVButtons; i++ ) { |
439 | paintButton( &p, i ); | 441 | paintButton( &p, i ); |
440 | } | 442 | } |
@@ -442,33 +444,32 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
442 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 444 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
443 | } else { | 445 | } else { |
444 | QPainter p( this ); | 446 | QPainter p( this ); |
445 | for ( int i = 0; i < numVButtons; i++ ) | 447 | for ( int i = 0; i < numVButtons; i++ ) |
446 | paintButton( &p, i ); | 448 | paintButton( &p, i ); |
447 | } | 449 | } |
448 | //slider->repaint( TRUE ); | 450 | //slider->repaint( TRUE ); |
449 | } | 451 | } |
450 | } | 452 | } |
451 | 453 | ||
452 | 454 | ||
453 | void VideoWidget::closeEvent( QCloseEvent* ) { | 455 | void VideoWidget::closeEvent( QCloseEvent* ) { |
454 | mediaPlayerState->setList(); | 456 | mediaPlayerState->setList(); |
455 | } | 457 | } |
456 | 458 | ||
457 | 459 | ||
458 | |||
459 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 460 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
460 | switch ( e->key() ) { | 461 | switch ( e->key() ) { |
461 | ////////////////////////////// Zaurus keys | 462 | ////////////////////////////// Zaurus keys |
462 | case Key_Home: | 463 | case Key_Home: |
463 | break; | 464 | break; |
464 | case Key_F9: //activity | 465 | case Key_F9: //activity |
465 | break; | 466 | break; |
466 | case Key_F10: //contacts | 467 | case Key_F10: //contacts |
467 | // hide(); | 468 | // hide(); |
468 | break; | 469 | break; |
469 | case Key_F11: //menu | 470 | case Key_F11: //menu |
470 | break; | 471 | break; |
471 | case Key_F12: //home | 472 | case Key_F12: //home |
472 | break; | 473 | break; |
473 | case Key_F13: //mail | 474 | case Key_F13: //mail |
474 | break; | 475 | break; |
@@ -497,24 +498,24 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
497 | break; | 498 | break; |
498 | case Key_Left: | 499 | case Key_Left: |
499 | mediaPlayerState->setPrev(); | 500 | mediaPlayerState->setPrev(); |
500 | break; | 501 | break; |
501 | case Key_Escape: | 502 | case Key_Escape: |
502 | break; | 503 | break; |
503 | 504 | ||
504 | }; | 505 | }; |
505 | } | 506 | } |
506 | 507 | ||
507 | XineVideoWidget* VideoWidget::vidWidget() { | 508 | XineVideoWidget* VideoWidget::vidWidget() { |
508 | return videoFrame; | 509 | return videoFrame; |
509 | } | 510 | } |
510 | 511 | ||
511 | 512 | ||
512 | void VideoWidget::setFullscreen ( bool b ) { | 513 | void VideoWidget::setFullscreen ( bool b ) { |
513 | setToggleButton( VideoFullscreen, b ); | 514 | setToggleButton( VideoFullscreen, b ); |
514 | } | 515 | } |
515 | 516 | ||
516 | 517 | ||
517 | void VideoWidget::setPlaying( bool b) { | 518 | void VideoWidget::setPlaying( bool b) { |
518 | setToggleButton( VideoPlay, b ); | 519 | setToggleButton( VideoPlay, b ); |
519 | } | 520 | } |
520 | 521 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index fd02805..990fa5f 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -56,33 +56,32 @@ class VideoWidget : public QWidget { | |||
56 | public: | 56 | public: |
57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
58 | ~VideoWidget(); | 58 | ~VideoWidget(); |
59 | 59 | ||
60 | 60 | ||
61 | XineVideoWidget* vidWidget(); | 61 | XineVideoWidget* vidWidget(); |
62 | public slots: | 62 | public slots: |
63 | void updateSlider( long, long ); | 63 | void updateSlider( long, long ); |
64 | void sliderPressed( ); | 64 | void sliderPressed( ); |
65 | void sliderReleased( ); | 65 | void sliderReleased( ); |
66 | void setPlaying( bool b); | 66 | void setPlaying( bool b); |
67 | void setFullscreen( bool b ); | 67 | void setFullscreen( bool b ); |
68 | void makeVisible(); | 68 | void makeVisible(); |
69 | void backToNormal(); | 69 | void backToNormal(); |
70 | void setPosition( long ); | 70 | void setPosition( long ); |
71 | void setLength( long ); | 71 | void setLength( long ); |
72 | void setSeekable( bool ); | ||
73 | void setView( char ); | 72 | void setView( char ); |
74 | 73 | ||
75 | signals: | 74 | signals: |
76 | void moreClicked(); | 75 | void moreClicked(); |
77 | void lessClicked(); | 76 | void lessClicked(); |
78 | void moreReleased(); | 77 | void moreReleased(); |
79 | void lessReleased(); | 78 | void lessReleased(); |
80 | void sliderMoved( long ); | 79 | void sliderMoved( long ); |
81 | void videoResized ( const QSize &s ); | 80 | void videoResized ( const QSize &s ); |
82 | 81 | ||
83 | protected: | 82 | protected: |
84 | 83 | ||
85 | void resizeEvent( QResizeEvent * ); | 84 | void resizeEvent( QResizeEvent * ); |
86 | void paintEvent( QPaintEvent *pe ); | 85 | void paintEvent( QPaintEvent *pe ); |
87 | void showEvent( QShowEvent *se ); | 86 | void showEvent( QShowEvent *se ); |
88 | void mouseMoveEvent( QMouseEvent *event ); | 87 | void mouseMoveEvent( QMouseEvent *event ); |