author | llornkcor <llornkcor> | 2002-09-19 19:45:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-19 19:45:49 (UTC) |
commit | 2e0cb5c85f913141985df4e7f2514817851420fb (patch) (side-by-side diff) | |
tree | e58f576310994d1bb813143cb96b312af37b78fb | |
parent | aef34909dcfb2ffb637c9d3693e395c15b255cb2 (diff) | |
download | opie-2e0cb5c85f913141985df4e7f2514817851420fb.zip opie-2e0cb5c85f913141985df4e7f2514817851420fb.tar.gz opie-2e0cb5c85f913141985df4e7f2514817851420fb.tar.bz2 |
tweak for landscape mode
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 8e3a365..b0ec673 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -168,55 +168,58 @@ VideoWidget::~VideoWidget() { } QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { QPixmap pix( img.width(), img.height() ); QPainter p( &pix ); p.drawTiledPixmap( pix.rect(), bg, offset ); p.drawImage( 0, 0, img ); return new QPixmap( pix ); } QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { QPixmap *pixmap = new QPixmap( pix ); pixmap->setMask( mask ); return pixmap; } void VideoWidget::resizeEvent( QResizeEvent * ) { int h = height(); int w = width(); //int Vh = 160; //int Vw = 220; slider->setFixedWidth( w - 20 ); - slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); + slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider->setBackgroundOrigin( QWidget::ParentOrigin ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setBackgroundPixmap( *pixBg ); xoff = 0;// ( imgUp->width() ) / 2; - yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; + if(w>h) + yoff = 0; + else + yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; QPoint p( xoff, yoff ); QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); for ( int i = 0; i < 7; i++ ) { if ( !masks[i]->isNull() ) { delete buttonPixUp[i]; delete buttonPixDown[i]; buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); } } delete pixUp; delete pixDn; } static bool videoSliderBeingMoved = FALSE; void VideoWidget::sliderPressed() { videoSliderBeingMoved = TRUE; } @@ -374,49 +377,59 @@ void VideoWidget::showEvent( QShowEvent* ) { makeVisible(); } void VideoWidget::makeVisible() { if ( mediaPlayerState->fullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); resize( qApp->desktop()->size() ); slider->hide(); videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); qApp->processEvents(); } else { showNormal(); showMaximized(); setBackgroundPixmap( *pixBg ); if ( mediaPlayerState->streaming() ) { slider->hide(); disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } else { slider->show(); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } - videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); + + 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 ) ); + qApp->processEvents(); } } 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() ); 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 { |