summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp107
1 files changed, 0 insertions, 107 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 6ed0108..48104ca 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -249,308 +249,201 @@ void VideoWidget::sliderReleased() {
void VideoWidget::setPosition( long i ) {
updateSlider( i, mediaPlayerState->length() );
}
void VideoWidget::setLength( long max ) {
updateSlider( mediaPlayerState->position(), max );
}
void VideoWidget::setView( char view ) {
if ( view == 'v' )
{
makeVisible();
}
else
{
// Effectively blank the view next time we show it so it looks nicer
scaledWidth = 0;
scaledHeight = 0;
hide();
}
}
void VideoWidget::updateSlider( long i, long max ) {
// Will flicker too much if we don't do this
if ( max == 0 )
return;
int width = slider->width();
int val = int((double)i * width / max);
if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved )
{
if ( slider->value() != val )
slider->setValue( val );
if ( slider->maxValue() != width )
slider->setMaxValue( width );
}
}
void VideoWidget::setToggleButton( int i, bool down ) {
if ( down != videoButtons[i].isDown )
toggleButton( i );
}
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] );
}
-// int x = videoButtons[i].xPos;
-// int y = videoButtons[i].yPos;
-// int offset = 10 + videoButtons[i].isDown;
-// p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] );
-// p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 );
}
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:
emit moreClicked();
return;
case VideoVolDown:
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 );
}
switch(i) {
case VideoPlay: {
qDebug("play");
if( !mediaPlayerState->playing()) {
mediaPlayerState->setPlaying( true);
setToggleButton( i-1, false );
setToggleButton( i, false );
return;
}
if( mediaPlayerState->isPaused ) {
qDebug("isPaused");
setToggleButton( i, FALSE );
mediaPlayerState->setPaused( FALSE );
return;
} else if( !mediaPlayerState->isPaused ) {
qDebug("is not paused");
setToggleButton( i, TRUE );
mediaPlayerState->setPaused( TRUE );
return;
} else {
return;
}
}
case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); 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;
}
}
}
}
-
-// 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 )
-// {
-// qDebug("key %d", i);
-
-// videoButtons[i].isHeld = TRUE;
-// toggleButton(i);
-// switch (i) {
-// case VideoVolUp:
-// emit moreClicked();
-// return;
-// case VideoVolDown:
-// 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("key %d", i);
-// switch(i) {
-// case VideoPlay:
-// {
-// if( mediaPlayerState->isPaused ) {
-// setToggleButton( i, FALSE );
-// mediaPlayerState->setPaused( FALSE );
-// return;
-// }
-// else if( !mediaPlayerState->isPaused ) {
-// setToggleButton( i, TRUE );
-// mediaPlayerState->setPaused( TRUE );
-// return;
-// } else {
-// return;
-// }
-// }
-
-// case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
-// // case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); 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 VideoPlayList: mediaPlayerState->setList(); return;
-// case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
-// }
-// }
-// }
-// }
-
-
-
-
-
-// for ( int i = 0; i < numButtons; i++ ) {
-// int x = videoButtons[i].xPos;
-// int y = videoButtons[i].yPos;
-// if ( event->state() == QMouseEvent::LeftButton ) {
-// // The test to see if the mouse click is inside the circular button or not
-// // (compared with the radius squared to avoid a square-root of our distance)
-// int radius = 16;
-// QPoint center = QPoint( x + radius, y + radius );
-// QPoint dXY = center - event->pos();
-// int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
-// bool isOnButton = dist <= (radius * radius);
-// if ( isOnButton != videoButtons[i].isHeld ) {
-// videoButtons[i].isHeld = isOnButton;
-// toggleButton(i);
-// }
-// } else {
-// if ( videoButtons[i].isHeld ) {
-// videoButtons[i].isHeld = FALSE;
-// if ( !videoButtons[i].isToggle )
-// setToggleButton( i, FALSE );
-// }
-// }
-
-
-// }
}
void VideoWidget::mousePressEvent( QMouseEvent *event ) {
mouseMoveEvent( event );
}
void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
if ( mediaPlayerState->fullscreen() )
{
mediaPlayerState->setFullscreen( FALSE );
makeVisible();
}
mouseMoveEvent( event );
// }
}
void VideoWidget::makeVisible() {
if ( mediaPlayerState->fullscreen() )
{
setBackgroundMode( QWidget::NoBackground );
showFullScreen();
resize( qApp->desktop()->size() );
slider->hide();
}
else
{
setBackgroundPixmap( *pixBg );
showNormal();
showMaximized();
slider->show();
}
}
void VideoWidget::paintEvent( QPaintEvent * pe) {
QPainter p( this );
if ( mediaPlayerState->fullscreen() ) {
// Clear the background
p.setBrush( QBrush( Qt::black ) );
p.drawRect( rect() );
} 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() );
p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
for ( int i = 0; i < numVButtons; i++ ) {
paintButton( &p, i );
}
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
for ( int i = 0; i < numVButtons; i++ )
paintButton( &p, i );
}
slider->repaint( TRUE );
}
}