-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index fbcd775..f5780aa 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -289,128 +289,122 @@ void VideoWidget::setToggleButton( int i, bool down ) { void VideoWidget::toggleButton( int i ) { videoButtons[i].isDown = !videoButtons[i].isDown; QPainter p(this); paintButton ( &p, i ); } void VideoWidget::paintButton( QPainter *p, int i ) { if ( videoButtons[i].isDown ) { p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); } else { p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); } } void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { for ( int i = 0; i < numVButtons; i++ ) { if ( event->state() == QMouseEvent::LeftButton ) { // The test to see if the mouse click is inside the button or not int x = event->pos().x() - xoff; int y = event->pos().y() - yoff; bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); if ( isOnButton && !videoButtons[i].isHeld ) { videoButtons[i].isHeld = TRUE; toggleButton(i); switch (i) { case VideoVolUp: - qDebug("more clicked"); emit moreClicked(); return; case VideoVolDown: - qDebug("less clicked"); emit lessClicked(); return; } } else if ( !isOnButton && videoButtons[i].isHeld ) { videoButtons[i].isHeld = FALSE; toggleButton(i); } } else { if ( videoButtons[i].isHeld ) { videoButtons[i].isHeld = FALSE; if ( !videoButtons[i].isToggle ) { setToggleButton( i, FALSE ); - qDebug("button toggled3 %d",i); } switch(i) { case VideoPlay: { if( mediaPlayerState->isPaused ) { - qDebug("play again clicked"); setToggleButton( i, FALSE ); mediaPlayerState->setPaused( FALSE ); return; } else if( !mediaPlayerState->isPaused ) { - qDebug("pause now clicked"); setToggleButton( i, TRUE ); mediaPlayerState->setPaused( TRUE ); return; } else { // setToggleButton( i, TRUE ); // mediaPlayerState->setPlaying( videoButtons[i].isDown ); } } case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; case VideoNext: mediaPlayerState->setNext(); return; case VideoPrevious: mediaPlayerState->setPrev(); return; case VideoVolUp: emit moreReleased(); return; case VideoVolDown: emit lessReleased(); return; case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; } } } } } void VideoWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { if ( mediaPlayerState->fullscreen() ) { mediaPlayerState->setFullscreen( FALSE ); makeVisible(); - - mouseMoveEvent( event ); } + mouseMoveEvent( event ); } void VideoWidget::showEvent( QShowEvent* ) { QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); mouseMoveEvent( &event ); } void VideoWidget::makeVisible() { if ( mediaPlayerState->fullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); resize( qApp->desktop()->size() ); slider->hide(); videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); } else { showNormal(); showMaximized(); slider->show(); videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); qApp->processEvents(); } } void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( this ); if ( mediaPlayerState->fullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); |