author | llornkcor <llornkcor> | 2002-09-19 19:45:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-19 19:45:49 (UTC) |
commit | 2e0cb5c85f913141985df4e7f2514817851420fb (patch) (unidiff) | |
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 | |||
@@ -180,31 +180,34 @@ QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | |||
180 | QPixmap *pixmap = new QPixmap( pix ); | 180 | QPixmap *pixmap = new QPixmap( pix ); |
181 | pixmap->setMask( mask ); | 181 | pixmap->setMask( mask ); |
182 | return pixmap; | 182 | return pixmap; |
183 | } | 183 | } |
184 | 184 | ||
185 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 185 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
186 | int h = height(); | 186 | int h = height(); |
187 | int w = width(); | 187 | int w = width(); |
188 | //int Vh = 160; | 188 | //int Vh = 160; |
189 | //int Vw = 220; | 189 | //int Vw = 220; |
190 | 190 | ||
191 | slider->setFixedWidth( w - 20 ); | 191 | slider->setFixedWidth( w - 20 ); |
192 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 192 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
193 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 193 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
194 | slider->setFocusPolicy( QWidget::NoFocus ); | 194 | slider->setFocusPolicy( QWidget::NoFocus ); |
195 | slider->setBackgroundPixmap( *pixBg ); | 195 | slider->setBackgroundPixmap( *pixBg ); |
196 | 196 | ||
197 | xoff = 0;// ( imgUp->width() ) / 2; | 197 | xoff = 0;// ( imgUp->width() ) / 2; |
198 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 198 | if(w>h) |
199 | yoff = 0; | ||
200 | else | ||
201 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; | ||
199 | QPoint p( xoff, yoff ); | 202 | QPoint p( xoff, yoff ); |
200 | 203 | ||
201 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 204 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
202 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 205 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
203 | 206 | ||
204 | for ( int i = 0; i < 7; i++ ) { | 207 | for ( int i = 0; i < 7; i++ ) { |
205 | if ( !masks[i]->isNull() ) { | 208 | if ( !masks[i]->isNull() ) { |
206 | delete buttonPixUp[i]; | 209 | delete buttonPixUp[i]; |
207 | delete buttonPixDown[i]; | 210 | delete buttonPixDown[i]; |
208 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
209 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
210 | } | 213 | } |
@@ -386,25 +389,35 @@ void VideoWidget::makeVisible() { | |||
386 | showNormal(); | 389 | showNormal(); |
387 | showMaximized(); | 390 | showMaximized(); |
388 | setBackgroundPixmap( *pixBg ); | 391 | setBackgroundPixmap( *pixBg ); |
389 | if ( mediaPlayerState->streaming() ) { | 392 | if ( mediaPlayerState->streaming() ) { |
390 | slider->hide(); | 393 | slider->hide(); |
391 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 394 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
392 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 395 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
393 | } else { | 396 | } else { |
394 | slider->show(); | 397 | slider->show(); |
395 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 398 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
396 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 399 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
397 | } | 400 | } |
398 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 401 | |
402 | QWidget *d = QApplication::desktop(); | ||
403 | int w=d->width(); | ||
404 | int h=d->height(); | ||
405 | |||
406 | if(w>h) { | ||
407 | int newW=(w/2)-(246/2); //this will only work with 320x240 | ||
408 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | ||
409 | } else | ||
410 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | ||
411 | |||
399 | qApp->processEvents(); | 412 | qApp->processEvents(); |
400 | } | 413 | } |
401 | } | 414 | } |
402 | 415 | ||
403 | 416 | ||
404 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 417 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
405 | QPainter p( this ); | 418 | QPainter p( this ); |
406 | 419 | ||
407 | if ( mediaPlayerState->fullscreen() ) { | 420 | if ( mediaPlayerState->fullscreen() ) { |
408 | // Clear the background | 421 | // Clear the background |
409 | p.setBrush( QBrush( Qt::black ) ); | 422 | p.setBrush( QBrush( Qt::black ) ); |
410 | } else { | 423 | } else { |