author | harlekin <harlekin> | 2002-08-15 16:29:52 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-15 16:29:52 (UTC) |
commit | 320f73ae9a8ffc6daf009b3fefb9035506b0f684 (patch) (side-by-side diff) | |
tree | 52b4e54d1c73cdff58411a1da2485effb2aaa6bb /noncore/multimedia/opieplayer2/videowidget.cpp | |
parent | 32ce744f58463ff11afb26ef5c4c8cf3f3d03fd3 (diff) | |
download | opie-320f73ae9a8ffc6daf009b3fefb9035506b0f684.zip opie-320f73ae9a8ffc6daf009b3fefb9035506b0f684.tar.gz opie-320f73ae9a8ffc6daf009b3fefb9035506b0f684.tar.bz2 |
more simular to audiowidget
Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 190 |
1 files changed, 92 insertions, 98 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index fb375f0..fbcd775 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -115,3 +115,2 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { } - } @@ -130,3 +129,4 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { slider->setFocusPolicy( QWidget::NoFocus ); - slider->setGeometry( QRect( 7, 250, 220, 20 ) ); + + resizeEvent( NULL ); @@ -134,8 +134,4 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); - connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); - connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); - connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); - connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); @@ -145,4 +141,2 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { setPosition( mediaPlayerState->position() ); - - ////////////////////////// FIXME setFullscreen( mediaPlayerState->fullscreen() ); @@ -150,3 +144,2 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { setPlaying( mediaPlayerState->playing() ); - qDebug("finished videowidget"); } @@ -155,3 +148,3 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { VideoWidget::~VideoWidget() { - mediaPlayerState->setPlaying( FALSE ); + for ( int i = 0; i < 7; i++ ) { @@ -168,3 +161,3 @@ VideoWidget::~VideoWidget() { } - + } @@ -192,5 +185,5 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { //videoFrame->width(); -// songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); - slider->setFixedWidth( w - 110 ); + + slider->setFixedWidth( w - 20 ); slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); @@ -200,3 +193,2 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { -// time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); xoff = 0;// ( imgUp->width() ) / 2; @@ -247,2 +239,18 @@ void VideoWidget::setLength( long max ) { void VideoWidget::setView( char view ) { + + if ( mediaPlayerState->streaming() ) { + qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); + if( !slider->isHidden()) { + slider->hide(); + } + disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + } else { + // this stops the slider from being moved, thus + // does not stop stream when it reaches the end + slider->show(); + connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + } + if ( view == 'v' ) { @@ -288,6 +296,7 @@ void VideoWidget::paintButton( QPainter *p, int i ) { - if ( videoButtons[i].isDown ) + if ( videoButtons[i].isDown ) { p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); - else + } else { p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); + } } @@ -297,3 +306,3 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { - // The test to see if the mouse click is inside the button or not + // The test to see if the mouse click is inside the button or not int x = event->pos().x() - xoff; @@ -302,44 +311,25 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 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 = isOnButton; + && y < imgButtonMask->height() + && imgButtonMask->pixelIndex( x, y ) == i + 1 ); + + if ( isOnButton && !videoButtons[i].isHeld ) { + videoButtons[i].isHeld = TRUE; toggleButton(i); - } - -// qDebug("mouseMove event switch1 %d", i); - if( isOnButton) + switch (i) { - case VideoStop:{ - setToggleButton( i, FALSE ); - mediaPlayerState->setStop(TRUE); - mediaPlayerState->setPlaying(FALSE); - return; - } - case VideoPlay: { - - if( mediaPlayerState->isPaused) { - setToggleButton( i, FALSE ); - mediaPlayerState->setPaused( FALSE); - return; - } - else if( mediaPlayerState->isPlaying) { - setToggleButton( i, TRUE ); - mediaPlayerState->setPaused( TRUE); - return; - } - else { - setToggleButton( i, FALSE ); - mediaPlayerState->setPlaying( videoButtons[i].isDown ); - return; - } - } - case VideoNext: qDebug("next"); mediaPlayerState->setNext(); return; - case VideoPrevious: qDebug("previous"); mediaPlayerState->setPrev(); return; - case VideoVolUp: return; - case VideoVolDown: return; - case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; - - }; - + 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 ) { @@ -348,20 +338,31 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { setToggleButton( i, FALSE ); + qDebug("button toggled3 %d",i); } -// qDebug("mouseMove event switch2 %d %d", i, VideoPlay); - switch (i) { - case VideoPlay: { - if( mediaPlayerState->isPaused) { - mediaPlayerState->setPaused( FALSE); return; } - else if( mediaPlayerState->isPlaying) { - mediaPlayerState->setPaused( TRUE); return; } - else - mediaPlayerState->setPlaying( TRUE /*videoButtons[i].isDown*/ ); return; - } - case VideoStop: mediaPlayerState->setPlaying(FALSE); return; + + 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: return; - case VideoVolDown: return; - case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); 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; } @@ -385,2 +386,7 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { +void VideoWidget::showEvent( QShowEvent* ) { + QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); + mouseMoveEvent( &event ); +} + @@ -392,5 +398,5 @@ void VideoWidget::makeVisible() { slider->hide(); - videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); + videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); } else { - showNormal(); + showNormal(); showMaximized(); @@ -407,5 +413,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { if ( mediaPlayerState->fullscreen() ) { - // Clear the background + // Clear the background p.setBrush( QBrush( Qt::black ) ); -// videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); + // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); @@ -413,7 +419,7 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { - // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); - // draw the buttons + // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); + // draw the buttons if ( !pe->erased() ) { - // Combine with background and double buffer + // Combine with background and double buffer QPixmap pix( pe->rect().size() ); @@ -422,4 +428,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); - for ( int i = 0; i < numVButtons; i++ ) + for ( int i = 0; i < numVButtons; i++ ) { paintButton( &p, i ); + } QPainter p2( this ); @@ -431,7 +438,7 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { } -// for ( int i = 0; i < numButtons; i++ ) { -// paintButton( &p, i ); -// } - // draw the slider - slider->repaint( TRUE ); + // for ( int i = 0; i < numButtons; i++ ) { + // paintButton( &p, i ); + // } + // draw the slider + slider->repaint( TRUE ); } @@ -445,15 +452,2 @@ void VideoWidget::closeEvent( QCloseEvent* ) { -bool VideoWidget::playVideo() { - bool result = FALSE; - - int stream = 0; - - int sw = 240; - int sh = 320; - int dd = QPixmap::defaultDepth(); - int w = height(); - int h = width(); - - return true; -} |