summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-16 15:42:44 (UTC)
committer harlekin <harlekin>2002-08-16 15:42:44 (UTC)
commitfec49e4f9f8d016e335eaca1630f4108801cc3ce (patch) (unidiff)
tree271c4dda3b4b634e0946528e4a4b2c9e6746d25c
parentaa9eba407a8236c72822d24643b58d4d48ae80c0 (diff)
downloadopie-fec49e4f9f8d016e335eaca1630f4108801cc3ce.zip
opie-fec49e4f9f8d016e335eaca1630f4108801cc3ce.tar.gz
opie-fec49e4f9f8d016e335eaca1630f4108801cc3ce.tar.bz2
hide slider when streaming videos
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 5a69bf5..956789f 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -213,63 +213,48 @@ static bool videoSliderBeingMoved = FALSE;
213void VideoWidget::sliderPressed() { 213void VideoWidget::sliderPressed() {
214 videoSliderBeingMoved = TRUE; 214 videoSliderBeingMoved = TRUE;
215} 215}
216 216
217void VideoWidget::sliderReleased() { 217void VideoWidget::sliderReleased() {
218 videoSliderBeingMoved = FALSE; 218 videoSliderBeingMoved = FALSE;
219 if ( slider->width() == 0 ) { 219 if ( slider->width() == 0 ) {
220 return; 220 return;
221 } 221 }
222 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 222 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
223 mediaPlayerState->setPosition( val ); 223 mediaPlayerState->setPosition( val );
224} 224}
225 225
226void VideoWidget::setPosition( long i ) { 226void VideoWidget::setPosition( long i ) {
227 updateSlider( i, mediaPlayerState->length() ); 227 updateSlider( i, mediaPlayerState->length() );
228} 228}
229 229
230 230
231void VideoWidget::setLength( long max ) { 231void VideoWidget::setLength( long max ) {
232 updateSlider( mediaPlayerState->position(), max ); 232 updateSlider( mediaPlayerState->position(), max );
233} 233}
234 234
235void VideoWidget::setView( char view ) { 235void VideoWidget::setView( char view ) {
236 236
237 if ( mediaPlayerState->streaming() ) {
238 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
239 if( !slider->isHidden()) {
240 slider->hide();
241 }
242 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
243 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
244 } else {
245 // this stops the slider from being moved, thus
246 // does not stop stream when it reaches the end
247 slider->show();
248 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
249 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
250 }
251
252 if ( view == 'v' ) { 237 if ( view == 'v' ) {
253 makeVisible(); 238 makeVisible();
254 } else { 239 } else {
255 // Effectively blank the view next time we show it so it looks nicer 240 // Effectively blank the view next time we show it so it looks nicer
256 scaledWidth = 0; 241 scaledWidth = 0;
257 scaledHeight = 0; 242 scaledHeight = 0;
258 hide(); 243 hide();
259 } 244 }
260} 245}
261 246
262void VideoWidget::updateSlider( long i, long max ) { 247void VideoWidget::updateSlider( long i, long max ) {
263 // Will flicker too much if we don't do this 248 // Will flicker too much if we don't do this
264 if ( max == 0 ) { 249 if ( max == 0 ) {
265 return; 250 return;
266 } 251 }
267 int width = slider->width(); 252 int width = slider->width();
268 int val = int((double)i * width / max); 253 int val = int((double)i * width / max);
269 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { 254 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) {
270 if ( slider->value() != val ) { 255 if ( slider->value() != val ) {
271 slider->setValue( val ); 256 slider->setValue( val );
272 } 257 }
273 if ( slider->maxValue() != width ) { 258 if ( slider->maxValue() != width ) {
274 slider->setMaxValue( width ); 259 slider->setMaxValue( width );
275 } 260 }
@@ -373,49 +358,53 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
373} 358}
374 359
375void VideoWidget::showEvent( QShowEvent* ) { 360void VideoWidget::showEvent( QShowEvent* ) {
376 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 361 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
377 mouseMoveEvent( &event ); 362 mouseMoveEvent( &event );
378} 363}
379 364
380 365
381 void VideoWidget::backToNormal() { 366 void VideoWidget::backToNormal() {
382 mediaPlayerState->setFullscreen( FALSE ); 367 mediaPlayerState->setFullscreen( FALSE );
383 makeVisible(); 368 makeVisible();
384 } 369 }
385 370
386void VideoWidget::makeVisible() { 371void VideoWidget::makeVisible() {
387 if ( mediaPlayerState->fullscreen() ) { 372 if ( mediaPlayerState->fullscreen() ) {
388 setBackgroundMode( QWidget::NoBackground ); 373 setBackgroundMode( QWidget::NoBackground );
389 showFullScreen(); 374 showFullScreen();
390 resize( qApp->desktop()->size() ); 375 resize( qApp->desktop()->size() );
391 slider->hide(); 376 slider->hide();
392 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 377 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
393 378
394 } else { 379 } else {
395 showMaximized(); 380 showMaximized();
396 setBackgroundPixmap( *pixBg ); 381 setBackgroundPixmap( *pixBg );
397 slider->show(); 382 if ( mediaPlayerState->streaming() ) {
383 slider->hide();
384 } else {
385 slider->show();
386 }
398 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 387 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
399 qApp->processEvents(); 388 qApp->processEvents();
400 } 389 }
401} 390}
402 391
403 392
404void VideoWidget::paintEvent( QPaintEvent * pe) { 393void VideoWidget::paintEvent( QPaintEvent * pe) {
405 QPainter p( this ); 394 QPainter p( this );
406 395
407 if ( mediaPlayerState->fullscreen() ) { 396 if ( mediaPlayerState->fullscreen() ) {
408 // Clear the background 397 // Clear the background
409 p.setBrush( QBrush( Qt::black ) ); 398 p.setBrush( QBrush( Qt::black ) );
410 } else { 399 } else {
411 if ( !pe->erased() ) { 400 if ( !pe->erased() ) {
412 // Combine with background and double buffer 401 // Combine with background and double buffer
413 QPixmap pix( pe->rect().size() ); 402 QPixmap pix( pe->rect().size() );
414 QPainter p( &pix ); 403 QPainter p( &pix );
415 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 404 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
416 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 405 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
417 for ( int i = 0; i < numVButtons; i++ ) { 406 for ( int i = 0; i < numVButtons; i++ ) {
418 paintButton( &p, i ); 407 paintButton( &p, i );
419 } 408 }
420 QPainter p2( this ); 409 QPainter p2( this );
421 p2.drawPixmap( pe->rect().topLeft(), pix ); 410 p2.drawPixmap( pe->rect().topLeft(), pix );
@@ -464,45 +453,45 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
464 emit lessClicked(); 453 emit lessClicked();
465 emit lessReleased(); 454 emit lessReleased();
466// toggleButton(6); 455// toggleButton(6);
467 break; 456 break;
468 case Key_Up: 457 case Key_Up:
469// toggleButton(5); 458// toggleButton(5);
470 emit moreClicked(); 459 emit moreClicked();
471 emit moreReleased(); 460 emit moreReleased();
472// toggleButton(5); 461// toggleButton(5);
473 break; 462 break;
474 case Key_Right: 463 case Key_Right:
475 mediaPlayerState->setNext(); 464 mediaPlayerState->setNext();
476 break; 465 break;
477 case Key_Left: 466 case Key_Left:
478 mediaPlayerState->setPrev(); 467 mediaPlayerState->setPrev();
479 break; 468 break;
480 case Key_Escape: 469 case Key_Escape:
481#if defined(QT_QWS_IPAQ) 470#if defined(QT_QWS_IPAQ)
482 if( mediaPlayerState->isPaused ) { 471 if( mediaPlayerState->isPaused ) {
483 setToggleButton( i, FALSE ); 472 setToggleButton( i, FALSE );
484 mediaPlayerState->setPaused( FALSE ); 473 mediaPlayerState->setPaused( FALSE );
485 } else if( !mediaPlayerState->isPaused ) { 474 } else if( !mediaPlayerState->isPaused ) {
486 setToggleButton( i, TRUE ); 475 setToggleButton( i, TRUE );
487 mediaPlayerState->setPaused( TRUE ); 476 mediaPlayerState->setPaused( TRUE );
488 } 477 }
489#endif 478#endif
490 break; 479 break;
491 480
492 }; 481 };
493} 482}
494 483
495XineVideoWidget* VideoWidget::vidWidget() { 484XineVideoWidget* VideoWidget::vidWidget() {
496 return videoFrame; 485 return videoFrame;
497} 486}
498 487
499 488
500void VideoWidget::setFullscreen ( bool b ) { 489void VideoWidget::setFullscreen ( bool b ) {
501 setToggleButton( VideoFullscreen, b ); 490 setToggleButton( VideoFullscreen, b );
502} 491}
503 492
504 493
505void VideoWidget::setPlaying( bool b) { 494void VideoWidget::setPlaying( bool b) {
506 setToggleButton( VideoPlay, b ); 495 setToggleButton( VideoPlay, b );
507} 496}
508 497