summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-29 23:45:41 (UTC)
committer llornkcor <llornkcor>2002-07-29 23:45:41 (UTC)
commit0adb56cb2cd83e9933baa9776c77c4c637f93d04 (patch) (unidiff)
tree13cba758a845d0a7ec079924c8fd71fb1fa416dc
parent121002ebe4cdebd99fcba5ec833c1c7b05bb8892 (diff)
downloadopie-0adb56cb2cd83e9933baa9776c77c4c637f93d04.zip
opie-0adb56cb2cd83e9933baa9776c77c4c637f93d04.tar.gz
opie-0adb56cb2cd83e9933baa9776c77c4c637f93d04.tar.bz2
paintevent
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 1fae689..689366e 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -320,171 +320,171 @@ void AudioWidget::setToggleButton( int i, bool down ) {
320 320
321 321
322void AudioWidget::toggleButton( int i ) { 322void AudioWidget::toggleButton( int i ) {
323 audioButtons[i].isDown = !audioButtons[i].isDown; 323 audioButtons[i].isDown = !audioButtons[i].isDown;
324 QPainter p(this); 324 QPainter p(this);
325 paintButton ( &p, i ); 325 paintButton ( &p, i );
326} 326}
327 327
328 328
329void AudioWidget::paintButton( QPainter *p, int i ) { 329void AudioWidget::paintButton( QPainter *p, int i ) {
330 if ( audioButtons[i].isDown ) 330 if ( audioButtons[i].isDown )
331 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 331 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
332 else 332 else
333 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 333 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
334} 334}
335 335
336 336
337void AudioWidget::timerEvent( QTimerEvent * ) { 337void AudioWidget::timerEvent( QTimerEvent * ) {
338// static int frame = 0; 338// static int frame = 0;
339// if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { 339// if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
340// frame = frame >= 7 ? 0 : frame + 1; 340// frame = frame >= 7 ? 0 : frame + 1;
341// } 341// }
342} 342}
343 343
344 344
345void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 345void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
346 for ( int i = 0; i < numButtons; i++ ) { 346 for ( int i = 0; i < numButtons; i++ ) {
347 if ( event->state() == QMouseEvent::LeftButton ) { 347 if ( event->state() == QMouseEvent::LeftButton ) {
348 348
349 // The test to see if the mouse click is inside the button or not 349 // The test to see if the mouse click is inside the button or not
350 int x = event->pos().x() - xoff; 350 int x = event->pos().x() - xoff;
351 int y = event->pos().y() - yoff; 351 int y = event->pos().y() - yoff;
352 352
353 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 353 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
354 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 354 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 );
355 355
356 if ( isOnButton && i == AudioVolumeUp ) 356 if ( isOnButton && i == AudioVolumeUp )
357 qDebug("on up"); 357 qDebug("on up");
358 358
359 if ( isOnButton && !audioButtons[i].isHeld ) { 359 if ( isOnButton && !audioButtons[i].isHeld ) {
360 audioButtons[i].isHeld = TRUE; 360 audioButtons[i].isHeld = TRUE;
361 toggleButton(i); 361 toggleButton(i);
362 switch (i) { 362 switch (i) {
363 case AudioVolumeUp: 363 case AudioVolumeUp:
364 qDebug("more clicked"); 364 qDebug("more clicked");
365 emit moreClicked(); 365 emit moreClicked();
366 return; 366 return;
367 case AudioVolumeDown: emit lessClicked(); return; 367 case AudioVolumeDown: emit lessClicked(); return;
368 } 368 }
369 } else if ( !isOnButton && audioButtons[i].isHeld ) { 369 } else if ( !isOnButton && audioButtons[i].isHeld ) {
370 audioButtons[i].isHeld = FALSE; 370 audioButtons[i].isHeld = FALSE;
371 toggleButton(i); 371 toggleButton(i);
372 } 372 }
373 } else { 373 } else {
374 if ( audioButtons[i].isHeld ) { 374 if ( audioButtons[i].isHeld ) {
375 audioButtons[i].isHeld = FALSE; 375 audioButtons[i].isHeld = FALSE;
376 if ( !audioButtons[i].isToggle ) 376 if ( !audioButtons[i].isToggle )
377 setToggleButton( i, FALSE ); 377 setToggleButton( i, FALSE );
378 switch (i) { 378 switch (i) {
379 case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; 379 case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
380 case AudioStop: mediaPlayerState->setPlaying(FALSE); return; 380 case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
381 case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; 381 case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return;
382 case AudioNext: mediaPlayerState->setNext(); return; 382 case AudioNext: mediaPlayerState->setNext(); return;
383 case AudioPrevious: mediaPlayerState->setPrev(); return; 383 case AudioPrevious: mediaPlayerState->setPrev(); return;
384 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; 384 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
385 case AudioVolumeUp: emit moreReleased(); return; 385 case AudioVolumeUp: emit moreReleased(); return;
386 case AudioVolumeDown: emit lessReleased(); return; 386 case AudioVolumeDown: emit lessReleased(); return;
387 case AudioPlayList: mediaPlayerState->setList(); return; 387 case AudioPlayList: mediaPlayerState->setList(); return;
388 } 388 }
389 } 389 }
390 } 390 }
391 } 391 }
392} 392}
393 393
394 394
395void AudioWidget::mousePressEvent( QMouseEvent *event ) { 395void AudioWidget::mousePressEvent( QMouseEvent *event ) {
396 mouseMoveEvent( event ); 396 mouseMoveEvent( event );
397} 397}
398 398
399 399
400void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 400void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
401 mouseMoveEvent( event ); 401 mouseMoveEvent( event );
402} 402}
403 403
404 404
405void AudioWidget::showEvent( QShowEvent* ) { 405void AudioWidget::showEvent( QShowEvent* ) {
406 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 406 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
407 mouseMoveEvent( &event ); 407 mouseMoveEvent( &event );
408} 408}
409 409
410 410
411void AudioWidget::closeEvent( QCloseEvent* ) { 411void AudioWidget::closeEvent( QCloseEvent* ) {
412 mediaPlayerState->setList(); 412 mediaPlayerState->setList();
413} 413}
414 414
415 415
416void AudioWidget::paintEvent( QPaintEvent * ) { 416void AudioWidget::paintEvent( QPaintEvent * pe) {
417 if ( !pe->erased() ) { 417 if ( !pe->erased() ) {
418 // Combine with background and double buffer 418 // Combine with background and double buffer
419 QPixmap pix( pe->rect().size() ); 419 QPixmap pix( pe->rect().size() );
420 QPainter p( &pix ); 420 QPainter p( &pix );
421 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 421 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
422 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 422 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
423 for ( int i = 0; i < numButtons; i++ ) 423 for ( int i = 0; i < numButtons; i++ )
424 paintButton( &p, i ); 424 paintButton( &p, i );
425 QPainter p2( this ); 425 QPainter p2( this );
426 p2.drawPixmap( pe->rect().topLeft(), pix ); 426 p2.drawPixmap( pe->rect().topLeft(), pix );
427 } else { 427 } else {
428 QPainter p( this ); 428 QPainter p( this );
429 for ( int i = 0; i < numButtons; i++ ) 429 for ( int i = 0; i < numButtons; i++ )
430 paintButton( &p, i ); 430 paintButton( &p, i );
431 } 431 }
432} 432}
433 433
434void AudioWidget::keyReleaseEvent( QKeyEvent *e) 434void AudioWidget::keyReleaseEvent( QKeyEvent *e)
435{ 435{
436 switch ( e->key() ) { 436 switch ( e->key() ) {
437////////////////////////////// Zaurus keys 437////////////////////////////// Zaurus keys
438 case Key_Home: 438 case Key_Home:
439 break; 439 break;
440 case Key_F9: //activity 440 case Key_F9: //activity
441 hide(); 441 hide();
442// qDebug("Audio F9"); 442// qDebug("Audio F9");
443 break; 443 break;
444 case Key_F10: //contacts 444 case Key_F10: //contacts
445 break; 445 break;
446 case Key_F11: //menu 446 case Key_F11: //menu
447 break; 447 break;
448 case Key_F12: //home 448 case Key_F12: //home
449 break; 449 break;
450 case Key_F13: //mail 450 case Key_F13: //mail
451 break; 451 break;
452 case Key_Space: { 452 case Key_Space: {
453 if(mediaPlayerState->playing()) { 453 if(mediaPlayerState->playing()) {
454// toggleButton(1); 454// toggleButton(1);
455 mediaPlayerState->setPlaying(FALSE); 455 mediaPlayerState->setPlaying(FALSE);
456// toggleButton(1); 456// toggleButton(1);
457 } else { 457 } else {
458// toggleButton(0); 458// toggleButton(0);
459 mediaPlayerState->setPlaying(TRUE); 459 mediaPlayerState->setPlaying(TRUE);
460// toggleButton(0); 460// toggleButton(0);
461 } 461 }
462 } 462 }
463 break; 463 break;
464 case Key_Down: 464 case Key_Down:
465 toggleButton(6); 465 toggleButton(6);
466 emit lessClicked(); 466 emit lessClicked();
467 emit lessReleased(); 467 emit lessReleased();
468 toggleButton(6); 468 toggleButton(6);
469 break; 469 break;
470 case Key_Up: 470 case Key_Up:
471 toggleButton(5); 471 toggleButton(5);
472 emit moreClicked(); 472 emit moreClicked();
473 emit moreReleased(); 473 emit moreReleased();
474 toggleButton(5); 474 toggleButton(5);
475 break; 475 break;
476 case Key_Right: 476 case Key_Right:
477// toggleButton(3); 477// toggleButton(3);
478 mediaPlayerState->setNext(); 478 mediaPlayerState->setNext();
479// toggleButton(3); 479// toggleButton(3);
480 break; 480 break;
481 case Key_Left: 481 case Key_Left:
482// toggleButton(4); 482// toggleButton(4);
483 mediaPlayerState->setPrev(); 483 mediaPlayerState->setPrev();
484// toggleButton(4); 484// toggleButton(4);
485 break; 485 break;
486 case Key_Escape: 486 case Key_Escape:
487 break; 487 break;
488 488
489 }; 489 };
490} 490}