Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index e0ca243..b4ecb4c 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -54,5 +54,4 @@ -extern MediaPlayerState *mediaPlayerState; extern PlayListWidget *playList; @@ -83,6 +82,6 @@ static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); -VideoWidget::VideoWidget(QWidget* parent, const char* name) : -MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { +VideoWidget::VideoWidget(MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : +MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { @@ -138,8 +137,8 @@ MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { resizeEvent( NULL ); - setLength( mediaPlayerState->length() ); - setPosition( mediaPlayerState->position() ); - setFullscreen( mediaPlayerState->isFullscreen() ); - setPlaying( mediaPlayerState->isPlaying() ); + setLength( mediaPlayerState.length() ); + setPosition( mediaPlayerState.position() ); + setFullscreen( mediaPlayerState.isFullscreen() ); + setPlaying( mediaPlayerState.isPlaying() ); } @@ -222,15 +221,15 @@ void VideoWidget::sliderReleased() { return; } - long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); - mediaPlayerState->setPosition( val ); + long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); + mediaPlayerState.setPosition( val ); } void VideoWidget::setPosition( long i ) { - updateSlider( i, mediaPlayerState->length() ); + updateSlider( i, mediaPlayerState.length() ); } void VideoWidget::setLength( long max ) { - updateSlider( mediaPlayerState->position(), max ); + updateSlider( mediaPlayerState.position(), max ); } @@ -255,5 +254,5 @@ void VideoWidget::updateSlider( long i, long max ) { int width = slider->width(); int val = int((double)i * width / max); - if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) { + if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { if ( slider->value() != val ) { slider->setValue( val ); @@ -324,11 +323,11 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { case VideoPlay: { - if( mediaPlayerState->isPaused() ) { + if( mediaPlayerState.isPaused() ) { setToggleButton( i, FALSE ); - mediaPlayerState->setPaused( FALSE ); + mediaPlayerState.setPaused( FALSE ); return; - } else if( !mediaPlayerState->isPaused() ) { + } else if( !mediaPlayerState.isPaused() ) { setToggleButton( i, TRUE ); - mediaPlayerState->setPaused( TRUE ); + mediaPlayerState.setPaused( TRUE ); return; } else { @@ -337,10 +336,10 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { } - case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; - case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return; - case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return; + case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; + case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; + case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; case VideoVolUp: emit moreReleased(); return; case VideoVolDown: emit lessReleased(); return; - case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; + case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; } } @@ -354,6 +353,6 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) { void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { - if ( mediaPlayerState->isFullscreen() ) { - mediaPlayerState->setFullscreen( FALSE ); + if ( mediaPlayerState.isFullscreen() ) { + mediaPlayerState.setFullscreen( FALSE ); makeVisible(); } @@ -368,10 +367,10 @@ void VideoWidget::showEvent( QShowEvent* ) { void VideoWidget::backToNormal() { - mediaPlayerState->setFullscreen( FALSE ); + mediaPlayerState.setFullscreen( FALSE ); makeVisible(); } void VideoWidget::makeVisible() { - if ( mediaPlayerState->isFullscreen() ) { + if ( mediaPlayerState.isFullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); @@ -380,6 +379,6 @@ void VideoWidget::makeVisible() { slider->hide(); - disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); - disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + 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() ) ); @@ -400,16 +399,16 @@ void VideoWidget::makeVisible() { } - if ( !mediaPlayerState->isSeekable() ) { + if ( !mediaPlayerState.isSeekable() ) { if( !slider->isHidden()) { slider->hide(); } - disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); - disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + 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( &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() ) ); @@ -424,5 +423,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( this ); - if ( mediaPlayerState->isFullscreen() ) { + if ( mediaPlayerState.isFullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); @@ -450,5 +449,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { void VideoWidget::closeEvent( QCloseEvent* ) { - mediaPlayerState->setList(); + mediaPlayerState.setList(); } @@ -471,8 +470,8 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { break; case Key_Space: { - if(mediaPlayerState->isPlaying()) { - mediaPlayerState->setPlaying(FALSE); + if(mediaPlayerState.isPlaying()) { + mediaPlayerState.setPlaying(FALSE); } else { - mediaPlayerState->setPlaying(TRUE); + mediaPlayerState.setPlaying(TRUE); } } @@ -491,8 +490,8 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { break; case Key_Right: - mediaPlayerState->setNext(); + mediaPlayerState.setNext(); break; case Key_Left: - mediaPlayerState->setPrev(); + mediaPlayerState.setPrev(); break; case Key_Escape: |