-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 2a158a8..8f34736 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -371,135 +371,127 @@ void AudioWidget::timerEvent( QTimerEvent * ) { void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { for ( unsigned int i = 0; i < buttons.size(); i++ ) { if ( event->state() == QMouseEvent::LeftButton ) { // The test to see if the mouse click is inside the button or not bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); if ( isOnButton && !buttons[i].isHeld ) { buttons[i].isHeld = TRUE; toggleButton(i); switch (i) { case VolumeUp: emit moreClicked(); return; case VolumeDown: emit lessClicked(); return; case Forward: emit forwardClicked(); return; case Back: emit backClicked(); return; } } else if ( !isOnButton && buttons[i].isHeld ) { buttons[i].isHeld = FALSE; toggleButton(i); } } else { if ( buttons[i].isHeld ) { buttons[i].isHeld = FALSE; if ( !buttons[i].isToggle ) { setToggleButton( i, FALSE ); } qDebug("mouseEvent %d", i); handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); } } } } void AudioWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void AudioWidget::showEvent( QShowEvent* ) { QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); mouseMoveEvent( &event ); } void AudioWidget::paintEvent( QPaintEvent * pe ) { 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 ( unsigned int i = 0; i < buttons.size(); i++ ) paintButton( p, i ); QPainter p2( this ); p2.drawPixmap( pe->rect().topLeft(), pix ); } else { QPainter p( this ); for ( unsigned int i = 0; i < buttons.size(); i++ ) paintButton( p, i ); } } void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity hide(); // qDebug("Audio F9"); break; case Key_F10: //contacts break; case Key_F11: //menu mediaPlayerState.toggleBlank(); break; case Key_F12: //home break; case Key_F13: //mail mediaPlayerState.toggleBlank(); break; case Key_Space: { - if(mediaPlayerState.isPlaying()) { - // toggleButton(1); - mediaPlayerState.setPlaying(FALSE); - // toggleButton(1); - } else { - // toggleButton(0); - mediaPlayerState.setPlaying(TRUE); - // toggleButton(0); - } + mediaPlayerState.togglePaused(); } break; case Key_Down: // toggleButton(6); emit lessClicked(); emit lessReleased(); // toggleButton(6); break; case Key_Up: // toggleButton(5); emit moreClicked(); emit moreReleased(); // toggleButton(5); break; case Key_Right: // toggleButton(3); mediaPlayerState.setNext(); // toggleButton(3); break; case Key_Left: // toggleButton(4); mediaPlayerState.setPrev(); // toggleButton(4); break; case Key_Escape: { } break; }; } |