summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-08-16 11:53:21 (UTC)
committer llornkcor <llornkcor>2002-08-16 11:53:21 (UTC)
commit2ce537c4275c5071a85efae8e9862b5fd9ceb6ae (patch) (unidiff)
tree6281efe02aaf1e820b70b5940ff37c8100b931d9
parent52eb803145b0a246e9d0e39c57bd327365f86459 (diff)
downloadopie-2ce537c4275c5071a85efae8e9862b5fd9ceb6ae.zip
opie-2ce537c4275c5071a85efae8e9862b5fd9ceb6ae.tar.gz
opie-2ce537c4275c5071a85efae8e9862b5fd9ceb6ae.tar.bz2
try ESCAPE as pause on ipaq builds
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp9
2 files changed, 21 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 132a911..442864f 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -264,128 +264,129 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
264 delete buttonPixUp[i]; 264 delete buttonPixUp[i];
265 delete buttonPixDown[i]; 265 delete buttonPixDown[i];
266 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 266 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
267 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 267 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
268 } 268 }
269 } 269 }
270 270
271 delete pixUp; 271 delete pixUp;
272 delete pixDn; 272 delete pixDn;
273} 273}
274 274
275static bool audioSliderBeingMoved = FALSE; 275static bool audioSliderBeingMoved = FALSE;
276 276
277 277
278void AudioWidget::sliderPressed() { 278void AudioWidget::sliderPressed() {
279 audioSliderBeingMoved = TRUE; 279 audioSliderBeingMoved = TRUE;
280} 280}
281 281
282 282
283void AudioWidget::sliderReleased() { 283void AudioWidget::sliderReleased() {
284 audioSliderBeingMoved = FALSE; 284 audioSliderBeingMoved = FALSE;
285 if ( slider.width() == 0 ) 285 if ( slider.width() == 0 )
286 return; 286 return;
287 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 287 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
288 mediaPlayerState->setPosition( val ); 288 mediaPlayerState->setPosition( val );
289} 289}
290 290
291void AudioWidget::setPosition( long i ) { 291void AudioWidget::setPosition( long i ) {
292// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 292// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
293 updateSlider( i, mediaPlayerState->length() ); 293 updateSlider( i, mediaPlayerState->length() );
294} 294}
295 295
296 296
297void AudioWidget::setLength( long max ) { 297void AudioWidget::setLength( long max ) {
298 updateSlider( mediaPlayerState->position(), max ); 298 updateSlider( mediaPlayerState->position(), max );
299} 299}
300 300
301 301
302void AudioWidget::setView( char view ) { 302void AudioWidget::setView( char view ) {
303 303
304// this isnt working for some reason 304// this isnt working for some reason
305 305
306 if ( mediaPlayerState->streaming() ) { 306 if ( mediaPlayerState->streaming() ) {
307 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 307 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
308 if( !slider.isHidden()) { 308 if( !slider.isHidden()) {
309 slider.hide(); 309 slider.hide();
310 } 310 }
311 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 311 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
312 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 312 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
313 } else { 313 } else {
314 // this stops the slider from being moved, thus 314 // this stops the slider from being moved, thus
315 // does not stop stream when it reaches the end 315 // does not stop stream when it reaches the end
316 slider.show(); 316 slider.show();
317 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 317 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
318 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 318 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
319 } 319 }
320 320
321 if ( view == 'a' ) { 321 if ( view == 'a' ) {
322 // startTimer( 150 ); 322 // startTimer( 150 );
323 showMaximized(); 323 showMaximized();
324 } else { 324 } else {
325 killTimers(); 325 killTimers();
326 hide(); 326 hide();
327 } 327 }
328 qApp->processEvents();
328} 329}
329 330
330 331
331static QString timeAsString( long length ) { 332static QString timeAsString( long length ) {
332 int minutes = length / 60; 333 int minutes = length / 60;
333 int seconds = length % 60; 334 int seconds = length % 60;
334 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 335 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
335} 336}
336 337
337void AudioWidget::updateSlider( long i, long max ) { 338void AudioWidget::updateSlider( long i, long max ) {
338 339
339 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 340 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
340// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 341// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
341 342
342 if ( max == 0 ) { 343 if ( max == 0 ) {
343 return; 344 return;
344 } 345 }
345 // Will flicker too much if we don't do this 346 // Will flicker too much if we don't do this
346 // Scale to something reasonable 347 // Scale to something reasonable
347 int width = slider.width(); 348 int width = slider.width();
348 int val = int((double)i * width / max); 349 int val = int((double)i * width / max);
349 if ( !audioSliderBeingMoved ) { 350 if ( !audioSliderBeingMoved ) {
350 if ( slider.value() != val ) { 351 if ( slider.value() != val ) {
351 slider.setValue( val ); 352 slider.setValue( val );
352 } 353 }
353 354
354 if ( slider.maxValue() != width ) { 355 if ( slider.maxValue() != width ) {
355 slider.setMaxValue( width ); 356 slider.setMaxValue( width );
356 } 357 }
357 } 358 }
358} 359}
359 360
360 361
361void AudioWidget::setToggleButton( int i, bool down ) { 362void AudioWidget::setToggleButton( int i, bool down ) {
362 qDebug("setToggleButton %d", i); 363 qDebug("setToggleButton %d", i);
363 if ( down != audioButtons[i].isDown ) { 364 if ( down != audioButtons[i].isDown ) {
364 toggleButton( i ); 365 toggleButton( i );
365 } 366 }
366} 367}
367 368
368 369
369void AudioWidget::toggleButton( int i ) { 370void AudioWidget::toggleButton( int i ) {
370 audioButtons[i].isDown = !audioButtons[i].isDown; 371 audioButtons[i].isDown = !audioButtons[i].isDown;
371 QPainter p(this); 372 QPainter p(this);
372 paintButton ( &p, i ); 373 paintButton ( &p, i );
373} 374}
374 375
375 376
376void AudioWidget::paintButton( QPainter *p, int i ) { 377void AudioWidget::paintButton( QPainter *p, int i ) {
377 if ( audioButtons[i].isDown ) { 378 if ( audioButtons[i].isDown ) {
378 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 379 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
379 } else { 380 } else {
380 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 381 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
381 } 382 }
382} 383}
383 384
384 385
385void AudioWidget::skipFor() { 386void AudioWidget::skipFor() {
386 skipDirection = +1; 387 skipDirection = +1;
387 startTimer( 50 ); 388 startTimer( 50 );
388 mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); 389 mediaPlayerState->setPosition( mediaPlayerState->position() + 2 );
389} 390}
390 391
391void AudioWidget::skipBack() { 392void AudioWidget::skipBack() {
@@ -509,69 +510,79 @@ void AudioWidget::paintEvent( QPaintEvent * pe) {
509 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 510 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
510 for ( int i = 0; i < numButtons; i++ ) 511 for ( int i = 0; i < numButtons; i++ )
511 paintButton( &p, i ); 512 paintButton( &p, i );
512 QPainter p2( this ); 513 QPainter p2( this );
513 p2.drawPixmap( pe->rect().topLeft(), pix ); 514 p2.drawPixmap( pe->rect().topLeft(), pix );
514 } else { 515 } else {
515 QPainter p( this ); 516 QPainter p( this );
516 for ( int i = 0; i < numButtons; i++ ) 517 for ( int i = 0; i < numButtons; i++ )
517 paintButton( &p, i ); 518 paintButton( &p, i );
518 } 519 }
519} 520}
520 521
521void AudioWidget::keyReleaseEvent( QKeyEvent *e) 522void AudioWidget::keyReleaseEvent( QKeyEvent *e)
522{ 523{
523 switch ( e->key() ) { 524 switch ( e->key() ) {
524////////////////////////////// Zaurus keys 525////////////////////////////// Zaurus keys
525 case Key_Home: 526 case Key_Home:
526 break; 527 break;
527 case Key_F9: //activity 528 case Key_F9: //activity
528 hide(); 529 hide();
529// qDebug("Audio F9"); 530// qDebug("Audio F9");
530 break; 531 break;
531 case Key_F10: //contacts 532 case Key_F10: //contacts
532 break; 533 break;
533 case Key_F11: //menu 534 case Key_F11: //menu
534 break; 535 break;
535 case Key_F12: //home 536 case Key_F12: //home
536 break; 537 break;
537 case Key_F13: //mail 538 case Key_F13: //mail
538 break; 539 break;
539 case Key_Space: { 540 case Key_Space: {
540 if(mediaPlayerState->playing()) { 541 if(mediaPlayerState->playing()) {
541// toggleButton(1); 542// toggleButton(1);
542 mediaPlayerState->setPlaying(FALSE); 543 mediaPlayerState->setPlaying(FALSE);
543// toggleButton(1); 544// toggleButton(1);
544 } else { 545 } else {
545// toggleButton(0); 546// toggleButton(0);
546 mediaPlayerState->setPlaying(TRUE); 547 mediaPlayerState->setPlaying(TRUE);
547// toggleButton(0); 548// toggleButton(0);
548 } 549 }
549 } 550 }
550 break; 551 break;
551 case Key_Down: 552 case Key_Down:
552// toggleButton(6); 553// toggleButton(6);
553 emit lessClicked(); 554 emit lessClicked();
554 emit lessReleased(); 555 emit lessReleased();
555// toggleButton(6); 556// toggleButton(6);
556 break; 557 break;
557 case Key_Up: 558 case Key_Up:
558// toggleButton(5); 559// toggleButton(5);
559 emit moreClicked(); 560 emit moreClicked();
560 emit moreReleased(); 561 emit moreReleased();
561// toggleButton(5); 562// toggleButton(5);
562 break; 563 break;
563 case Key_Right: 564 case Key_Right:
564// toggleButton(3); 565// toggleButton(3);
565 mediaPlayerState->setNext(); 566 mediaPlayerState->setNext();
566// toggleButton(3); 567// toggleButton(3);
567 break; 568 break;
568 case Key_Left: 569 case Key_Left:
569// toggleButton(4); 570// toggleButton(4);
570 mediaPlayerState->setPrev(); 571 mediaPlayerState->setPrev();
571// toggleButton(4); 572// toggleButton(4);
572 break; 573 break;
573 case Key_Escape: 574 case Key_Escape: {
575#if defined(QT_QWS_IPAQ)
576 if( mediaPlayerState->isPaused ) {
577 setToggleButton( i, FALSE );
578 mediaPlayerState->setPaused( FALSE );
579 } else if( !mediaPlayerState->isPaused ) {
580 setToggleButton( i, TRUE );
581 mediaPlayerState->setPaused( TRUE );
582 }
583#endif
584 }
574 break; 585 break;
575 586
576 }; 587 };
577} 588}
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 0521419..5a69bf5 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -417,83 +417,92 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
417 for ( int i = 0; i < numVButtons; i++ ) { 417 for ( int i = 0; i < numVButtons; i++ ) {
418 paintButton( &p, i ); 418 paintButton( &p, i );
419 } 419 }
420 QPainter p2( this ); 420 QPainter p2( this );
421 p2.drawPixmap( pe->rect().topLeft(), pix ); 421 p2.drawPixmap( pe->rect().topLeft(), pix );
422 } else { 422 } else {
423 QPainter p( this ); 423 QPainter p( this );
424 for ( int i = 0; i < numVButtons; i++ ) 424 for ( int i = 0; i < numVButtons; i++ )
425 paintButton( &p, i ); 425 paintButton( &p, i );
426 } 426 }
427 slider->repaint( TRUE ); 427 slider->repaint( TRUE );
428 } 428 }
429} 429}
430 430
431 431
432void VideoWidget::closeEvent( QCloseEvent* ) { 432void VideoWidget::closeEvent( QCloseEvent* ) {
433 mediaPlayerState->setList(); 433 mediaPlayerState->setList();
434} 434}
435 435
436 436
437 437
438void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 438void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
439 switch ( e->key() ) { 439 switch ( e->key() ) {
440////////////////////////////// Zaurus keys 440////////////////////////////// Zaurus keys
441 case Key_Home: 441 case Key_Home:
442 break; 442 break;
443 case Key_F9: //activity 443 case Key_F9: //activity
444 break; 444 break;
445 case Key_F10: //contacts 445 case Key_F10: //contacts
446// hide(); 446// hide();
447 break; 447 break;
448 case Key_F11: //menu 448 case Key_F11: //menu
449 break; 449 break;
450 case Key_F12: //home 450 case Key_F12: //home
451 break; 451 break;
452 case Key_F13: //mail 452 case Key_F13: //mail
453 break; 453 break;
454 case Key_Space: { 454 case Key_Space: {
455 if(mediaPlayerState->playing()) { 455 if(mediaPlayerState->playing()) {
456 mediaPlayerState->setPlaying(FALSE); 456 mediaPlayerState->setPlaying(FALSE);
457 } else { 457 } else {
458 mediaPlayerState->setPlaying(TRUE); 458 mediaPlayerState->setPlaying(TRUE);
459 } 459 }
460 } 460 }
461 break; 461 break;
462 case Key_Down: 462 case Key_Down:
463// toggleButton(6); 463// toggleButton(6);
464 emit lessClicked(); 464 emit lessClicked();
465 emit lessReleased(); 465 emit lessReleased();
466// toggleButton(6); 466// toggleButton(6);
467 break; 467 break;
468 case Key_Up: 468 case Key_Up:
469// toggleButton(5); 469// toggleButton(5);
470 emit moreClicked(); 470 emit moreClicked();
471 emit moreReleased(); 471 emit moreReleased();
472// toggleButton(5); 472// toggleButton(5);
473 break; 473 break;
474 case Key_Right: 474 case Key_Right:
475 mediaPlayerState->setNext(); 475 mediaPlayerState->setNext();
476 break; 476 break;
477 case Key_Left: 477 case Key_Left:
478 mediaPlayerState->setPrev(); 478 mediaPlayerState->setPrev();
479 break; 479 break;
480 case Key_Escape: 480 case Key_Escape:
481#if defined(QT_QWS_IPAQ)
482 if( mediaPlayerState->isPaused ) {
483 setToggleButton( i, FALSE );
484 mediaPlayerState->setPaused( FALSE );
485 } else if( !mediaPlayerState->isPaused ) {
486 setToggleButton( i, TRUE );
487 mediaPlayerState->setPaused( TRUE );
488 }
489#endif
481 break; 490 break;
482 491
483 }; 492 };
484} 493}
485 494
486XineVideoWidget* VideoWidget::vidWidget() { 495XineVideoWidget* VideoWidget::vidWidget() {
487 return videoFrame; 496 return videoFrame;
488} 497}
489 498
490 499
491void VideoWidget::setFullscreen ( bool b ) { 500void VideoWidget::setFullscreen ( bool b ) {
492 setToggleButton( VideoFullscreen, b ); 501 setToggleButton( VideoFullscreen, b );
493} 502}
494 503
495 504
496void VideoWidget::setPlaying( bool b) { 505void VideoWidget::setPlaying( bool b) {
497 setToggleButton( VideoPlay, b ); 506 setToggleButton( VideoPlay, b );
498} 507}
499 508