-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 @@ -132,25 +132,24 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); //slider->setFocusPolicy( QWidget::NoFocus ); resizeEvent( NULL ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); - connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); setLength( mediaPlayerState->length() ); setPosition( mediaPlayerState->position() ); setFullscreen( mediaPlayerState->fullscreen() ); setPlaying( mediaPlayerState->playing() ); } VideoWidget::~VideoWidget() { for ( int i = 0; i < 7; i++ ) { delete buttonPixUp[i]; @@ -372,65 +371,68 @@ void VideoWidget::showEvent( QShowEvent* ) { void VideoWidget::backToNormal() { mediaPlayerState->setFullscreen( FALSE ); makeVisible(); } void VideoWidget::makeVisible() { if ( mediaPlayerState->fullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); resize( qApp->desktop()->size() ); - slider->hide(); videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); + + slider->hide(); + disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); + disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); + } else { showNormal(); showMaximized(); setBackgroundPixmap( *pixBg ); QWidget *d = QApplication::desktop(); int w = d->width(); int h = d->height(); if(w>h) { int newW=(w/2)-(246/2); //this will only work with 320x240 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); } else { videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); } - } -} - -void VideoWidget::setSeekable( bool isSeekable ) { - - if ( !isSeekable || mediaPlayerState->fullscreen() ) { - qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); - if( !slider->isHidden()) { - slider->hide(); + if ( !mediaPlayerState->seekable() ) { + if( !slider->isHidden()) { + slider->hide(); + } + disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); + disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); + } else { + slider->show(); + connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); + connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } - disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); - disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); - disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); - disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); - } else { - slider->show(); - connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); - connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); - connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); - connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } } + + void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( this ); if ( mediaPlayerState->fullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); } else { if ( !pe->erased() ) { // Combine with background and double buffer QPixmap pix( pe->rect().size() ); QPainter p( &pix ); p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); @@ -446,25 +448,24 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { paintButton( &p, i ); } //slider->repaint( TRUE ); } } void VideoWidget::closeEvent( QCloseEvent* ) { mediaPlayerState->setList(); } - void VideoWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts // hide(); break; case Key_F11: //menu break; @@ -501,20 +502,20 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { case Key_Escape: break; }; } XineVideoWidget* VideoWidget::vidWidget() { return videoFrame; } void VideoWidget::setFullscreen ( bool b ) { - setToggleButton( VideoFullscreen, b ); + setToggleButton( VideoFullscreen, b ); } void VideoWidget::setPlaying( bool b) { - setToggleButton( VideoPlay, b ); + setToggleButton( VideoPlay, b ); } 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 @@ -60,25 +60,24 @@ public: XineVideoWidget* vidWidget(); public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); void setPlaying( bool b); void setFullscreen( bool b ); void makeVisible(); void backToNormal(); void setPosition( long ); void setLength( long ); - void setSeekable( bool ); void setView( char ); signals: void moreClicked(); void lessClicked(); void moreReleased(); void lessReleased(); void sliderMoved( long ); void videoResized ( const QSize &s ); protected: |